Commit Graph

18503 Commits

Author SHA1 Message Date
Federico Mena Quintero
2db8e25cdb treeview: Use equal areas in the computation of drag dest row positions
We used to divide the row in thirds vertically, and use the outer thirds for GTK_TREE_VIEW_DROP_BEFORE and AFTER, respectively.

Now we use *fourths*.  This is so that we get equal areas for these:

  GTK_TREE_VIEW_DROP_BEFORE
  GTK_TREE_VIEW_DROP_INTO_OR_BEFORE
  GTK_TREE_VIEW_DROP_INTO_OR_AFTER
  GTK_TREE_VIEW_DROP_AFTER

This makes hovering tree rows much more positive.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
a1b9bf7fbc Adjust the drag destination row when it is above the currently highlighted row
This makes the feedback accurate and without hysteresis.  Haven't I written this code ten times before?

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
3815f5d956 Dropping on the feedback row is always possible
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
bc0a9a33b0 Add a temporary row for feedback when inserting a bookmark is possible
We'll prettify this gradually.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:23:55 -05:00
Matthias Clasen
264b4bf118 extract-strings: Deal with multiline strings
When putting out N_(...) macros, we must split multiline strings,
otherwise xgettext complains.
2013-04-19 15:22:03 -04:00
Federico Mena Quintero
624b352d77 Move the drop feedback code to stub functions
For now it is the old, simple call to gtk_tree_view_set_drag_dest_row().  We'll do something
fancier in the following commits.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 11:30:23 -05:00
Federico Mena Quintero
7d52dff5ec Add a DropState enum to the internal state of the sidebar
We want to show a little animation when a DnD operation is happening and the user hovers
between existing bookmarks.  The animation should indicate the user that he's about to
create a new bookmark from the file right there.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 11:20:13 -05:00
P. F. Chimento
29c7562ca7 doc: Documented icon-shadow CSS property
The docs say that text-shadow applies a drop shadow to both text
and icons, but icons need to use the icon-shadow property.

https://bugzilla.gnome.org/show_bug.cgi?id=698181
2013-04-19 10:19:25 -04:00
Matthias Clasen
163542f545 Fix mouse interaction in combo cell renderer
Pass the event on when calling gtk_cell_editable_start_editing.
https://bugzilla.gnome.org/show_bug.cgi?id=504901
2013-04-19 10:11:48 -04:00
Ryan Lortie
a37ddbe74b menu binding docs: Link to insert_action_group()
It's pretty useless to make a menu without actions behind it and people
who are using gtk_menu_shell_bind_model() directly are probably not
interested in doing it the GtkApplicationWindow way (so they won't get
the "app" and "win" groups for free).  People are going to need to call
gtk_widget_insert_action_group(), so mention this in the docs to help
them along.
2013-04-18 07:11:15 -04:00
Christian Persch
9f0ee69552 bindings: Fix gtk_binding_entry_skip
This fixes a regression from commit 9a3466832c.

https://bugzilla.gnome.org/show_bug.cgi?id=695380
2013-04-17 13:21:44 +02:00
Juan Pablo Ugarte
1a06842425 GtkSwitch: moved focus drawing from outside border inside the handle. 2013-04-16 03:16:43 -03:00
Federico Mena Quintero
3b3eb4bdbc Merge branch 'merge-places-sidebar'
This is the new GtkPlacesSidebar widget, which is the sidebar used in
GtkFileChooser to display a list of places/folders that the user may
want to use.  File managers are encouraged to use this widget for
their own global list of folders.
2013-04-15 19:29:37 -05:00
Tristan Van Berkom
a6f9ef0d3a Load the file chooser's widgets from the .ui file
This is Tristan's *excellent* work, minus the old code for the shortcuts bar - that is all done
in GtkPlacesSidebar now.

The UI gets loaded from a Glade resource; most of the old code to create the UI by hand is gone.

There is still code for save_widgets_create(); this needs to be moved into the UI file, but it
is not a big deal.

gtk_file_chooser_default_init() calls a new post_process_ui() that takes care of all the things
that cannot be done directly in Glade.
2013-04-15 19:29:12 -05:00
Federico Mena Quintero
1d946367d3 For now, add GtkPlacesSidebar to the Glade catalog for private widgets
Although GtkPlacesSidebar is a public widget, we can't have that in Glade's general catalog
as this branch is not merged into GTK+ proper yet.  We'll move the widget to Glade's
catalog when this is done.
2013-04-15 19:29:12 -05:00
Federico Mena Quintero
c297d4de68 Add .ui file for GtkFileChooserDefault 2013-04-15 19:29:12 -05:00
Simon Kågedal Reimer
d29a441106 doc: Clarify gtk_widget_queue_draw_region() doc 2013-04-15 15:43:26 +02:00
Alban Browaeys
ad764c8a58 print: disconnect source_changed_handler on printeroptionwidget finalize
Printing a web page without window.print (which still segfault),
that is Ctrl+P is fixed (does not attempt to execute the
source_changed_handler on a printeroptionwidget that has been
destroyed) by disconnecting this handler in the printeroptionwidget
finalize.

https://bugzilla.gnome.org/show_bug.cgi?id=696622
2013-04-14 20:20:14 -04:00
Carlos Garcia Campos
c737e1d194 gtkprintjob: release the surface and backend before the output io channel
If the GtkPrintJob is freed too early when the surface has been created
but the job hasn't been sent to the printer, it's possible that the
file print backend tries to write to the io chaneel when it is already
closed. This produces runtime critical warnings:

