Commit Graph

82 Commits

Author SHA1 Message Date
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
Florian Müllner
c4a3a7bdfd Add introspection annotation for gtk_builder_get_object 2010-02-25 21:33:15 +01:00
Johan Dahlin
fe85272112 [annotations] Add allow-none
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API

https://bugzilla.gnome.org/show_bug.cgi?id=610474
2010-02-19 17:57:51 -02:00
Colin Walters
6529c07614 [introspection] Merge in Gtk-custom.c annotations
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GTK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
2009-12-16 17:22:01 -02:00
Matthias Clasen
45894c9fad Fix a GtkBuilder crash
Always set an error when returning FALSE from gtk_builder_value_from_string.
This fixes the crash reported in bug 532858.
2009-04-06 20:55:26 -04:00
Paolo Borelli
6ee8be8899 Bug 447998 - GtkBuilder does not support building parts of the xml tree
2008-07-15  Paolo Borelli  <pborelli@katamail.com>

	Bug 447998 - GtkBuilder does not support building parts of the xml tree

	* gtk/gtkbuilder.c:
	* gtk/gtkbuilder.h:
	* gtk/gtkbuilderprivate.h:
	* gtk/gtkbuilderparser.c:
	* gtk/gtk.symbols:
	Add two new functions that allow cherry picking and construct
	objects from a ui description file or string.

	* gtk/tests/builder.c: tests for the above.


svn path=/trunk/; revision=20845
2008-07-16 15:36:53 +00:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Behdad Esfahbod
d76e3d552e Bug 503071 – Application direction changes to right to left even if
2008-06-11  Behdad Esfahbod  <behdad@gnome.org>

        Bug 503071 – Application direction changes to right to left even if
        theres no translation

        * configure.in: Bump glib requirement.

        * gtk/gtkaccellabel.c
        (_gtk_accel_label_class_get_accelerator_label):
        * gtk/gtkactiongroup.c (dgettext_swapped):
        * gtk/gtkbuilder.c (gtk_builder_class_init):
        * gtk/gtkbuilderparser.c (_dpgettext),
        (_gtk_builder_parser_translate):
        * gtk/gtkfilechooserdefault.c (list_size_data_func):
        * gtk/gtkimmulticontext.c (gtk_im_multicontext_append_menuitems):
        * gtk/gtkintl.h:
        * gtk/gtkmain.c (setlocale_initialization),
        (do_pre_parse_initialization), (gettext_initialization):
        * gtk/gtkstock.c (gtk_stock_lookup), (sgettext_swapped):
        Use g_dgettext() and g_dngettext().


svn path=/trunk/; revision=20358
2008-06-11 23:40:35 +00:00
Tristan Van Berkom
b1542fe913 Chain up in buildable_finish()
* gtk/gtkwindow.c: Chain up in buildable_finish()

	* gtk/gtkbuilder.c: _gtk_builder_get_absolute_filename() handle
	cases where g_path_get_dirname() returns "."

	* docs/reference/gtk/tmpl/gtklabel.sgml, 
	docs/reference/gtk/tmpl/gtkbuilder.sgml: Added documentation
	for the <attributes> tags on GtkLabel


svn path=/trunk/; revision=20008
2008-04-16 16:35:17 +00:00
Johan Dahlin
424cc287f1 - Treat enums like enums and not values - Avoid invalid free, in case of
2008-03-07  Johan Dahlin  <johan@gnome.org>

    * gtk/gtkbuilder.c:
    * gtk/gtkbuilderparser.c:
    * gtk/gtkbuilderprivate.h:
    * gtk/gtkiconfactory.c:
    * tests/buildertest.c:
    - Treat enums like enums and not values
    - Avoid invalid free, in case of more than two sources
    - Add better error messages
    - Add much improved tests
    (#520979, Christian Persch)


svn path=/trunk/; revision=19732
2008-03-07 20:03:35 +00:00
Johan Dahlin
61be2a7127 Implement GtkBuildable on GtkIconFactory, to make it possible to register
2008-03-06  Johan Dahlin  <jdahlin@async.com.br>

    * docs/reference/gtk/tmpl/gtkiconfactory.sgml:
    * gtk/gtkbuilder.c:
    * gtk/gtkbuilderprivate.h:
    * gtk/gtkiconfactory.c:
    * tests/buildertest.c:
    Implement GtkBuildable on GtkIconFactory, to make
    it possible to register custom stock icons.
    Fixes #517066


svn path=/trunk/; revision=19726
2008-03-07 00:08:16 +00:00