Commit Graph

18060 Commits

Author SHA1 Message Date
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