GLib-CRITICAL **: g_io_channel_write_chars: assertion `channel->is_writeable' failed

https://bugzilla.gnome.org/show_bug.cgi?id=685420
2013-04-14 12:19:09 +02:00
ammonkey
4445dce697 fix mem leak in gtk_drag_set_icon_surface, destroy pattern
https://bugzilla.gnome.org/show_bug.cgi?id=681446
2013-04-13 20:06:43 -04:00
Matthias Clasen
83e104b093 Revert "Use natural size to set adjustment ranges"
This reverts commit 666d10ec76.

This change severely broke any treeviews without horizontal
scrollbars. Basically, ellipsization never kicks in, and instead
the treeview content just extends outside the visible area,
rendering it inaccessible. This broke e.g. the control-center
keyboard shortcuts panel, the gnome-disks device list, etc etc.
2013-04-13 16:24:10 -04:00
Matthias Clasen
ff56d02d7b csd: Don't use a content_window for o-r windows
This fixes drawing of dnd icons.
https://bugzilla.gnome.org/show_bug.cgi?id=697886
2013-04-12 22:49:40 -04:00
Federico Mena Quintero
4d4904ed8a Move all of GtkFileChooserDefault's fields into a private structure
I love Emacs macros, by the way.
2013-04-11 22:44:19 -05:00
Federico Mena Quintero
b0eed8680c Move GtkFileChooserDefault to gtkfilechooserdefault.c
We will move all the fields to a private structure next.
2013-04-11 21:44:21 -05:00
Federico Mena Quintero
e2c9797994 Move GtkFileChooserWidgetPrivate to gtkfilechooserwidget.c
In addition, remove the unused "file_system" field from that
structure.
2013-04-11 20:51:09 -05:00
Federico Mena Quintero
70fce923bc Move GtkFileChooserDialogPrivate into gtkfilechooserdialog.c
We'll take private structures out of gtkfilechooserprivate.h and move
them to the appropriate place.
2013-04-11 20:46:47 -05:00
Federico Mena Quintero
456c318f6e Remove unused #define 2013-04-11 20:42:43 -05:00
Federico Mena Quintero
9a3bc21dc9 Don't include gtkfilechooserprivate.h from the file chooser's tests
We will make that file a fully private header; the tests have no
business poking inside the file chooser's internals at this point.
2013-04-11 20:40:05 -05:00
Federico Mena Quintero
d3985dec1d GtkPlacesSidebar: Hold a reference to the sidebar while a D-Bus proxy is being created
The creation is async, and the sidebar could be destroyed while the D-Bus proxy is being created.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-11 20:04:53 -05:00
Federico Mena Quintero
5b827c53e5 Merge branch 'places-sidebar' into master
This lands the GtkPlacesSidebar widget.  It is used in
GtkFileChooserDefault, and it can also be used by third-party
applications.
2013-04-11 19:45:12 -05:00
Federico Mena Quintero
21083978f0 Revert "GtkFileChooserDefault: Define children with a GtkBuilder template"
Having the changes for composite widget templates makes it impossible
to merge the places-sidebar branch.  So, we will merge that branch,
and *then* apply the changes for composite templates.

This reverts commit bf909f5615.
2013-04-11 16:47:38 -05:00
Alexander Larsson
5ac3edf77f Update gtk.symbols
This fixes win32 build
2013-04-11 11:25:26 +02:00
Alexander Larsson
8c61659225 win32: Fix build
Need to take ".exe" into account for file dependencies on win32.
2013-04-11 11:25:26 +02:00
Matthias Clasen
c402e89299 csd: Use symbolic icons for window buttons
With symbolic icons, we can recolor the icons as needed, and we
can use icon shadows, etc.
2013-04-10 06:13:26 -04:00
Chris Cummins
e707eadaf2 Update GtkCssProvider box-shadow documentation
Non-inset box-shadows are no longer ignored by the GTK+ theming engine,
outset shadows are supported.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-04-09 12:52:52 +01:00
Chris Cummins
f478f16dba cds: enable outset shadows
Adds conditional code paths to GdkCssShadowValue for painting outset
shadows, and allows shadows to be applied in two passes (first outset
then inset). This can be used to draw csd shadows in outer window
borders.

https://bugzilla.gnome.org/show_bug.cgi?id=695998
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-04-09 12:52:47 +01:00
Carlos Garnacho
7ffcd85d13 quartz: Fix call to missing symbol
This patch can be considered a leftover of commit 6f607fc8b4 ,
replace the no longer existing function with the GDK function
meant to replace it.

This was noticeable on regular clipboard operations in quartz
2013-04-09 12:38:46 +02:00
Benjamin Otte
c4dc0e8e40 window: Remember current size
Don't just look at previously remembered sizes, also look at the current
size.
This is useful for cases where the window was resized by the user or WM
and not by the application itself.

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-09 12:09:12 +02:00
Benjamin Otte
70dbb14f89 window: Split out a function
We don't want to remember sizes in the not resizable case. Also a
function named "guess_default_size" should not look at previous sizes,
it should guess.
2013-04-09 12:09:12 +02:00
Benjamin Otte
33f1210f72 window: Remove an unused function.
Luckily, we don't need to support an implementation of a minimal WM for
linux-fb anymore (which is what this function was added for).
2013-04-09 12:09:12 +02:00
Benjamin Otte
72290fb538 docs: Fix Since tag for frame clock functions 2013-04-09 12:09:11 +02:00
Benjamin Otte
21f11eb0e6 window: restore size after hide/show properly
Old code assumed the size was stored in widget.allocation. This is no
longer true as the allocation is cleared upon hide. However, we store
the last configure request, and that one tracks the last size, so we can
just use that number.

Sometimes things are so easy - once you figure them out...

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-08 16:34:19 +02:00
Benjamin Otte
b662e96e7e plug: Don't unregister windows that were never registered
Fixes warnings when trying to unregister the socket window. The socket
window is foreign, so we shouldn't register it in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=697427
2013-04-08 16:34:19 +02:00
Colin Walters
5e7df8bf14 build: Fix srcdir != builddir 2013-04-08 10:16:58 -04:00
Matthias Clasen
d90ddf85f6 Extract strings from .ui files without intltool 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
92a8c76b31 GtkVolumeButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
36bacc4674 GtkFontButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
4c81151a20 GtkFileChooserButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
42f53ab58e GtkPathBar: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
0f3ef7eea6 GtkColorEditor: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
65080c6755 GtkColorPlane: Added construct-only properties to setup the adjustments.
This allows basic construction of this private type in GtkBuilder script,
so it can be used in the GtkColorEditor UI.
2013-04-08 21:19:29 +09:00
Tristan Van Berkom
9accb95b9f GtkPrintUnixDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
0f16d7c6d5 GtkPageSetupUnixDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
a58412027f GtkRecentChooserDefault: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
6f8162a2e1 GtkFontChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
21391027c4 GtkFontChooserWidget: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
b537e1badd GtkFileChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
bf909f5615 GtkFileChooserDefault: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
09b44d7ab5 GtkColorChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
d50516ebd7 GtkAppChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
ae690479a0 GtkAppChooserWidget: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
c6aa7cc92d GtkStatusbar: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
b9fd422aca GtkScaleButton: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
90cd240c6d GtkAssistant: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
3c39c388c9 GtkLockButton: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
67a2cdb303 GtkAboutDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
56167944e5 GtkInfoBar: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
671871b43e GtkMessageDialog: Define children with a GtkBuilder template 2013-04-08 21:19:27 +09:00
Tristan Van Berkom
33f6195d0e GtkDialog: Define children with a GtkBuilder template
As the first composite widget in GTK+, this patch also
adds some Makefile mechanics to list the ui files as
dependencies of the global GTK+ resources, and adds the
initial test case where composite classes should be tested.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
a41c628a3b Added directory with Glade catalog
This catalog can be used to work with GTK+'s private widget types,
this patch exposes a private function gtk_glade_catalog_init() which
Glade will use for the sole purpose of initializing some private widget
types in GTK+ that are referenced from various GTK+ composite widget
xml files.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
3b7fc8cdc9 Add Composite Child machinery and APIs to GtkWidget
This commit implements the needed machinery for GtkWidget
to build it's composite content from GtkBuilder XML and
adds the following API:

  o gtk_widget_init_template()

    An api to be called in instance initializers of any
    GtkWidget subclass that uses template XML to build it's components.

  o gtk_widget_class_set_template()

    API to associate GtkBuilder XML to a given GtkWidget subclass

  o gtk_widget_class_automate_child()

    API to declare an object built by GtkBuilder to be associated
    with an instance structure offset and automatically set.

 o gtk_widget_get_automated_child()

   API for bindings to fetch a child declared to be automated by
   gtk_widget_class_automate_child(), for the case where bindings
   do not generate GObjects under the hood and cannot use structure
   offsets to resolve composite object pointers.

 o gtk_widget_class_declare_callback[s]()

   Declare static functions to be used in signal callbacks from
   a given class's template XML

 o gtk_widget_class_set_connect_func()

   API for bindings to override the signal connection machinery
   for a given GtkWidget derived class.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
64b87824c7 GtkBuilder: Allow G_PARAM_CONSTRUCT properties to be set on internal children.
This patch allows properties of type G_PARAM_CONSTRUCT to be set
on internal children or explicitly constructed objects (built
with <constructor>) while previously, G_PARAM_CONSTRUCT properties
being set on already constructed objects would result in an misinformed
warning that "construct-only properties cannot be set".

G_PARAM_CONSTRUCT_ONLY properties are still refused as parameters
to already constructed children.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
b7da0d21f8 GtkBuilder: Add private _gtk_builder_extend_with_template()
This adds the definition of the <template> tag with some documentation
on the variant of the format.

_gtk_builder_extend_with_template() is to be used while GtkContainer
builds from composite templates. A couple of error codes are also added
to handle a few new possible failure cases.

DTD Files gtkbuilder.rnc and gtkbuilder.rng have been updated to include
the new <template> tag and it's attributes.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
82583640a2 GtkBuilder: Added api to allow private signal callbacks
In preperation for composite objects, for better encapsulation
the following APIs are added to allow handling of signals declared
in the XML with callbacks declared statically.

  o gtk_builder_add_callback_symbol[s]()

    Adds a symbol to the internal symbol hash

  o gtk_builder_lookup_symbol()

    Looks up a symbol, exposed in case added symbols are used
    in conjunction with gtk_builder_connect_signals_full()

The default implementation of gtk_builder_connect_signals() now
does not have a strong requirement on GModule (or a strong requirement
on symbols being declared in the global namespace). Instead GModule
is used as a fallback in the case that symbols are not declared
explicitly.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
4ec6d6006e Work around access to global resources without calling gtk_init()
Some utilities such as GIR and gtk-doc, initialize class vtables without
initializing GTK+, with composite templates accessing resources this
causes a hand full of unneeded warnings.

The workaround for now is the use a private function _gtk_ensure_resources()
which is both called while initializing GTK+, and at the beginning of
gtk_widget_class_set_template_from_resource() (the private function
ensures that the resource will only ever be registered GOnce).
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
c6ab515735 Deprecate gtk_widget_push_composite_child & friends
Deprecate gtk_widget_push_composite_child, gtk_widget_pop_composite_child,
gtk_widget_set_composite_name, gtk_widget_get_composite_name.

This API is just bloat and was never useful, this patch deprecates
it and removes all internal calls to the composite child APIs
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
38dc4733c0 GtkScale: Properly chain up in GtkBuildableIface->custom_finished()
This was causing <style> markup to be ignored when specified
on GtkScale types.
2013-04-08 21:18:47 +09:00
Matthias Clasen
e47689d9ea csd: Implement hide-titlebar-when-maximized 2013-04-06 17:24:29 -04:00
Tristan Van Berkom
909e82a2a6 GtkRecentChooserMenu: avoid accessing a NULL action
When the GtkActivatable sets the related action, the activatable
properties are sync'ed. In this case the null check is important
to avoid updating from a NULL action.
2013-04-06 18:46:20 +09:00
Tristan Van Berkom
fbb9447785 gtk_recent_chooser_set_filter: Allow NULL value to unset the filter.
While GtkRecentChooser implementations accept for the "filter" property
to unset the current filter, the API fires an unneeded assertion.

This patch removes the assertion.
2013-04-06 18:06:51 +09:00
Benjamin Otte
b315868663 gtk: Simplify code for reduced screen count 2013-04-06 10:47:55 +02:00
Benjamin Otte
e255cf15fb icontheme: Remove unused function 2013-04-06 10:47:55 +02:00
Tristan Van Berkom
c771a8a3a6 objects-finalize test: Blacklist gdk_pixbuf_simple_anim_iter_get_type() 2013-04-05 21:11:13 +09:00
Tristan Van Berkom
33b9865651 Added test case to assert all object types finalize properly.
The test case uses a weak ref to assert objects can finalize,
and then spins the main loop shortly after finalizing to assert
that the finalized object did not leak GSources into the main context
causing latent crashes.
2013-04-05 20:14:38 +09:00
Alexander Larsson
a2c65d47b0 Fix gtk_window_set_opacity()
We *do* want to call gdk_window_set_opacity() on toplevels, because
this particular case does work.

https://bugzilla.gnome.org/show_bug.cgi?id=697263
2013-04-04 15:42:02 +02:00
Pavel Vasin
edbb522f1f GtkHeaderBar: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=696767
2013-04-03 19:20:54 -04:00
Sébastien Wilmet
14c9023a05 GtkWindow: fix notify of :attached-to
https://bugzilla.gnome.org/show_bug.cgi?id=697200
2013-04-03 19:32:21 +02:00
Cosimo Cecchi
a60ddd9a02 window: don't schedule a display of mnemonics if window has no modifier
When the window has no mnemonics modifier set, as in the case of a
GtkMenu, never schedule a display of mnemonics on focus-in.

Previously, for those windows, the GdkModifierType mask fetched from the
device would typically have been zero, leading to the

mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ())

check to succeed, so we would always trigger a display for popup menus.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:44 -04:00
Cosimo Cecchi
cfb1e56561 window: refactor a function
Instead of having maybe_set_mnemonics_visible(), separate the checks
from the actual scheduling of mnemonics display.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:43 -04:00
Cosimo Cecchi
58209e1138 window: rename functions dealing with mnemonic delayed display
Don't mention "auto mnemonics", since those methods are purely about
scheduling a delayed display, and that makes understanding the code a
bit harder.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:42 -04:00
Cosimo Cecchi
68b437eea2 window: reset timeout source id before setting property
gtk_window_set_mnemonics_visible() will try to g_source_remove() it
otherwise, which seems harmless, but conceptually wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:39 -04:00
Benjamin Otte
e69e609bd7 style: Add missing deprecation markers
Some functions in gtkstyle.h were overlooked when we added the
GDK_DEPRECATED macros.

Also add IGNORE_DEPRECATIONS to the few remaining callers of those
functions.
2013-04-02 11:45:45 +02:00
Benjamin Otte
f47f94be42 window: Remove call to gtk_widget_reset_rc_styles()
First of all, that call is deprecated. Second, we don't have RC styles
anymore. Third, what that function does today is invalidate style
contexts, but that happens automatically when setting the screen on the
style context later.

So this function is completely unnecessary.
2013-04-02 11:45:44 +02:00
Benjamin Otte
225dec6940 celrendererspinner: Don't use deprecated API 2013-04-02 11:45:44 +02:00
Benjamin Otte
231520af8f widget: Get rid of deprecation warnings 2013-04-02 11:45:44 +02:00
Ryan Lortie
45a94ccc88 tests: improve gtkmenu testcase
Don't just create a menushell and populate it with random data -- verify that
the resulting menu layout is actually correct.

This is introduced in a separate commit because the old code was failing this
part of the test.

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:20 -04:00
Ryan Lortie
5617b58420 Introduce GtkMenuTracker
GtkMenuTracker folds a nested structure of sections in a GMenuModel into
a single linear menu, which it expresses to its user by means of 'insert
item at position' and 'remove item at position' callbacks.

The logic for where to insert separators and how to handle action
namespaces is contained within the tracker, removing the need to have
this logic duplicated in the 3 or 4 places that consume GMenuModel.

In comparison with the previous code, the tracker no longer completely
destroys and rebuilds menus every time a single change occurs.  As a
result, the new gtkmenu testcase now runs in approximately 3 seconds
instead of ~60 before.

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:19 -04:00
Ryan Lortie
e250e52175 tests: add a test for gtk_menu_shell_bind()
Borrow the RandomMenu code from the GLib testsuite and hook it up to
gtk_menu_shell_bind().

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:19 -04:00
Sébastien Wilmet
d599985a41 gtktextattributes: move comment above relevant struct
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
a5f52afd38 GtkTextTagTable: simplify a bit the code
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
97dfcc1073 GtkTextView: remove some dead code
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
6f990fa7e4 gtktextattributes: explain what is "pg_bg"
I didn't know what "pg" stands for.

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
3a8f70dd1e gtktextattributes: include the right headers
Some function prototypes in gtktexttagprivate.h are implemented in
gtktextattributes.c.

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
fd84704d94 gtktexttypes: remove inline_byte_begins_utf8_char()
The function was used only in gtk_text_byte_begins_utf8_char().

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Benjamin Otte
cbee390148 cssvalue: At cycle detection to color resolving
The following CSS would infloop:

@define-color self @self

as it would infinitely lookup the color named "self" and try to resolve
it. This patch adds detection of such cycles to the resolve function by
keeping a list of currently resolving colors in the cycle_list variable.
2013-03-28 23:18:59 +01:00
Benjamin Otte
c25d8e3aea cssvalue: Handle named colors not resolving
If a named color references a nonexistant named color, we didn't catch
that error and ended up crashing on a NULL-dereference.
This crashed Boxes, because its CSS referenced values from the theme
that didn't exist in any theme.
2013-03-28 23:18:59 +01:00
Benjamin Otte
dded6a0673 menuitem: Remove old themeing enhancement
CSS doesn't allow themeing parents based on the state of their children,
so this code just causes extra redraws today.
2013-03-28 23:18:59 +01:00
Benjamin Otte
d20ac0acf9 menushell: Remove unused header 2013-03-28 23:18:58 +01:00
Benjamin Otte
436af3fcb5 menu: Move enum declaration to correct header
That enum is used in GtkMenuShellClass, so put it there.
2013-03-28 23:18:58 +01:00
Benjamin Otte
030c65f299 tearoffmenuitem: Use public API, don't poke GtkMenuPrivate 2013-03-28 23:18:58 +01:00
Alexander Larsson
7df7e092b9 GtkOverlay: Respect overlay child min size
Never allocate an overlayed child less than its minimum request.
If the minimum doesn't fit we will gracefully clip via the
widget window.

https://bugzilla.gnome.org/show_bug.cgi?id=696623
2013-03-28 13:32:09 +01:00
Alexander Larsson
785a916267 GtkOverlay: Don't allocate child except in size_allocate
We were calling gtk_overlay_child_allocate() both in realize
and in add as we wanted to create and position the child windows
for the widgets. However, this call also actually called
gtk_widget_size_allocate() on the child, which it shouldn't. In some
cases the overlay is realized before being allocated, and thus it
will allocate the child at 0x0 which is an invalid size for it to be in.
In particular, if the child has margins set this will result in negative
allocations and warnings.

This fix splits out the allocation computation so that
gtk_overlay_create_child_window can use it without callers
having to call gtk_overlay_child_allocate() to move the windows.

https://bugzilla.gnome.org/show_bug.cgi?id=696623
2013-03-28 13:32:06 +01:00
Kristian Rietveld
6f607fc8b4 quartz: move atom/pasteboard type conversions functions to GDK
(cherry picked from commit a269c2f8d2)
2013-03-28 13:10:38 +01:00
Matthias Clasen
93efaa5ebe Fix GtkApplicationWindow menubar placement
Since the menubar is part of the content, we need to give
it the content_window as parent window, to make things
work again.
https://bugzilla.gnome.org/show_bug.cgi?id=696561
2013-03-27 00:23:19 -04:00
Matthias Clasen
bdfd0d4638 Don't return FALSE from a non-boolean function
https://bugzilla.gnome.org/show_bug.cgi?id=696608
2013-03-26 23:30:10 -04:00
Sébastien Wilmet
6cb2816c45 GtkWidget: add missing deprecation marks
https://bugzilla.gnome.org/show_bug.cgi?id=696138
2013-03-24 14:22:38 -04:00
Sébastien Wilmet
30788062f7 GtkLabel: fix underlining of mnemonics
The underscore was shown in front of the mnemonic instead of underlining
it (e.g., _Save).

Thanks to Lars Uebernickel.

https://bugzilla.gnome.org/show_bug.cgi?id=674759
2013-03-24 15:07:40 +01:00
Matthias Clasen
d1ad324d3d csd: Reparent the content
This lets us avoid problems with cursor changes.
2013-03-24 01:15:33 -04:00
Matthias Clasen
65cd2a59c3 Make gtk_init_check work as expected
When no GDK backend can be initialized (either because
GDK_BACKEND has been set to the wrong value, or the backends
are simply not included), the expectation is that gtk_init_check
should return FALSE, not error out.
This commit makes it so, by using gdk_display_manager_peek
instead of gdk_display_manager_get in code paths that are used
during initialization.
2013-03-23 19:41:39 -04:00
Tarnyko
0f59ff4550 win32: Bring back spinner animation
Define the spinner animation in css.
https://bugzilla.gnome.org/show_bug.cgi?id=696202
2013-03-23 17:42:55 -04:00
Colin Walters
4f0e9cbf81 gtktoolpalette: Only call gdk_atom_intern when we're constructed
Otherwise we end up trying to instantiate a display manager in
class_init which breaks introspection scanning.

https://bugzilla.gnome.org/show_bug.cgi?id=696457
2013-03-23 17:07:15 -04:00
Tarnyko
7ffaab3f91 win32: Improve GtkAssistant theming
The highlighted color chosen for GtkAssistant header font
(deep blue) makes it hardly readable is most cases. Switch
to light gray.
https://bugzilla.gnome.org/show_bug.cgi?id=696171
2013-03-23 15:47:39 -04:00
Matthias Clasen
cc86a7bb7e Add gtk_grid_remove_{row,column}
It is sometimes convenient to deal with entire rows or
columns at a time.
https://bugzilla.gnome.org/show_bug.cgi?id=695994
2013-03-23 15:43:37 -04:00
John Lindgren
666d10ec76 Use natural size to set adjustment ranges
This is an (unintentional) side effect of my changes to GtkTreeView's
get_preferred_size() implementation.  It seems odd to me that
GtkTreeView directly determines its own size when inside a
GtkScrolledWindow, but since it does, it should be using its natural
size, not its minimum size.
2013-03-23 19:49:03 +01:00
Vadim Godunko
55012318a6 Fix drawing of grid lines in RTL
The vertical grid lines were not properly positions in
RTL locales.
https://bugzilla.gnome.org/show_bug.cgi?id=696051
2013-03-23 14:01:35 -04:00
Tristan Van Berkom
1a088d3aba GtkBuilder: Fixed documentation
The documentation was referring to an <external-object> tag
which we never implemented
2013-03-23 20:44:12 +09:00
Matthias Clasen
75f4f7a471 Update cursor theme on wayland
Call the new new api from gtksettings.c when it changes, just
as we do for X11.
https://bugzilla.gnome.org/show_bug.cgi?id=696428
2013-03-22 20:33:47 -04:00
Cosimo Cecchi
5568dcb53c appchooserbutton: filter out applications not supposed to be visible
Ensure NoDisplay=true applications don't end up in the list populated by
GtkAppChooserButton.

https://bugzilla.gnome.org/show_bug.cgi?id=696405
2013-03-22 15:27:41 -04:00
Matthias Clasen
69f12b1090 Don't react to clicks in content
This breaks way too many things, and we explicitly trigger
drags from menubars and toolbars, where we want it.
2013-03-21 18:07:21 -04:00
Matthias Clasen
02a0759c5d csd: Make link activation work reliably
The label code was just letting some button press events bubble
up, which caused misbehaviour with the window dragging code.
https://bugzilla.gnome.org/show_bug.cgi?id=695506
2013-03-21 18:07:21 -04:00
Matthias Clasen
6eaa5ffa8a csd: Allow moving maximized windows
This make the nice 'snap off' feature of gnome-shell work
with client-side decorations. weston moves the maximized window
around, which is less ideal...
2013-03-21 18:07:21 -04:00
Cosimo Cecchi
8fd9575ab6 window: don't add the background style class when drawing CSD elements
We already set it in init, so this is just redundant.
The additional window-content style class here is needed so that we can
distinguish between the full X window background and the background for
the actual window contents.
2013-03-21 16:32:00 -04:00
Cosimo Cecchi
4bcaadac51 window: add a "client-decorated" style class when the window is so
The theme might want to apply some specific theming to a client
decorated toplevel window, so add a style class for that.
2013-03-21 16:31:14 -04:00
Matthias Clasen
329f7af159 Fix DND
The removal of the Motif DND code accidentally changed the
value of the TARGET_DELETE enumeration value, breaking DND
pretty badly.
2013-03-21 00:00:19 -04:00
Matthias Clasen
2bc313c624 GtkColorChooserDialog: make alternative button order work
The alternative button order that we set did not actually
work, since the ok button did not have a response id.
Partial fix for
https://bugzilla.gnome.org/show_bug.cgi?id=695493
2013-03-21 00:00:19 -04:00
Matthias Clasen
98801b07b4 GtkColorChooser: Fix selection of colors
Prevent the new window dragging code from interfering with
selection of colors on button release, by handling button
presses we care about instead of letting them bubble up to
the window.
Partial fix for
https://bugzilla.gnome.org/show_bug.cgi?id=695493
2013-03-20 22:21:16 -04:00
Matthias Clasen
da2a102adb GtkWindow: clean up button event handling
We were not translating event coordinates to the toplevel
window, thus the regions we determined were not right.
We were also not respecting the maximized state, and we
were unnecessarily refusing to handle events when not decorated.
https://bugzilla.gnome.org/show_bug.cgi?id=696197
2013-03-20 18:21:12 -04:00
Alexander Larsson
76e466197a GtkWidget: Handle style updates before realize
If the style changes before we're realized we will delay the
style-updated signal until realize. However, we then lose
the changes bitmap. This means that gtk_widget_real_style_updated()
must treat a NULL change as "everything changed" and queue a resize.
2013-03-20 13:56:16 +01:00
Matthias Clasen
3731a2bd90 GtkHeaderBar: Add subtitle support
As seen in GdHeaderBar.
2013-03-19 22:07:26 -04:00
Matthias Clasen
d42c2c3f19 GtkHeaderBar: Survive toggling custom / non-custom titles
The code was always adding a label widget as a child, but
then skipping over it in forall if a custom_title was present.
This confuses internal logic of GTK+ which assumes that it
can iterate over the entire widget hierarchy with forall,
to maintain state. Fix this by destroying the label when
a custom_title is set, and recreating it as needed.
2013-03-19 20:52:54 -04:00
Matthias Clasen
3289b3efbf GtkHeaderBar: Don't leak
Should have a finalize function, if there's strings to free.
Also avoid some pointless extra ref on custom title widgets.
2013-03-19 20:35:28 -04:00
Rob Bradford
8cdbee7fd2 window: Use update_window_buttons to hide title on fullscreen
The function update_window_buttons shows or hides the title header after it
has finished updating the visibility of the various buttons. Unfortunately
this
conflicted with the hiding of the title done when going fullscreen.

This solves the problem and fixes the rendering of fullscreen applications by
using update_window_buttons to control the visibility of the box in the
fullscreen case.
2013-03-19 19:48:35 +00:00
Christian Persch
953253f685 gtk: gtk_init_with_args allows NULL for parameter_string 2013-03-18 14:12:12 +01:00
Matthias Clasen
c4dc3a779a Revert "GtkHeaderBar: Allow window dragging"
This reverts commit 30a1a79322.

This turns out to be unnecessary when you can set the titlebar
on the window and let GtkWindow handle the events. As a benefit,
we get the window menu on custom titlebars for free.
2013-03-18 08:50:23 -04:00
Matthias Clasen
30d0542309 Add documentation for gtk_window_set_titlebar 2013-03-18 08:50:22 -04:00
Matthias Clasen
4afbaf699f Add gtk_window_set_titlebar
A new function that sets a custom titlebar on a GtkWindow.
With client-side decorations, the custom titlebar simply
replaces the one that GtkWindow would otherwise create itself.
With traditional decorations, we tell the window manager
to just decorate the window with a border. This works ok
at least with metacity and mutter.
2013-03-18 08:50:22 -04:00
Matthias Clasen
105c808d0a Small cleanup in gtk_window_draw
Get the allocation once, at the beginning.
2013-03-18 08:50:22 -04:00
Matthias Clasen
4a2c3bbf3c window: Don't draw titlebar background
GtkHeaderBar can do its own drawing, no need to do this
in gtk_window_draw.
2013-03-18 08:50:22 -04:00
Matthias Clasen
e29c25cd1b Trivial whitespace fix 2013-03-18 08:50:22 -04:00
Matthias Clasen
63f0f03a73 Add forgotten check
We don't want to create titlebar widgets if the window
is not decorated anyway.
2013-03-18 08:50:21 -04:00
Matthias Clasen
bec5798180 Fix a typo 2013-03-18 01:20:08 -04:00
Matthias Clasen
30a1a79322 GtkHeaderBar: Allow window dragging
We use the same window-dragging style property here to enable
this as for menubars and toolbars.
2013-03-18 01:02:19 -04:00
Matthias Clasen
2fe07c9068 Fix double accounting of border width
For csd, we were subtracting the border width one too many
times from the child height, causing clipped off content e.g.
in the 'Properties' window in testgtk.
2013-03-17 19:01:25 -04:00
Matthias Clasen
75a1e8251e Allocate the titlebar height according to width 2013-03-17 19:01:25 -04:00
Matthias Clasen
68b9bafd1d Add some visible border to the default csd 2013-03-17 19:01:25 -04:00
Matthias Clasen
df96b0239f GtkFontButton: default show-preview-entry to TRUE
This is what the property declaration says, after all.
https://bugzilla.gnome.org/show_bug.cgi?id=695948
2013-03-17 16:24:34 -04:00
Alban Browaeys
da961b7ab8 GtkEntryAccessible: also handle entry icon tooltip NULL in notify_gtk.
To clear the tooltip one is to set the tooltip to NULL. Though
the GtkEntryAccessible expect this tooltip to not be NULL in
gtk_entry_accessible_notify_gtk (already handling this case
 in its _init).

Fixes:
** (epiphany:23914): CRITICAL **: atk_object_set_description: assertion
`description != NULL' failed
when epiphany g_object_set the entry icon tooltip to NULL (clear the
tooltip) in its find bar.

