Commit Graph

94 Commits

Author SHA1 Message Date
Matthias Clasen
df455db2e3 GtkBuilder: Make IDs optional
One requirement of .ui files is that each object must have an ID,
even if it is never referred to or directly loaded from the code.
This makes editing .ui files much more onerous than it has to be,
due to the frequent need to invent new IDs, while avoiding
clashes.

This commit makes IDs optional in the XML. They only need to
be provided for objects which are referred to or explictly loaded
from the code. Since GtkBuilder needs IDs for its own internal
accounting, we create IDs of the form ___object_N___ if not
specified in the XML.

https://bugzilla.gnome.org/show_bug.cgi?id=712553
2013-11-18 06:00:02 -05:00
Daniel Svensson
4d41903548 Use g_return_val_if_fail where return value needed.
https://bugzilla.gnome.org/show_bug.cgi?id=710987
2013-10-29 17:12:23 -04:00
Alexander Larsson
07eafbaaa8 GtkBuilder: Fall back to gtk_test_register_all_types if type lookup fails
This is important because the dlsym() approach can fail if gtk was
loaded with RTLD_LOCAL.

https://bugzilla.gnome.org/show_bug.cgi?id=710096
2013-10-15 21:41:35 -04:00
Ryan Lortie
3f0b9a7574 GtkBuilder: add GtkApplication
Add a GtkApplication (private) field to GtkBuilder
2013-10-15 09:24:11 -04:00
Ryan Lortie
3bb059b6e8 Mention of -rdynamic in GtkBuilder lookup error
We toss a g_warning() if we can't find the user's signal handler.  A good chunk
of the time this will be because they didn't use -rdynamic.  Add a note about
that.
2013-07-27 18:15:17 -04:00
Matthias Clasen
6f78424b5d Trivial typo fix 2013-07-26 08:48:38 -04:00
Matthias Clasen
0aa57d26b5 Move wholly deprecated classes to gtk/deprecated/
We've recently a number of classes wholly. For these cases,
move the headers and sources to gtk/deprecated/ and adjust
Makefiles and includes accordingly.

Affected classes:
GtkAction
GtkActionGroup
GtkActivatable
GtkIconFactory
GtkImageMenuItem
GtkRadioAction
GtkRecentAction
GtkStock
GtkToggleAction
GtkUIManager
2013-07-19 21:39:47 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
William Jon McCann
02c793f24a Start migrating internals away from GtkStock 2013-06-24 22:20:49 -04:00
Ryan Lortie
7554c15e7b GtkBuilder: add new constructor APIs
Add new APIs gtk_builder_new_from_{file,resource,string}() and encourage
their use over the older _add_from_...() APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=679930
2013-06-18 10:21:27 -04:00
Ryan Lortie
1bc7359123 docs: GtkBuilder: warn about unusual GError use
GtkBuilder returns GError for _add_from_{file,resource,string}(),
implying that the user should be able to recover from these errors.
Mention in the docs that it's unreasonable to try to do this.