https://bugzilla.gnome.org/show_bug.cgi?id=695375
2013-03-17 16:12:52 -04:00
Sébastien Wilmet
8e65fa1b43 GtkLabel: fix mnemonic-keyval when use-markup is true
To extract the mnemonic key value, the string must contain the
underscore. But when the "gtk-auto-mnemonics" setting is true and when
the Alt key is not pressed, the underscore must not be displayed. The
problem was that the 'new_str' variable was used for both purposes:
extract the text to display, and extract the accelerator character.

When the underscore must not be visible, the underscores were removed
from the 'new_str' variable before extracting the accelerator character.

Now there are two strings, one for each purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=674759
2013-03-17 16:10:10 -04:00
Rob Bradford
37509621bd css: Add style entries for client side decorations to default CSS 2013-03-17 12:19:51 -04:00
Matthias Clasen
a41f7e4741 window: Render inner and outer border separately
This lets themes render a window frame in the inner border,
and a shadow or nothing in the outer border.
2013-03-17 12:19:50 -04:00
Matthias Clasen
70ccfb0efc window: Split the border into inner and outer
For now, nothing changes, we're using the sum of inner and
outer border everywhere.

In the future, we will make the inner border the visible
window frame, and the outer border the shadow/resize border.
2013-03-17 12:19:50 -04:00
Matthias Clasen
41aad21693 window: Hide the border when maximized
Dragging windows from the border is not useful when maximized.
2013-03-17 12:19:50 -04:00
Matthias Clasen
003d9f4225 window: Add a window menu to the titlebar
The menu is triggered by right-click on the titlebar
or with the menu key.
2013-03-17 12:19:50 -04:00
Matthias Clasen
bf03c85e43 window: Allow resizing by clicking on the border
We also change cursors to indicate what interactions
are possible in various window regions.
Double clicking on the titlebar maximizes the window.
2013-03-17 12:19:50 -04:00
Matthias Clasen
037b1435ae window: Allow theme control over window buttons
Add a style property to control the presence and order of
window buttons. We allow buttons at the left and right side,
they can be specified like this: icon,close:minimize,maximize.

Also, change the default button layout back to have just a close
button on the right, use icons in buttons, and set style classes
on the buttons, to allow better theming.
2013-03-17 12:19:50 -04:00
Matthias Clasen
7d71f8888d Add icons for frame buttons
Add window-minimize, window-maximize, window-restore and window-delete
icons to the builtin icon theme. These will be used for icons in
the window buttons, and the expectation is that the icon theme
will provide icons matching the desired decoration style.

window-delete is used instead of window-close, since window-close
is also used for GTK_STOCK_CLOSE, and the two may require different
styles when used inside the application vs in the window frame.
2013-03-17 12:19:50 -04:00
Matthias Clasen
93c345e49f window: Hide frame buttons when appropriate
Hide the close button if the window is not deletable, hide the
maximize button if the window is not resizable, and hide all
buttons if the window is a dialog.

Update buttons when the window state changes.
2013-03-17 12:19:49 -04:00
Matthias Clasen
d05d08a2f3 window: Use same title fallback mechanism as X backend
This looks at the application name or program name and uses that
as the title if gtk_window_set_title has not been called.
2013-03-17 12:19:49 -04:00
Matthias Clasen
b141121ef6 window: Add support for enabling client decorations on non-Wayland
Client side decorations can be enabled on non-Wayland platforms by
setting the GTK_CSD="1" environment variable.