https://bugzilla.gnome.org/show_bug.cgi?id=679930
2013-06-18 10:17:34 -04:00
Matthias Clasen
5707e81c81 GtkBuilder: don't leak callbacks
This was noticed while running the testsuite under valgrind.
2013-06-15 23:33:51 -04: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
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
ba1f2ae3fc Mention the de-facto standard filename extension
GtkBuilder files are commonly named .ui - mention that in the
docs.
https://bugzilla.gnome.org/show_bug.cgi?id=590325
2013-02-11 00:57:39 -05:00
Juan Pablo Ugarte
a3e4fa3809 Added new function gtk_builder_expose_object() based on the original work by
Marco Diego Aurélio Mesquita on bug #447972
2012-12-10 14:53:53 -03:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
4497ac6b58 Document the gtkbuilder xml file better
Replace the (invalid) DTD in the GtkBuilder docs by a
RELAX NG schema. Also install the schema in /usr/share/gtk-3.0,
so it can be used to validate GtkBuilder ui files.
2012-01-30 20:32:22 -05:00
Alexander Larsson
c72a76c754 Add resource support for GtkBuilder
There are new calls to load ui files from resources, and
you can now read pixbufs by using relative paths in a ui
file read from a resource, or by using absolute resource:/// uris.
2012-01-16 13:59:58 +01:00
Matthias Clasen
d2ed87fbdc Fix doc build 2012-01-07 21:47:42 -05:00
Ryan Lortie
d47c3ac9e4 GtkBuilder: support parsing GVariant properties
https://bugzilla.gnome.org/show_bug.cgi?id=667394
2012-01-06 16:18:48 -05:00
Matthias Clasen
06a75b7e1f Some more menu-related docs 2011-12-19 12:51:12 -05:00
Matthias Clasen
1ddaf01aed Quick-and-dirty GtkBuilder integration
This makes GtkBuilder accept a GMenuMarkup tree at the toplevel
(ie with <menu id='foo'> being a child of <interface>) and the resulting
GMenu object can be obtained via gtk_builder_get_object (builder, "foo").
2011-12-19 12:45:50 -05:00
Matthias Clasen
4460cac3ed Don't use g_value_set_char 2011-11-01 21:18:27 -04:00
Johan Dahlin
a47528fd59 Clarify that gtk_builder_connect_signals can only be connected once 2011-07-07 15:41:29 -03:00
Juan Pablo Ugarte
ea81c710d0 Make GtkBuilder do not delay construct properties that can be resolved
(so construct is respected when possible) and skip construct only props that
can not.
2011-06-29 11:45:33 -03:00
Juan Pablo Ugarte
f430a76f10 Fixed bug #576492 "GtkBuilder does not respect G_PARAM_CONSTRUCT properties"
Added G_PARAM_CONSTRUCT flag in gtk_builder_get_parameters() checks as suggested by Johan Dahlin.
2011-06-03 14:38:59 -03:00
Javier Jardón
3b2e710aa4 gtkbuilder.c: gtk_builder_value_from_string() also support GdkRGBA values 2011-05-02 15:43:45 +01:00
Tristan Van Berkom
031a092254 Added <mime-types> and <patterns> parsing support to GtkFileFilter. 2011-01-27 22:53:24 +09:00
Tristan Van Berkom
35e7e65bcb Added links to the GtkTextTagTable and GtkMenuToolButton GtkBuildable documentation from GtkBuilder documentation. 2011-01-27 16:04:46 +09:00
Tristan Van Berkom
93f825592e Added links to the GtkComboBox/GtkRecentFilter GtkBuildable documentation from GtkBuilder documentation. 2011-01-26 23:58:47 +09:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Paolo Borelli
f5d7a63aff Fix gtk_builder_add_objects_from_file g-i annotation
Use the same annotation already used for add_objects_from_string
2010-12-08 15:15:50 +01:00
Emmanuele Bassi
1779ae79a1 rgba: Invert the arguments and improve bindability
Since parse() is a method of the Gdk.RGBA class, the GdkRGBA pointer
should be the first argument, and the string the second one, to allow a
more natural binding.

https://bugzilla.gnome.org/show_bug.cgi?id=635879
2010-11-28 19:01:51 +00:00
=Christian Persch
d3f1745493 Use g_ascii_strto[u]ll instead of strto[u]l
We don't want GtkBuilder input to be locale-dependent.

Bug #632503
2010-10-25 12:22:20 -04:00
Carlos Garnacho
d2781bc74b GtkBuilder: Prepare for parsing GdkRGBA types. 2010-10-22 20:14:57 +02:00
Matthias Clasen
0219eea4d7 Remove GtkComboBoxEntry and the combo box text api 2010-10-20 11:02:03 +02:00
Matthias Clasen
f53ad33994 Remove GtkObject completely 2010-09-26 22:18:19 -04:00
Florian Müllner
93fd2b44c3 introspection: Fix typo in annotation 2010-09-24 18:26:34 +02:00
Tor Lillqvist
801875b805 Replace gtk_debug_flags with getter and setter functions
Preferrably should be made just into a local variable for libgtk like
_gdk_debug_flags for libgdk. But for now used by
gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.
2010-09-08 21:31:34 +03:00
John (J5) Palmieri
c78a23bdca add annotations for tranfer and scope so that methods are exported by GI 2010-09-07 13:50:40 -04:00
John (J5) Palmieri
eeaf576316 add array annotation to gtk_builder_add_objects_from_string 2010-09-07 12:06:29 -04:00
Benjamin Otte
a50843e160 gtkbuilder: Do not allocate colors when parsing GtkBuilder files 2010-08-10 21:02:30 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Tadej Borovšak
be3a1abc04 Move documentation to inline comments: GtkBuilder
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=611742

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-04-28 18:41:34 +02:00
Tristan Van Berkom
b9516e70f5 Add notes to GtkBuilder docs about the possible error domains, closed bgo #560147 2010-04-06 16:27:40 -04:00
Tristan Van Berkom
d92ee6dc68 Fixed gtk_builder_value_from_string_type() to always assign the GError
when returning FALSE, fixes bgo #615000.
2010-04-06 16:25:43 -04:00