We must ensure we have a GdkVisual that has an alpha channel since
the decorations rely on transparency. If we cannot get a visual with
an alpha channel then we do not enable client side decorations.
2013-03-17 12:19:49 -04:00
Rob Bradford
f17b7136dd window: Hide the decorations on fullscreen
This is expected behaviour for fullscreen windows.
2013-03-17 12:19:31 -04:00
Rob Bradford
4618e0dcc7 window: Don't set a background pattern/colour when client decorated
Otherwise we'll potentially get some background sticking through our rounded
corners in our decorations. The actual background will get drawn as part of
the decoration drawing.
2013-03-17 12:13:35 -04:00
Kristian Høgsberg
6a8362111e window: Add initial support for client-side decorations under Wayland
This change comprises four main parts:
 * the creation of the widgets that form the decorations,
 * implementation of get_preferred_height/width, and the for_width/for_height
   variants,
 * taking the decorations into account when allocating,
 * and drawing the decorations themselves.

Kristian did the bulk of the original work on this but any bugs are almost
certainly mine through the many refactorings and rebasings.
2013-03-17 12:13:35 -04:00
Matthias Clasen
3f9455301e Add GtkHeaderBar
This widget has been developed as GdHeaderBar in libgd.
The copy here has been renamed and changed to use GTK+
internals.
2013-03-17 12:12:53 -04:00
Rob Bradford
55a98da4d4 window: Allow _gtk_window_set_allocation to return a modified allocation
Update the documentation and users of this function to handle
the future case that that we have some internal decorations to the window and
useable allocation is thus smaller.

By having a separate out parameter there is no need to have an in/out function
and allows for greater robustness.

The current implementation simply returns the allocation provided.
2013-03-17 11:28:26 -04:00
Sébastien Wilmet
66dfab0b0a Small API doc fixes
For gtk_text_iter_get_char(), due to the "Returns" at the beginning of
the description, the description was not visible. So the first sentence
has been reworded.
2013-03-16 22:18:50 +01:00
Matthias Clasen
5e1a06d1b1 GtkGrid: Tweak size allocation
If there are rows that contain only spanning children,
our algorithm was unnecessarily distributing extra space
to the other rows, even if they contain only non-expanding
children.

We improve the behaviour by treating rows containing only
spanning children as expanding.
2013-03-15 23:38:30 -04:00
Benjamin Otte
f9f6c4fa49 stylecontext: Do invalidation on first resize container
... instead of taking the last one we find. This is necessary as
attached widgets (mostly menus) can be attached to an invisible widget,
but we still want to invalidate styles for them.

https://bugzilla.gnome.org/show_bug.cgi?id=695772
2013-03-16 00:06:55 +01:00
Christian Persch
af0007d0d8 docs: Typo fix 2013-03-15 18:51:11 +01:00
Benjamin Otte
bda5987335 separator: Don't use padding and borders wrongly
Borders for size requests and padding for drawing? Really?

Removed them, as that is the least invasive fix shortly before a
release.
2013-03-15 18:18:40 +01:00
Matthias Clasen
a731cd1ef6 Minor doc cleanup
Remove widget references from interface docs.

https://bugzilla.gnome.org/show_bug.cgi?id=695874
2013-03-14 20:29:00 -04:00
Benjamin Otte
feb64f40b0 a11y: Emit text-changed signals directly
When setting new text on the label, the text-changed::delete signal
needs to be emitted before deleting the text (so that atk-bridge can
query the old text) while the text-changed::insert event needs to happen
afterwards (for the same reason). The old code using the notify signal
was only emitted after changing the text.
2013-03-15 00:58:29 +01:00
Bastien Nocera
ee44ed75ca GtkApplication: Allow passing windows on non-X11 targets
It's not the application's fault that we don't do anything
with the passed GtkWindow on non-X11, so don't try to get an XID
on non-X11.

https://bugzilla.gnome.org/show_bug.cgi?id=695783
2013-03-14 17:48:20 +01:00
Chun-wei Fan
b9e189150b gdk/gdkwindow.c, gtk/gtkwidget.c: Include fallback-c89.c
Both of them started to make use of round(), a C99 function.  So, include
fallback-c89.c to provide a fallback implementation for round() for
compilers that don't have round()

https://bugzilla.gnome.org/show_bug.cgi?id=694339
2013-03-13 13:22:48 +08:00
John Lindgren
5e2c232145 treeview: Don't emit cursor-changed in destruction
This is a workaround until we have a good idea on how we want to handle
signal disconnection before/during/after dispose and destroy vfunc
calls.

https://bugzilla.gnome.org/show_bug.cgi?id=671939
2013-03-13 02:06:29 +01:00
Matthias Clasen
0cc688aa92 Drop the Motif DND protocol
The implementation is not working and unused, since XDND is the
de-facto standard under X nowadays.

https://bugzilla.gnome.org/show_bug.cgi?id=695476
2013-03-12 20:03:19 -04:00
Federico Mena Quintero
563eb60666 filechooserbutton: Duh, remove all the timeouts after tests
Otherwise tests may start failing if they start after an old timeout triggers.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:48 -06:00
Federico Mena Quintero
d84f5ae17e filechooserbutton: Add a description string to assertions about emitted signals
On failed tests, this lets us more easily see see which assertion failed.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:48 -06:00
Federico Mena Quintero
aaedf5a352 filechooserbutton: Give proper names to the SELECT_FOLDER tests with cancelled dialog
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:48 -06:00
Federico Mena Quintero
79695ee64d filechooserbutton: Don't duplicate tests for GTK_RESPONSE_DELETE_EVENT
Instead, re-run tests made for GTK_RESPONSE_CANCEL with the delete-event response.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:48 -06:00
Federico Mena Quintero
3b2182e711 filechooserbutton: Do not propagate state from the dialog unless it is active
Change of plans to match the tests from the previous commit.

The state of the underlying dialog is never reflected by GtkFileChooserButton's API,
as the dialog is a transient thing.  The file chooser button only updates its state from the dialog,
and reflects the dialog's state, when the dialog has been confirmed and dismissed by the user.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:48 -06:00
Federico Mena Quintero
1865b9a111 filechooserbutton: whitespace fixes 2013-03-12 14:31:47 -06:00
Federico Mena Quintero
f5217289ca filechooserbutton: For the open-dialog-cancel-* tests, add a real nomenclature and test all the combinations
We used to have numeric names, which are a pain to maintain when new tests are added.
Now we have a real nomenclature (see the comment at the beginning of the open-dialog-cancel-* tests),
which lets us see easily if we have tested all the combinations.

Also, added all the combinations that were missing and removed redundant tests.
Not all the tests pass currently.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:47 -06:00
Federico Mena Quintero
2cfc56ced8 filechooserbutton: Update the button's state only on programmatic changes to the filechooser's state
The idea is that the button will only update its state of the selection and current folder
when changes to those are done either by the calling program (with the filechooser's API)
or when the user actually confirms and dismisses the underlying GtkFileChooserDialog.

If the user makes changes to the dialog but has not dismissed it yet, those changes
will not be reflected in the button (as one would expect).

This commit also makes sure the current-folder-changed and selection-changed signals
are emitted at the right times.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:47 -06:00
Federico Mena Quintero
fa4878979e filechooserbutton: Emit 'selection-changed' when changing the selection programmatically
We only emitted that signal when the selection changed through the underlying GtkFileChooserDialog.

To do this when the dialog is not active and the selection is changed by the calling program
(instead of by the user), we need to wait until the GtkFileChooserButton's UI has been updated
via an async callback from GIO.  So, we keep track of whether an entry point into the
button's API caused a programmatic change in the selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:47 -06:00
Federico Mena Quintero
a8c4d0935b filechooserbutton: For tests, wait for signals instead of just sleeping
This should let tests complete faster.  Also, this will let us test
that the correct signals are actually being emitted.

The tests now fail, as the signals are not being emitted when they
should.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-12 14:31:47 -06:00
Federico Mena Quintero
1247a842a2 filechooserbutton: whitespace fixes 2013-03-12 14:31:47 -06:00
Carl-Anton Ingmarsson
5d011386a6 label: Fix memleak
Caused by recent refactoring in e09957a47d
2013-03-12 20:23:09 +01:00
Benjamin Otte
fb170239c7 stylecontext: If we force invalidate, invalidate all properties
We only FORCE_INVALIDATE when something weird changes that the CSS
machinery can't detect. But now that our style_updated functions skip
recomputations when some properties don't change we want to make sure
these recomputations are still run. So we just claim all properties
changed.

http://bugzilla.gnome.org/show_bug.cgi?id=695482
2013-03-12 12:46:37 +01:00
Benjamin Otte
e09957a47d label: refactor code
If text didn't change, don't change it.

And if that sentence made no sense, that might explain why I refactored.
2013-03-12 12:46:37 +01:00
Aleksander Morgado
24fa277329 combobox: popdown the combobox when on 'grab-broken-event'
And also explicitly remove pointer/keyboard grabs from the display.

Whenever the grab is reported lost, we should popdown the combobox, so that the
GDK_WINDOW_TEMP window is hidden and removed from the toplevel, as done with
the menu for example.

Leaving the GDK_WINDOW_TEMP window open when re-activating the application
triggers several issues in the win32 backend, due to restacking windows of the
non-toplevel group into the toplevel group:

https://bugzilla.gnome.org/show_bug.cgi?id=695200
2013-03-12 07:23:17 -04:00
Federico Mena Quintero
1c796018d1 filechooserbutton: During unselect_all(), update the widgets in all situations
Not just if we thought we had a selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-11 18:16:29 -06:00
Federico Mena Quintero
3a86af43fa filechooserbutton: Add tests for unselect_all()
These all pass except one.
2013-03-11 18:16:29 -06:00
Federico Mena Quintero
f2d6def72e filechooserbutton: HACK: Set a reasonable size for the dialog in the tests' second iteration
Something is causing the GtkFileChooserDialog to be resized really small on the second time it is run
during each test for GtkFileChooserButton.  So as a temporary hack we set it to 500x500 pixels on
the second run, so the size allocation code doesn't bomb on us.
2013-03-11 18:16:29 -06:00
Federico Mena Quintero
cade42d509 gtkfilechooserbutton: In tests, allow the possibility of doing unselect_all 2013-03-11 18:16:29 -06:00
Federico Mena Quintero
45ad8a06ad filechooserbutton: When the combo box changes, set the *file*, not the current folder
The currently-selected file *is* the selection even in SELECT_FOLDER mode.  Do not confuse this
with the current folder.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-11 18:16:29 -06:00
Cosimo Cecchi
fd51c8f5e9 treeview: fix a critical warning
gtk_tree_view_column_unset_tree_view() resets column->priv->tree_view to
NULL.
The function is called when a column is removed, but later from the same
function we would call _gtk_tree_view_column_unrealize_button(), which
expects column->priv->tree_view to be != NULL, causing these critical
warnings

Gtk-CRITICAL **: gtk_widget_unregister_window: assertion
`GTK_IS_WIDGET (widget)' failed

This commit moves the call to unset the tree view after the button is
unrealized.

https://bugzilla.gnome.org/show_bug.cgi?id=695473
2013-03-08 20:20:28 -05:00
Matthias Clasen
1f8286004f Avoid a warning under Wayland
Just having an ifdef is not enough, we need to check the type
of the window at runtime.
2013-03-08 19:49:00 -05:00
Federico Mena Quintero
f076b6bb02 filechooserbutton: Update the combo box even after the dialog is cancelled
We assumed that we didn't have to update the combo box if the dialog got cancelled,
as it should simply retain its previous contents.  But this assumption doesn't work
as the dialog is brought up with the 'Other...' item - we don't want the
combo box to keep showing 'Other...' if the dialog is cancelled.

The test from the previous commit now passes.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 12:43:21 -06:00
Federico Mena Quintero
e4c2ef108c filechooserbutton: New test for opening the Other item in the combo box and then canceling the dialog
There is this bug:

1. Start with a file chooser button in SELECT_FOLDER mode, and select a folder from the combo box.

2. Click on the button's combo box, select 'Other...'

3. You get the file chooser dialog. Cancel the dialog.

4. The file chooser button's combo box still shows 'Other...' instead of
   showing the selection from (1).

This is a test to ensure that the original selection is restored.
The test fails right now.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 12:37:21 -06:00
Matthias Clasen
1ddfc3a985 Fix the build
This was broken in commit 5bbbc47a4c
2013-03-08 06:26:34 -05:00
Aleksander Morgado
5bbbc47a4c spinbutton: don't override initial text in non-numeric-only spin buttons
https://bugzilla.gnome.org/show_bug.cgi?id=695312
2013-03-08 11:23:11 +01:00
Federico Mena Quintero
67f5e595a7 filechooserbutton: Don't show the (None) item when the combo box is popped up
This is surprisingly tricky, since the (None) item *has* to be a visible item while
the combo box is *not* popped up, so that it can show its contents.  But the item
has to be *not* visible when the combo box is popped up.

Also, update the whole button's selection, not just the underlying dialog's, when
the combo box changes its selection - based on a patch by Paul Davis in
https://bugzilla.gnome.org/show_bug.cgi?id=691040#c20

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-07 20:45:58 -06:00
Federico Mena Quintero
1074aa0c49 filechooserbutton: In SELECT_FOLDER, when the selection is empty, show (None) in the combo box
We do this by adding a new row type, ROW_TYPE_EMPTY_SELECTION.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-07 20:45:58 -06:00
Federico Mena Quintero
bbf915118b filechooserbutton: Update the button/combo at construction time
This way the internal labels will show the correct selection even if nothing
has been selected programmatically.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-07 20:45:58 -06:00
Federico Mena Quintero
32aa7f0582 filechooserbutton: Update the button/combo whenever the selection is changed programmatically
We didn't change it when the file chooser button's dialog was inactive, and so
the actual file chooser button would not visually reflect the current selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-07 20:45:58 -06:00
Federico Mena Quintero
cc75ebec15 filechooserbutton: Test that the expected filename is shown
We do some gymnastics to pull the string out of the GtkButton or the GtkComboBox that is
being used in GtkFileChooserButton to show the current selection when the dialog
is inactive - namely, we look for the subwidget with the correct ATK role, and pull its
accessible name.

Currently the test fails; this is https://bugzilla.gnome.org/show_bug.cgi?id=691040#c18

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-07 20:45:58 -06:00
Federico Mena Quintero
8a17cad2e5 Don't mention gtk_set_locale() in docs; this function does not exist 2013-03-07 20:45:57 -06:00
Giovanni Campagna
ca2368dba9 GtkTextView: don't popdown a bubble if we don't have one
This causes a segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=695304
2013-03-06 17:08:48 +01:00
Bastien Nocera
ea043cab57 GtkEntry: Sanity check the end_pos value in _get_display_text() 2013-03-06 15:50:31 +01:00
Bastien Nocera
32825a66ac GtkLabelAccessible: Sanity check _get_text() input values 2013-03-06 15:50:30 +01:00
Federico Mena Quintero
a89d420270 filechooser: Use _gtk_file_has_native_path() throughout when testing for local_only
In the case of checking for local_only, g_file_is_native() is not useful, since it
will return FALSE for something in a FUSE mount.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-05 17:17:42 -06:00
Federico Mena Quintero
d484721b5c filechooser: Also convert get_uris() to returning native paths
It was only being done in gtk_file_chooser_get_uri().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-05 17:17:42 -06:00
Federico Mena Quintero
56bcb1933f filechooser: Rename _gtk_file_is_path_not_local() to _gtk_file_has_native_path()
Negatives in names of boolean functions are confusing.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-05 17:17:42 -06:00
Timothy Arceri
cf216d780c filechooser: Show FUSE mounted locations in shortcuts
Since FUSE locations can be handled safely by applications show these mounted locations regardless of whether gtk_file_chooser_set_local_only()
is set to TRUE

https://bugzilla.gnome.org/show_bug.cgi?id=586367
2013-03-05 17:17:42 -06:00
Cosimo Cecchi
e54f8f4c62 GtkBubbleWindow: use OSD style class 2013-03-05 16:48:02 -05:00
Cosimo Cecchi
3c8e1c92a8 GtkBubbleWindow: rework how drawing is done
Use gtk_render_frame_gap(), refactoring the code fetching coordinates to
be usable by it. This allows for rounded corners in the window shape.
2013-03-05 16:48:01 -05:00
Cosimo Cecchi
6f1476edd3 GtkBubbleWindow: allocate CSS borders and paddings 2013-03-05 16:48:01 -05:00
Matthias Clasen
e1edc998a2 Rename property to be more neutral
Don't put toolbar in the name of the property - we may use
a different container down the road, and then this name
would be misleading.
2013-03-05 16:48:01 -05:00
Matthias Clasen
3c04597306 Really keep GtkBubbleWindow private
_-prefix the symbols to keep them from leaking out.
Also, un-doc-commentize the sources.
2013-03-05 16:48:01 -05:00
Matthias Clasen
7c2a752b37 Small documentation tweak 2013-03-05 16:48:01 -05:00
Matthias Clasen
190dcfe050 Popdown the bubble window when text view is scrolled 2013-03-05 16:48:01 -05:00
Matthias Clasen
88623b98a7 Allow to populate bubbles with extra content
We do this by making the ::populate-popup signals a little more
flexible. They used to just accept a GtkMenu as argument, now
they can take a menu or a toolbar. To not break the expectations
of existing callbacks, we only emit ::populate-popup with a toolbar
if the :populate-toolbar property is TRUE.
2013-03-05 16:48:00 -05:00
Matthias Clasen
f1f3a033e5 Drop GtkSelectionWindow
It is no longer used.
2013-03-05 16:48:00 -05:00
Matthias Clasen
bb3c56abe2 Do without GtkSelectionWindow
Just populate a toolbar directly, in GtkEntry and GtkTextView.
2013-03-05 16:48:00 -05:00
Matthias Clasen
a8ea64dbb1 Fix a typo 2013-03-05 16:48:00 -05:00
Carlos Garnacho
ceeed09d07 Made GtkBubble/SelectionWindow private at the moment 2013-03-05 16:48:00 -05:00
Carlos Garnacho
0ba92bc26d Use gdk_threads_add_timeout to popup the selection window
Second granularity may bite us back there
2013-03-05 16:47:59 -05:00
Matthias Clasen
9f41970832 Fix includes
gtkbubblewindow.h was including gtk.h, which in turn included
gtkselectionwindow.h, leading to build failure.
2013-03-05 16:47:59 -05:00
Carlos Garnacho
51ecaa062d Don't allow individual #includes for GtkBubble/SelectionWindow 2013-03-05 16:47:59 -05:00
Carlos Garnacho
a960230a20 GtkBubbleWindow: Use style border color to stroke the bubble shape
This improves themeability a bit, corners are still square though...
2013-03-05 16:47:59 -05:00
Carlos Garnacho
320613c439 textview: Use GtkSelectionWindow for touch text selection
This enables touch devices to manipulate the text selection
2013-03-05 16:47:59 -05:00
Carlos Garnacho
6767541ead entry: Use GtkSelectionWindow for touch text selection
This enables touch devices to manipulate the text selection
2013-03-05 16:47:59 -05:00
Carlos Garnacho
7260e0570c Add GtkSelectionWindow
This is a helper object to provide context-dependent content
edition apt for touch devices.
2013-03-05 16:47:58 -05:00
Carlos Garnacho
51be6b88db Add GtkBubbleWindow
This popup window widget can be used for touch friendly context
menus that point to a concrete area.
2013-03-05 16:47:58 -05:00
Carlos Garnacho
a97178af65 texthandle: Set a bigger input shape, covering the line height
Now, even if the handles being rendered are small, the handle touch
input shape will be as wide as the visible part of the rendered asset, and
high enough to cover both the handle and the height of the line where
the selection bound is.

Also, make handles have the same virtual distance to the line top/bottom
when a drag starts, so the handle doesn't jump to another line after a
too short threshold.
2013-03-05 16:47:58 -05:00
Carlos Garnacho
17d3775555 Ensure the insertion handle stays on fake events (eg from IM)
Don't set handles mode to none if the event has send_event set.
For consistency with GtkEntry, also make GtkTextView keep the
handle mode on buffer changes.
2013-03-05 16:47:58 -05:00
Carlos Garnacho
d97861bd8b texthandles: Keep state internally to avoid X overhead
Handles now do sync X calls less often. As visibility state
is kept, it now can move+resize+show handles at once instead
of in separated steps.
2013-03-05 16:47:58 -05:00
Benjamin Otte
dc331ccb17 entrycompletion: Don't reconnect signals all the time
We block signal handlers areound GtkEntry signal emission and if those
signals get used to call functions on the completion that cause a
reconnection of the signals, then the reconnected signals will not be
blocked anymore (so they might get emitted?) and unblocking the old
signal id will later cause warnings.

Fixes spurious warnings in gtk/tests/filechooser tests.
2013-03-05 13:09:10 +01:00
Benjamin Otte
173317e9ce a11y: Emit active-descendants-changed when focus changes
This fixes the a11y/tree-relationships testcase.

The emission was lost in refactoring in commit
76670734f4
2013-03-05 11:56:56 +01:00
Alban Browaeys
aa08f4d8f5 bin: initialize out variables to zero for get_preferred_ functions.
Fixes case of child not visible then minimum_width/heigth natural_width
/heigth not initialized. Thus caller gets a random value.

https://bugzilla.gnome.org/show_bug.cgi?id=695131
2013-03-04 20:04:05 -05:00