summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--docs/reference/gtk/tmpl/gtk-unused.sgml78
-rw-r--r--docs/reference/gtk/tmpl/gtkiconfactory.sgml44
-rw-r--r--docs/reference/gtk/tmpl/gtksignal.sgml219
-rw-r--r--docs/reference/gtk/tmpl/gtktypeutils.sgml20
-rw-r--r--gtk/gtkenums.h11
-rw-r--r--gtk/gtkiconfactory.c317
-rw-r--r--gtk/gtkiconfactory.h31
-rw-r--r--gtk/gtkimage.c27
-rw-r--r--gtk/gtkimage.h16
-rw-r--r--gtk/gtkrc.c14
-rw-r--r--gtk/gtkstyle.c16
-rw-r--r--gtk/gtkstyle.h4
-rw-r--r--gtk/gtkwidget.c4
-rw-r--r--gtk/gtkwidget.h2
21 files changed, 470 insertions, 389 deletions
diff --git a/ChangeLog b/ChangeLog
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 9274aaf686..2369ce3e76 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+2001-03-12 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkiconfactory.h, gtk/gtkiconfactory.c: Switch to using an
+ enum with registration for icon sizes, instead of strings.
+
+ * gtkimage.h, gtkimage.c, gtkstyle.h, gtkstyle.c, gtkwidget.h,
+ gtkwidget.c: Fix to reflect GtkIconSize
+
2001-03-12 Alexander Larsson <alexl@redhat.com>
Make GtkFB compile and link.
diff --git a/docs/reference/gtk/tmpl/gtk-unused.sgml b/docs/reference/gtk/tmpl/gtk-unused.sgml
index fb4d6b3765..a7061119f1 100644
--- a/docs/reference/gtk/tmpl/gtk-unused.sgml
+++ b/docs/reference/gtk/tmpl/gtk-unused.sgml
@@ -110,6 +110,36 @@ has the focus.
@clist: The #GtkCList widget to check.
+<!-- ##### MACRO GTK_ICON_SIZE_BUTTON ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GTK_ICON_SIZE_DIALOG ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GTK_ICON_SIZE_LARGE_TOOLBAR ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GTK_ICON_SIZE_MENU ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO GTK_ICON_SIZE_SMALL_TOOLBAR ##### -->
+<para>
+
+</para>
+
+
<!-- ##### MACRO GTK_OBJECT_CONSTRUCTED ##### -->
<para>
Test whether a GtkObject's arguments have been prepared.
@@ -395,6 +425,24 @@ The position of the cursor.
</para>
+<!-- ##### USER_FUNCTION GtkEmissionHook ##### -->
+<para>
+A simple function pointer to get invoked when the
+signal is emitted. This allows you tie a hook to the signal type,
+so that it will trap all emissions of that signal, from any object.
+</para>
+<para>
+You may not attach these to signals created with the
+#GTK_RUN_NO_HOOKS flag.
+</para>
+
+@object:
+@signal_id:
+@n_params:
+@params:
+@data:
+@Returns:
+
<!-- ##### ENUM GtkFontFilterType ##### -->
<para>
A set of bit flags used to specify the filter being set
@@ -970,6 +1018,20 @@ Internal function.
@ruler: the gtkruler
+<!-- ##### FUNCTION gtk_signal_add_emission_hook ##### -->
+<para>
+Add an emission hook for a type of signal, for any object.
+</para>
+
+@signal_id: the type of signal to hook for.
+@hook_func: the function to invoke to handle the emission hook.
+@data: the user data passed in to hook_func.
+@Returns: the id (that you may pass as a parameter
+to gtk_signal_remove_emission_hook()).
+@i:
+@h:
+@d:
+
<!-- ##### FUNCTION gtk_signal_add_emission_hook_full ##### -->
<para>
Add an emission hook for a type of signal, for any object.
@@ -1009,6 +1071,12 @@ This function is labeled private.
@object: the object whose signal handlers should be destroyed.
+<!-- ##### FUNCTION gtk_signal_init ##### -->
+<para>
+
+</para>
+
+
<!-- ##### FUNCTION gtk_signal_n_emissions ##### -->
<para>
Find out the recursion depth of emissions for a particular type
@@ -1050,6 +1118,16 @@ Obtain information about a signal.
which contains all the information, or NULL.
The pointer is allocated just for you: you must g_free() it.
+<!-- ##### FUNCTION gtk_signal_remove_emission_hook ##### -->
+<para>
+Delete an emission hook. (see gtk_signal_add_emission_hook())
+</para>
+
+@signal_id: the id of the signal type.
+@hook_id: the id of the emission handler, returned by add_emission_hook().
+@i:
+@h:
+
<!-- ##### FUNCTION gtk_signal_set_funcs ##### -->
<para>
These set default functions to call when the user didn't
diff --git a/docs/reference/gtk/tmpl/gtkiconfactory.sgml b/docs/reference/gtk/tmpl/gtkiconfactory.sgml
index d617f266bb..07f48c092a 100644
--- a/docs/reference/gtk/tmpl/gtkiconfactory.sgml
+++ b/docs/reference/gtk/tmpl/gtkiconfactory.sgml
@@ -188,50 +188,17 @@ looking up the icon to use for a given stock ID.
@icon_set:
-<!-- ##### MACRO GTK_ICON_SIZE_MENU ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO GTK_ICON_SIZE_BUTTON ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO GTK_ICON_SIZE_SMALL_TOOLBAR ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO GTK_ICON_SIZE_LARGE_TOOLBAR ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO GTK_ICON_SIZE_DIALOG ##### -->
-<para>
-
-</para>
-
-
-
<!-- ##### FUNCTION gtk_icon_size_lookup ##### -->
<para>
</para>
-@alias:
+@size:
@width:
@height:
@Returns:
+<!-- # Unused Parameters # -->
+@alias:
<!-- ##### FUNCTION gtk_icon_size_register ##### -->
@@ -239,9 +206,12 @@ looking up the icon to use for a given stock ID.
</para>
-@alias:
+@name:
@width:
@height:
+@Returns:
+<!-- # Unused Parameters # -->
+@alias:
<!-- ##### FUNCTION gtk_icon_size_register_alias ##### -->
diff --git a/docs/reference/gtk/tmpl/gtksignal.sgml b/docs/reference/gtk/tmpl/gtksignal.sgml
index 11705206fd..1bb805c8ba 100644
--- a/docs/reference/gtk/tmpl/gtksignal.sgml
+++ b/docs/reference/gtk/tmpl/gtksignal.sgml
@@ -157,25 +157,6 @@ you might have to write a marshaller.
@field:
-<!-- ##### USER_FUNCTION GtkEmissionHook ##### -->
-<para>
-A simple function pointer to get invoked when the
-signal is emitted. This allows you tie a hook to the signal type,
-so that it will trap all emissions of that signal, from any object.
-</para>
-<para>
-You may not attach these to signals created with the
-#GTK_RUN_NO_HOOKS flag.
-</para>
-
-@object:
-@signal_id:
-@n_params:
-@params:
-@data:
-@Returns:
-
-
<!-- ##### ENUM GtkSignalRunType ##### -->
<para>
These configure the signal's emission. They control
@@ -251,13 +232,6 @@ to the signal.
@GTK_RUN_ACTION:
@GTK_RUN_NO_HOOKS:
-<!-- ##### FUNCTION gtk_signal_init ##### -->
-<para>
-
-</para>
-
-
-
<!-- ##### FUNCTION gtk_signal_new ##### -->
<para>
Create a new signal type. (This is usually done in the
@@ -315,7 +289,7 @@ you don't want a return value.
the callbacks.
-<!-- ##### FUNCTION gtk_signal_lookup ##### -->
+<!-- ##### MACRO gtk_signal_lookup ##### -->
<para>
Given the name of the signal and the type of object it connects
to, get the signal's identifying integer. Emitting the signal
@@ -325,12 +299,13 @@ by number is somewhat faster than using the name each time.
It also tries the ancestors of the given type.
</para>
+@Returns: the signal's identifying number, or 0 if no signal was found.
+<!-- # Unused Parameters # -->
@name: the signal's name, e.g. clicked.
@object_type: the type that the signal operates on, e.g. #GTK_TYPE_BUTTON.
-@Returns: the signal's identifying number, or 0 if no signal was found.
-<!-- ##### FUNCTION gtk_signal_name ##### -->
+<!-- ##### MACRO gtk_signal_name ##### -->
<para>
Given the signal's identifier, find its name.
</para>
@@ -338,8 +313,9 @@ Given the signal's identifier, find its name.
Two different signals may have the same name, if they have differing types.
</para>
-@signal_id: the signal's identifying number.
@Returns: the signal name, or NULL if the signal number was invalid.
+<!-- # Unused Parameters # -->
+@signal_id: the signal's identifying number.
<!-- ##### FUNCTION gtk_signal_emit ##### -->
@@ -407,7 +383,7 @@ an array of GtkArgs instead of using C's varargs mechanism.
followed by one which is a pointer to the return type.
-<!-- ##### FUNCTION gtk_signal_emit_stop ##### -->
+<!-- ##### MACRO gtk_signal_emit_stop ##### -->
<para>
This function aborts a signal's current emission.
</para>
@@ -421,11 +397,11 @@ It will print a warning if used on a signal which
isn't being emitted.
</para>
-@object: the object whose signal handlers you wish to stop.
-@signal_id: the signal identifier, as returned by gtk_signal_lookup().
-<!-- # Unused Parameters # -->
@i:
@s:
+<!-- # Unused Parameters # -->
+@object: the object whose signal handlers you wish to stop.
+@signal_id: the signal identifier, as returned by gtk_signal_lookup().
<!-- ##### FUNCTION gtk_signal_emit_stop_by_name ##### -->
@@ -441,7 +417,7 @@ except it will lookup the signal id for you.
@name: the name of the signal you wish to stop.
-<!-- ##### FUNCTION gtk_signal_connect ##### -->
+<!-- ##### MACRO gtk_signal_connect ##### -->
<para>
Attach a function pointer and user data to a signal for
a particular object.
@@ -480,38 +456,38 @@ static void attach_print_signal(GtkButton* button, gint to_print)
</programlisting>
</informalexample>
+@o:
+@s:
+@f:
+@d:
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
@object: the object associated with the signal, e.g. if a button
is getting pressed, this is that button.
@name: name of the signal.
@func: function pointer to attach to the signal.
@func_data: value to pass as to your function (through the marshaller).
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
-@o:
-@s:
-@f:
-@d:
-<!-- ##### FUNCTION gtk_signal_connect_after ##### -->
+<!-- ##### MACRO gtk_signal_connect_after ##### -->
<para>
Attach a function pointer and user data to a signal
so that this handler will be called after the other handlers.
</para>
-@object: the object associated with the signal.
-@name: name of the signal.
-@func: function pointer to attach to the signal.
-@func_data: value to pass as to your function (through the marshaller).
-@Returns: the unique identifier for this attachment: the connection id.
-<!-- # Unused Parameters # -->
@o:
@s:
@f:
@d:
+@Returns: the unique identifier for this attachment: the connection id.
+<!-- # Unused Parameters # -->
+@object: the object associated with the signal.
+@name: name of the signal.
+@func: function pointer to attach to the signal.
+@func_data: value to pass as to your function (through the marshaller).
-<!-- ##### FUNCTION gtk_signal_connect_object ##### -->
+<!-- ##### MACRO gtk_signal_connect_object ##### -->
<para>
This function is for registering a callback that will
call another object's callback. That is,
@@ -532,21 +508,21 @@ gtk_signal_connect_object(button, "clicked", gtk_widget_show, window);
</programlisting>
</informalexample>
+@o:
+@s:
+@f:
+@d:
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
@object: the object which emits the signal.
@name: the name of the signal.
@func: the function to callback.
@slot_object: the object to pass as the first parameter to func.
(Though it pretends to take an object, you can
really pass any gpointer as the #slot_object .)
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
-@o:
-@s:
-@f:
-@d:
-<!-- ##### FUNCTION gtk_signal_connect_object_after ##### -->
+<!-- ##### MACRO gtk_signal_connect_object_after ##### -->
<para>
Attach a signal hook to a signal, passing in an alternate
object as the first parameter, and guaranteeing
@@ -554,16 +530,16 @@ that the default handler and all normal
handlers are called first.
</para>
-@object: the object associated with the signal.
-@name: name of the signal.
-@func: function pointer to attach to the signal.
-@slot_object: the object to pass as the first parameter to #func.
-@Returns: the connection id.
-<!-- # Unused Parameters # -->
@o:
@s:
@f:
@d:
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
+@object: the object associated with the signal.
+@name: name of the signal.
+@func: function pointer to attach to the signal.
+@slot_object: the object to pass as the first parameter to #func.
<!-- ##### FUNCTION gtk_signal_connect_full ##### -->
@@ -652,95 +628,98 @@ should signal the removal of this signal.
@name: name of the signal.
-<!-- ##### FUNCTION gtk_signal_disconnect ##### -->
+<!-- ##### MACRO gtk_signal_disconnect ##### -->
<para>
Destroy a user-defined handler connection.
</para>
+<!-- # Unused Parameters # -->
@object: the object which the handler pertains to.
@handler_id: the connection id.
-<!-- ##### FUNCTION gtk_signal_disconnect_by_func ##### -->
+<!-- ##### MACRO gtk_signal_disconnect_by_func ##### -->
<para>
Destroy all connections for a particular object, with
the given function-pointer and user-data.
</para>
-@object: the object which emits the signal.
-@func: the function pointer to search for.
-@data: the user data to search for.
-<!-- # Unused Parameters # -->
@o:
@f:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal.
+@func: the function pointer to search for.
+@data: the user data to search for.
-<!-- ##### FUNCTION gtk_signal_disconnect_by_data ##### -->
+<!-- ##### MACRO gtk_signal_disconnect_by_data ##### -->
<para>
Destroy all connections for a particular object, with
the given user-data.
</para>
-@object: the object which emits the signal.
-@data: the user data to search for.
-<!-- # Unused Parameters # -->
@o:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal.
+@data: the user data to search for.
-<!-- ##### FUNCTION gtk_signal_handler_block ##### -->
+<!-- ##### MACRO gtk_signal_handler_block ##### -->
<para>
Prevent an user-defined handler from being invoked. All other
signal processing will go on as normal, but this particular
handler will ignore it.
</para>
+<!-- # Unused Parameters # -->
@object: the object which emits the signal to block.
@handler_id: the connection id.
-<!-- ##### FUNCTION gtk_signal_handler_block_by_func ##### -->
+<!-- ##### MACRO gtk_signal_handler_block_by_func ##### -->
<para>
Prevent a user-defined handler from being invoked, by reference to
the user-defined handler's function pointer and user data. (It may result in
multiple hooks being blocked, if you've called connect multiple times.)
</para>
-@object: the object which emits the signal to block.
-@func: the function pointer of the handler to block.
-@data: the user data of the handler to block.
-<!-- # Unused Parameters # -->
@o:
@f:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal to block.
+@func: the function pointer of the handler to block.
+@data: the user data of the handler to block.
-<!-- ##### FUNCTION gtk_signal_handler_block_by_data ##### -->
+<!-- ##### MACRO gtk_signal_handler_block_by_data ##### -->
<para>
Prevent all user-defined handlers with a certain user data from being invoked.
</para>
-@object: the object which emits the signal we want to block.
-@data: the user data of the handlers to block.
-<!-- # Unused Parameters # -->
@o:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal we want to block.
+@data: the user data of the handlers to block.
-<!-- ##### FUNCTION gtk_signal_handler_unblock ##### -->
+<!-- ##### MACRO gtk_signal_handler_unblock ##### -->
<para>
Undo a block, by connection id. Note that undoing a block doesn't
necessarily make the hook callable, because if you block a
hook twice, you must unblock it twice.
</para>
+<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock.
@handler_id: the emission handler identifier, as returned by
gtk_signal_connect(), etc.
-<!-- ##### FUNCTION gtk_signal_handler_unblock_by_func ##### -->
+<!-- ##### MACRO gtk_signal_handler_unblock_by_func ##### -->
<para>
Undo a block, by function pointer and data.
Note that undoing a block doesn't
@@ -748,29 +727,29 @@ necessarily make the hook callable, because if you block a
hook twice, you must unblock it twice.
</para>
-@object: the object which emits the signal we want to unblock.
-@func: the function pointer to search for.
-@data: the user data to search for.
-<!-- # Unused Parameters # -->
@o:
@f:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal we want to unblock.
+@func: the function pointer to search for.
+@data: the user data to search for.
-<!-- ##### FUNCTION gtk_signal_handler_unblock_by_data ##### -->
+<!-- ##### MACRO gtk_signal_handler_unblock_by_data ##### -->
<para>
Undo block(s), to all signals for a particular object
with a particular user-data pointer
</para>
-@object: the object which emits the signal we want to unblock.
-@data: the user data to search for.
-<!-- # Unused Parameters # -->
@o:
@d:
+<!-- # Unused Parameters # -->
+@object: the object which emits the signal we want to unblock.
+@data: the user data to search for.
-<!-- ##### FUNCTION gtk_signal_handler_pending ##### -->
+<!-- ##### MACRO gtk_signal_handler_pending ##### -->
<para>
Returns a connection id corresponding to a given signal id and object.
</para>
@@ -781,64 +760,36 @@ may opt to not emit the signal if no one is attached anyway,
thus saving the cost of building the arguments.
</para>
+@i:
+@s:
+@b:
+@Returns: the connection id, if a connection was found. 0 otherwise.
+<!-- # Unused Parameters # -->
@object: the object to search for the desired user-defined handler.
@signal_id: the number of the signal to search for.
@may_be_blocked: whether it is acceptable to return a blocked
handler.
-@Returns: the connection id, if a connection was found. 0 otherwise.
-<!-- # Unused Parameters # -->
-@i:
-@s:
-@b:
-<!-- ##### FUNCTION gtk_signal_handler_pending_by_func ##### -->
+<!-- ##### MACRO gtk_signal_handler_pending_by_func ##### -->
<para>
Returns a connection id corresponding to a given signal id, object, function
pointer and user data.
</para>
-@object: the object to search for the desired handler.
-@signal_id: the number of the signal to search for.
-@may_be_blocked: whether it is acceptable to return a blocked
-handler.
-@func: the function pointer to search for.
-@data: the user data to search for.
-@Returns: the connection id, if a handler was found. 0 otherwise.
-<!-- # Unused Parameters # -->
@o:
@s:
@b:
@f:
@d:
-
-
-<!-- ##### FUNCTION gtk_signal_add_emission_hook ##### -->
-<para>
-Add an emission hook for a type of signal, for any object.
-</para>
-
-@signal_id: the type of signal to hook for.
-@hook_func: the function to invoke to handle the emission hook.
-@data: the user data passed in to hook_func.
-@Returns: the id (that you may pass as a parameter
-to gtk_signal_remove_emission_hook()).
-<!-- # Unused Parameters # -->
-@i:
-@h:
-@d:
-
-
-<!-- ##### FUNCTION gtk_signal_remove_emission_hook ##### -->
-<para>
-Delete an emission hook. (see gtk_signal_add_emission_hook())
-</para>
-
-@signal_id: the id of the signal type.
-@hook_id: the id of the emission handler, returned by add_emission_hook().
+@Returns: the connection id, if a handler was found. 0 otherwise.
<!-- # Unused Parameters # -->
-@i:
-@h:
+@object: the object to search for the desired handler.
+@signal_id: the number of the signal to search for.
+@may_be_blocked: whether it is acceptable to return a blocked
+handler.
+@func: the function pointer to search for.
+@data: the user data to search for.
<!-- ##### MACRO gtk_signal_default_marshaller ##### -->
diff --git a/docs/reference/gtk/tmpl/gtktypeutils.sgml b/docs/reference/gtk/tmpl/gtktypeutils.sgml
index 6295e2dfa1..16a7e543fe 100644
--- a/docs/reference/gtk/tmpl/gtktypeutils.sgml
+++ b/docs/reference/gtk/tmpl/gtktypeutils.sgml
@@ -560,30 +560,33 @@ Create a new, unique type.
@type_info: must not be null, and @type_info->type_name must also not be null.
-<!-- ##### FUNCTION gtk_type_name ##### -->
+<!-- ##### MACRO gtk_type_name ##### -->
<para>
</para>
-@type: a GtkType
@Returns: a pointer to the name of a type, or NULL if it has none.
+<!-- # Unused Parameters # -->
+@type: a GtkType
-<!-- ##### FUNCTION gtk_type_from_name ##### -->
+<!-- ##### MACRO gtk_type_from_name ##### -->
<para>
Get the internal representation of a type given its name.
</para>
-@name: the name of a gtk type
@Returns: a GtkType
+<!-- # Unused Parameters # -->
+@name: the name of a gtk type
-<!-- ##### FUNCTION gtk_type_parent ##### -->
+<!-- ##### MACRO gtk_type_parent ##### -->
<para>
</para>
-@type: a GtkType
@Returns: the GtkType of the parent
+<!-- # Unused Parameters # -->
+@type: a GtkType
<!-- ##### FUNCTION gtk_type_class ##### -->
@@ -608,15 +611,16 @@ has all the proper initializers called.
@Returns: gpointer to a GtkTypeObject
-<!-- ##### FUNCTION gtk_type_is_a ##### -->
+<!-- ##### MACRO gtk_type_is_a ##### -->
<para>
Look in the type hierarchy to see if @type has @is_a_type among its
ancestors. Do so with a simple lookup, not a loop.
</para>
+@Returns:
+<!-- # Unused Parameters # -->
@type: GtkType
@is_a_type: GtkType
-@Returns:
<!-- ##### FUNCTION gtk_type_enum_get_values ##### -->
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index b489b0744d..d9ee74bb20 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -92,6 +92,17 @@ typedef enum
GTK_DIR_RIGHT
} GtkDirectionType;
+/* Built-in stock icon sizes */
+typedef enum
+{
+ GTK_ICON_SIZE_INVALID,
+ GTK_ICON_SIZE_MENU,
+ GTK_ICON_SIZE_SMALL_TOOLBAR,
+ GTK_ICON_SIZE_LARGE_TOOLBAR,
+ GTK_ICON_SIZE_BUTTON,
+ GTK_ICON_SIZE_DIALOG
+} GtkIconSize;
+
/* Reading directions for text */
typedef enum
{
diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c
index 4217869f8a..b0675183cd 100644
--- a/gtk/gtkiconfactory.c
+++ b/gtk/gtkiconfactory.c
@@ -291,14 +291,14 @@ gtk_icon_factory_lookup_default (const gchar *stock_id)
static GtkIconSet *
sized_icon_set_from_inline (const guchar *inline_data,
- const gchar *size)
+ GtkIconSize size)
{
GtkIconSet *set;
- GtkIconSource source = { NULL, NULL, 0, 0, NULL,
+ GtkIconSource source = { NULL, NULL, 0, 0, 0,
TRUE, TRUE, FALSE };
- source.size = (gchar*) size;
+ source.size = size;
set = gtk_icon_set_new ();
@@ -338,7 +338,7 @@ unsized_icon_set_from_inline (const guchar *inline_data)
static void
add_sized (GtkIconFactory *factory,
const guchar *inline_data,
- const gchar *size,
+ GtkIconSize size,
const gchar *stock_id)
{
GtkIconSet *set;
@@ -393,214 +393,232 @@ get_default_icons (GtkIconFactory *factory)
/* Sizes */
-static GHashTable *icon_sizes = NULL;
-
typedef struct _IconSize IconSize;
struct _IconSize
{
+ gint size;
gchar *name;
- gboolean is_alias;
-
- union
- {
- gchar *target;
- struct
- {
- gint width;
- gint height;
- } size;
- } d;
+ gint width;
+ gint height;
};
-static IconSize*
-icon_size_new (const gchar *name)
-{
- IconSize *is;
-
- is = g_new0 (IconSize, 1);
+typedef struct _IconAlias IconAlias;
- is->name = g_strdup (name);
-
- return is;
-}
-
-static void
-icon_size_free (IconSize *is)
+struct _IconAlias
{
- g_free (is->name);
-
- if (is->is_alias)
- g_free (is->d.target);
+ gchar *name;
+ gint target;
+};
- g_free (is);
-}
+static GHashTable *icon_aliases = NULL;
+static IconSize *icon_sizes = NULL;
+static gint icon_sizes_allocated = 0;
+static gint icon_sizes_used = 0;
static void
-icon_size_insert (IconSize *is)
-{
- gpointer old_key, old_value;
-
- /* Remove old ones */
- if (g_hash_table_lookup_extended (icon_sizes,
- is->name,
- &old_key, &old_value))
- {
- g_hash_table_remove (icon_sizes, is->name);
- icon_size_free (old_value);
- }
-
- g_hash_table_insert (icon_sizes,
- is->name, is);
-
-}
-
-static IconSize*
-icon_size_lookup (const gchar *name)
+init_icon_sizes (void)
{
- IconSize *is;
-
- is = g_hash_table_lookup (icon_sizes,
- name);
-
- while (is && is->is_alias)
+ if (icon_sizes == NULL)
{
- is = g_hash_table_lookup (icon_sizes,
- is->d.target);
-
- }
+#define NUM_BUILTIN_SIZES 6
+ gint i;
- return is;
-}
-
-static void
-icon_size_add (const gchar *name,
- gint width,
- gint height)
-{
- IconSize *is;
-
- is = icon_size_new (name);
- is->d.size.width = width;
- is->d.size.height = height;
-
- icon_size_insert (is);
-}
-
-static void
-icon_alias_add (const gchar *name,
- const gchar *target)
-{
- IconSize *is;
-
- is = icon_size_new (name);
- is->is_alias = TRUE;
-
- is->d.target = g_strdup (target);
+ icon_aliases = g_hash_table_new (g_str_hash, g_str_equal);
+
+ icon_sizes = g_new (IconSize, NUM_BUILTIN_SIZES);
+ icon_sizes_allocated = NUM_BUILTIN_SIZES;
+ icon_sizes_used = NUM_BUILTIN_SIZES;
+
+ icon_sizes[GTK_ICON_SIZE_INVALID].size = 0;
+ icon_sizes[GTK_ICON_SIZE_INVALID].name = NULL;
+ icon_sizes[GTK_ICON_SIZE_INVALID].width = 0;
+ icon_sizes[GTK_ICON_SIZE_INVALID].height = 0;
+
+ /* the name strings aren't copied since we don't ever remove
+ * icon sizes, so we don't need to know whether they're static.
+ * Even if we did I suppose removing the builtin sizes would be
+ * disallowed.
+ */
+
+ icon_sizes[GTK_ICON_SIZE_MENU].size = GTK_ICON_SIZE_MENU;
+ icon_sizes[GTK_ICON_SIZE_MENU].name = "gtk-menu";
+ icon_sizes[GTK_ICON_SIZE_MENU].width = 16;
+ icon_sizes[GTK_ICON_SIZE_MENU].height = 16;
+
+ icon_sizes[GTK_ICON_SIZE_BUTTON].size = GTK_ICON_SIZE_BUTTON;
+ icon_sizes[GTK_ICON_SIZE_BUTTON].name = "gtk-button";
+ icon_sizes[GTK_ICON_SIZE_BUTTON].width = 24;
+ icon_sizes[GTK_ICON_SIZE_BUTTON].height = 24;
+
+ icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].size = GTK_ICON_SIZE_SMALL_TOOLBAR;
+ icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].name = "gtk-small-toolbar";
+ icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = 18;
+ icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = 18;
+
+ icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+ icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].name = "gtk-large-toolbar";
+ icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = 24;
+ icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].height = 24;
- icon_size_insert (is);
-}
+ icon_sizes[GTK_ICON_SIZE_DIALOG].size = GTK_ICON_SIZE_DIALOG;
+ icon_sizes[GTK_ICON_SIZE_DIALOG].name = "gtk-dialog";
+ icon_sizes[GTK_ICON_SIZE_DIALOG].width = 48;
+ icon_sizes[GTK_ICON_SIZE_DIALOG].height = 48;
-static void
-init_icon_sizes (void)
-{
- if (icon_sizes == NULL)
- {
- icon_sizes = g_hash_table_new (g_str_hash, g_str_equal);
+ g_assert ((GTK_ICON_SIZE_DIALOG + 1) == NUM_BUILTIN_SIZES);
- icon_size_add (GTK_ICON_SIZE_MENU, 16, 16);
- icon_size_add (GTK_ICON_SIZE_BUTTON, 24, 24);
- icon_size_add (GTK_ICON_SIZE_SMALL_TOOLBAR, 18, 18);
- icon_size_add (GTK_ICON_SIZE_LARGE_TOOLBAR, 24, 24);
- icon_size_add (GTK_ICON_SIZE_DIALOG, 48, 48);
+ /* Alias everything to itself. */
+ i = 1; /* skip invalid size */
+ while (i < NUM_BUILTIN_SIZES)
+ {
+ gtk_icon_size_register_alias (icon_sizes[i].name, icon_sizes[i].size);
+
+ ++i;
+ }
+
+#undef NUM_BUILTIN_SIZES
}
}
/**
* gtk_icon_size_lookup:
- * @alias: name of an icon size
+ * @size: an icon size
* @width: location to store icon width
* @height: location to store icon height
*
- * Obtains the pixel size of an icon, normally @alias would be
+ * Obtains the pixel size of a semantic icon size, normally @size would be
* #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function
* isn't normally needed, gtk_widget_render_icon() is the usual
* way to get an icon for rendering, then just look at the size of
* the rendered pixbuf. The rendered pixbuf may not even correspond to
* the width/height returned by gtk_icon_size_lookup(), because themes
- * are free to render the pixbuf however they like.
+ * are free to render the pixbuf however they like, including changing
+ * the usual size.
*
- * Return value: %TRUE if @alias was known.
+ * Return value: %TRUE if @size was a valid size
**/
gboolean
-gtk_icon_size_lookup (const gchar *alias,
+gtk_icon_size_lookup (GtkIconSize size,
gint *widthp,
gint *heightp)
{
- IconSize *is;
-
- g_return_val_if_fail (alias != NULL, FALSE);
-
init_icon_sizes ();
-
- is = icon_size_lookup (alias);
- if (is == NULL)
+ if (size >= icon_sizes_used)
return FALSE;
+ if (size == GTK_ICON_SIZE_INVALID)
+ return FALSE;
+
if (widthp)
- *widthp = is->d.size.width;
+ *widthp = icon_sizes[size].width;
if (heightp)
- *heightp = is->d.size.height;
+ *heightp = icon_sizes[size].height;
return TRUE;
}
/**
* gtk_icon_size_register:
- * @alias: name of the icon size
+ * @name: name of the icon size
* @width: the icon width
* @height: the icon height
*
* Registers a new icon size, along the same lines as #GTK_ICON_SIZE_MENU,
- * etc.
+ * etc. Returns the integer value for the size.
+ *
+ * Returns: integer value representing the size
*
**/
-void
-gtk_icon_size_register (const gchar *alias,
+GtkIconSize
+gtk_icon_size_register (const gchar *name,
gint width,
gint height)
{
- g_return_if_fail (alias != NULL);
- g_return_if_fail (width > 0);
- g_return_if_fail (height > 0);
+ g_return_val_if_fail (name != NULL, 0);
+ g_return_val_if_fail (width > 0, 0);
+ g_return_val_if_fail (height > 0, 0);
init_icon_sizes ();
- icon_size_add (alias, width, height);
+ if (icon_sizes_used == icon_sizes_allocated)
+ {
+ icon_sizes_allocated *= 2;
+ icon_sizes = g_renew (IconSize, icon_sizes, icon_sizes_allocated);
+ }
+
+ icon_sizes[icon_sizes_used].size = icon_sizes_used;
+ icon_sizes[icon_sizes_used].name = g_strdup (name);
+ icon_sizes[icon_sizes_used].width = width;
+ icon_sizes[icon_sizes_used].height = height;
+
+ /* alias to self. */
+ gtk_icon_size_register_alias (icon_sizes[icon_sizes_used].name,
+ icon_sizes[icon_sizes_used].size);
+
+ ++icon_sizes_used;
+
+ return icon_sizes_used - 1;
}
/**
* gtk_icon_size_register_alias:
* @alias: an alias for @target
- * @target: an existing icon size name
+ * @target: an existing icon size
+ *
+ * Registers @alias as another name for @target.
+ * So calling gtk_icon_size_from_name() with @alias as argument
+ * will return @target.
*
- * Registers @alias as another name for @target, usable when calling
- * gtk_icon_size_lookup().
- *
**/
void
gtk_icon_size_register_alias (const gchar *alias,
- const gchar *target)
+ GtkIconSize target)
{
+ IconAlias *ia;
+
g_return_if_fail (alias != NULL);
- g_return_if_fail (target != NULL);
init_icon_sizes ();
- icon_alias_add (alias, target);
+ if (g_hash_table_lookup (icon_aliases, alias))
+ g_warning ("gtk_icon_size_register_alias: Icon size name '%s' already exists", alias);
+
+ if (!gtk_icon_size_lookup (target, NULL, NULL))
+ g_warning ("gtk_icon_size_register_alias: Icon size %d does not exist", target);
+
+ ia = g_new (IconAlias, 1);
+ ia->name = g_strdup (alias);
+ ia->target = target;
+
+ g_hash_table_insert (icon_aliases, ia->name, ia);
+}
+
+GtkIconSize
+gtk_icon_size_from_name (const gchar *name)
+{
+ IconAlias *ia;
+
+ init_icon_sizes ();
+
+ ia = g_hash_table_lookup (icon_aliases, name);
+
+ if (ia)
+ return ia->target;
+ else
+ return GTK_ICON_SIZE_INVALID;
+}
+
+G_CONST_RETURN gchar*
+gtk_icon_size_get_name (GtkIconSize size)
+{
+ if (size >= icon_sizes_used)
+ return NULL;
+ else
+ return icon_sizes[size].name;
}
/* Icon Set */
@@ -614,12 +632,12 @@ static GdkPixbuf *find_in_cache (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size);
+ GtkIconSize size);
static void add_to_cache (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GdkPixbuf *pixbuf);
static void clear_cache (GtkIconSet *icon_set,
gboolean style_detach);
@@ -691,7 +709,7 @@ gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf)
{
GtkIconSet *set;
- GtkIconSource source = { NULL, NULL, 0, 0, NULL,
+ GtkIconSource source = { NULL, NULL, 0, 0, 0,
TRUE, TRUE, TRUE };
g_return_val_if_fail (pixbuf != NULL, NULL);
@@ -792,7 +810,8 @@ gtk_icon_set_copy (GtkIconSet *icon_set)
static gboolean
-sizes_equivalent (const gchar *rhs, const gchar *lhs)
+sizes_equivalent (GtkIconSize lhs,
+ GtkIconSize rhs)
{
gint r_w, r_h, l_w, l_h;
@@ -806,7 +825,7 @@ static GtkIconSource*
find_and_prep_icon_source (GtkIconSet *icon_set,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size)
+ GtkIconSize size)
{
GtkIconSource *source;
GSList *tmp_list;
@@ -920,7 +939,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GtkWidget *widget,
const char *detail)
{
@@ -1048,7 +1067,7 @@ gtk_icon_source_copy (const GtkIconSource *source)
*copy = *source;
copy->filename = g_strdup (source->filename);
- copy->size = g_strdup (source->size);
+ copy->size = source->size;
if (copy->pixbuf)
g_object_ref (G_OBJECT (copy->pixbuf));
@@ -1068,7 +1087,6 @@ gtk_icon_source_free (GtkIconSource *source)
g_return_if_fail (source != NULL);
g_free ((char*) source->filename);
- g_free ((char*) source->size);
if (source->pixbuf)
g_object_unref (G_OBJECT (source->pixbuf));
@@ -1090,7 +1108,7 @@ struct _CachedIcon
GtkStyle *style;
GtkTextDirection direction;
GtkStateType state;
- gchar *size;
+ GtkIconSize size;
GdkPixbuf *pixbuf;
};
@@ -1105,7 +1123,6 @@ ensure_cache_up_to_date (GtkIconSet *icon_set)
static void
cached_icon_free (CachedIcon *icon)
{
- g_free (icon->size);
g_object_unref (G_OBJECT (icon->pixbuf));
g_free (icon);
@@ -1116,7 +1133,7 @@ find_in_cache (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size)
+ GtkIconSize size)
{
GSList *tmp_list;
GSList *prev;
@@ -1132,7 +1149,7 @@ find_in_cache (GtkIconSet *icon_set,
if (icon->style == style &&
icon->direction == direction &&
icon->state == state &&
- strcmp (icon->size, size) == 0)
+ icon->size == size)
{
if (prev)
{
@@ -1157,7 +1174,7 @@ add_to_cache (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GdkPixbuf *pixbuf)
{
CachedIcon *icon;
@@ -1181,7 +1198,7 @@ add_to_cache (GtkIconSet *icon_set,
icon->style = style;
icon->direction = direction;
icon->state = state;
- icon->size = g_strdup (size);
+ icon->size = size;
icon->pixbuf = pixbuf;
if (icon->style)
@@ -1272,7 +1289,7 @@ copy_cache (GtkIconSet *icon_set,
g_object_ref (G_OBJECT (icon_copy->pixbuf));
- icon_copy->size = g_strdup (icon->size);
+ icon_copy->size = icon->size;
copy = g_slist_prepend (copy, icon_copy);
diff --git a/gtk/gtkiconfactory.h b/gtk/gtkiconfactory.h
index 1f26abb823..89c0f161c8 100644
--- a/gtk/gtkiconfactory.h
+++ b/gtk/gtkiconfactory.h
@@ -82,23 +82,16 @@ GtkIconSet* gtk_icon_factory_lookup_default (const gchar *stock_id);
* size from the rendered pixbuf, not from here.
*/
-gboolean gtk_icon_size_lookup (const gchar *alias,
- gint *width,
- gint *height);
-void gtk_icon_size_register (const gchar *alias,
- gint width,
- gint height);
-void gtk_icon_size_register_alias (const gchar *alias,
- const gchar *target);
-
-
-/* Standard sizes */
-
-#define GTK_ICON_SIZE_MENU "gtk-menu"
-#define GTK_ICON_SIZE_SMALL_TOOLBAR "gtk-small-toolbar"
-#define GTK_ICON_SIZE_LARGE_TOOLBAR "gtk-large-toolbar"
-#define GTK_ICON_SIZE_BUTTON "gtk-button"
-#define GTK_ICON_SIZE_DIALOG "gtk-dialog"
+gboolean gtk_icon_size_lookup (GtkIconSize size,
+ gint *width,
+ gint *height);
+GtkIconSize gtk_icon_size_register (const gchar *name,
+ gint width,
+ gint height);
+void gtk_icon_size_register_alias (const gchar *alias,
+ GtkIconSize target);
+GtkIconSize gtk_icon_size_from_name (const gchar *name);
+G_CONST_RETURN gchar* gtk_icon_size_get_name (GtkIconSize size);
/* Icon sets */
@@ -116,7 +109,7 @@ GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set,
GtkStyle *style,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GtkWidget *widget,
const char *detail);
@@ -138,7 +131,7 @@ struct _GtkIconSource
GtkTextDirection direction;
GtkStateType state;
- gchar *size;
+ GtkIconSize size;
/* If TRUE, then the parameter is wildcarded, and the above
* fields should be ignored. If FALSE, the parameter is
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index a28109419d..48da4edcd0 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -224,7 +224,7 @@ gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf)
**/
GtkWidget*
gtk_image_new_from_stock (const gchar *stock_id,
- const gchar *size)
+ GtkIconSize size)
{
GtkImage *image;
@@ -257,7 +257,7 @@ gtk_image_new_from_stock (const gchar *stock_id,
**/
GtkWidget*
gtk_image_new_from_icon_set (GtkIconSet *icon_set,
- const gchar *size)
+ GtkIconSize size)
{
GtkImage *image;
@@ -446,7 +446,7 @@ gtk_image_set_from_pixbuf (GtkImage *image,
void
gtk_image_set_from_stock (GtkImage *image,
const gchar *stock_id,
- const gchar *size)
+ GtkIconSize size)
{
g_return_if_fail (GTK_IS_IMAGE (image));
@@ -457,7 +457,7 @@ gtk_image_set_from_stock (GtkImage *image,
image->storage_type = GTK_IMAGE_STOCK;
image->data.stock.stock_id = g_strdup (stock_id);
- image->data.stock.size = g_strdup (size);
+ image->data.stock.size = size;
/* Size is demand-computed in size request method
* if we're a stock image, since changing the
@@ -478,7 +478,7 @@ gtk_image_set_from_stock (GtkImage *image,
void
gtk_image_set_from_icon_set (GtkImage *image,
GtkIconSet *icon_set,
- const gchar *size)
+ GtkIconSize size)
{
g_return_if_fail (GTK_IS_IMAGE (image));
@@ -492,7 +492,7 @@ gtk_image_set_from_icon_set (GtkImage *image,
image->storage_type = GTK_IMAGE_ICON_SET;
image->data.icon_set.icon_set = icon_set;
- image->data.icon_set.size = g_strdup (size);
+ image->data.icon_set.size = size;
/* Size is demand-computed in size request method
* if we're an icon set
@@ -610,14 +610,14 @@ gtk_image_get_pixbuf (GtkImage *image)
* Gets the stock icon name and size being displayed by the #GtkImage.
* The storage type of the image must be %GTK_IMAGE_EMPTY or
* %GTK_IMAGE_STOCK (see gtk_image_get_storage_type()).
- * The returned strings are owned by the #GtkImage and should not
+ * The returned string is owned by the #GtkImage and should not
* be freed.
*
**/
void
gtk_image_get_stock (GtkImage *image,
gchar **stock_id,
- gchar **size)
+ GtkIconSize *size)
{
g_return_if_fail (GTK_IS_IMAGE (image));
g_return_if_fail (image->storage_type == GTK_IMAGE_STOCK ||
@@ -642,14 +642,12 @@ gtk_image_get_stock (GtkImage *image,
* Gets the icon set and size being displayed by the #GtkImage.
* The storage type of the image must be %GTK_IMAGE_EMPTY or
* %GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).
- * The returned size string is owned by the #GtkImage and should not
- * be freed.
*
**/
void
gtk_image_get_icon_set (GtkImage *image,
GtkIconSet **icon_set,
- gchar **size)
+ GtkIconSize *size)
{
g_return_if_fail (GTK_IS_IMAGE (image));
g_return_if_fail (image->storage_type == GTK_IMAGE_ICON_SET ||
@@ -907,11 +905,10 @@ gtk_image_clear (GtkImage *image)
case GTK_IMAGE_STOCK:
- g_free (image->data.stock.size);
g_free (image->data.stock.stock_id);
image->data.stock.stock_id = NULL;
- image->data.stock.size = NULL;
+ image->data.stock.size = 0;
break;
@@ -919,9 +916,7 @@ gtk_image_clear (GtkImage *image)
if (image->data.icon_set.icon_set)
gtk_icon_set_unref (image->data.icon_set.icon_set);
- g_free (image->data.icon_set.size);
-
- image->data.icon_set.size = NULL;
+ image->data.icon_set.size = 0;
image->data.icon_set.icon_set = NULL;
break;
diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h
index 0c5da6db62..bc1a0c0a60 100644
--- a/gtk/gtkimage.h
+++ b/gtk/gtkimage.h
@@ -73,13 +73,13 @@ struct _GtkImagePixbufData
struct _GtkImageStockData
{
gchar *stock_id;
- gchar *size;
+ GtkIconSize size;
};
struct _GtkImageIconSetData
{
GtkIconSet *icon_set;
- gchar *size;
+ GtkIconSize size;
};
typedef enum
@@ -122,9 +122,9 @@ GtkWidget* gtk_image_new_from_image (GdkImage *image,
GtkWidget* gtk_image_new_from_file (const gchar *filename);
GtkWidget* gtk_image_new_from_pixbuf (GdkPixbuf *pixbuf);
GtkWidget* gtk_image_new_from_stock (const gchar *stock_id,
- const gchar *size);
+ GtkIconSize size);
GtkWidget* gtk_image_new_from_icon_set (GtkIconSet *icon_set,
- const gchar *size);
+ GtkIconSize size);
void gtk_image_set_from_pixmap (GtkImage *image,
GdkPixmap *pixmap,
@@ -138,10 +138,10 @@ void gtk_image_set_from_pixbuf (GtkImage *image,
GdkPixbuf *pixbuf);
void gtk_image_set_from_stock (GtkImage *image,
const gchar *stock_id,
- const gchar *size);
+ GtkIconSize size);
void gtk_image_set_from_icon_set (GtkImage *image,
GtkIconSet *icon_set,
- const gchar *size);
+ GtkIconSize size);
GtkImageType gtk_image_get_storage_type (GtkImage *image);
@@ -154,10 +154,10 @@ void gtk_image_get_image (GtkImage *image,
GdkPixbuf* gtk_image_get_pixbuf (GtkImage *image);
void gtk_image_get_stock (GtkImage *image,
gchar **stock_id,
- gchar **size);
+ GtkIconSize *size);
void gtk_image_get_icon_set (GtkImage *image,
GtkIconSet **icon_set,
- gchar **size);
+ GtkIconSize *size);
#ifndef GTK_DISABLE_DEPRECATED
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index fbd5bab69e..069cc4e222 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -2711,7 +2711,6 @@ static void
cleanup_source (GtkIconSource *source)
{
g_free (source->filename);
- g_free (source->size);
}
static guint
@@ -2848,14 +2847,21 @@ gtk_rc_parse_icon_source (GScanner *scanner,
if (token != '*')
{
+ GtkIconSize size;
+
if (token != G_TOKEN_STRING)
{
cleanup_source (&source);
return G_TOKEN_STRING;
}
-
- source.size = g_strdup (scanner->value.v_string);
- source.any_size = FALSE;
+
+ size = gtk_icon_size_from_name (scanner->value.v_string);
+
+ if (size != GTK_ICON_SIZE_INVALID)
+ {
+ source.size = size;
+ source.any_size = FALSE;
+ }
}
/* Check the close brace */
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index b225405edf..9b70e58e69 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -63,7 +63,7 @@ static GdkPixbuf *gtk_default_render_icon (GtkStyle *style,
const GtkIconSource *source,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GtkWidget *widget,
const gchar *detail);
@@ -1270,7 +1270,7 @@ gtk_style_render_icon (GtkStyle *style,
const GtkIconSource *source,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GtkWidget *widget,
const gchar *detail)
{
@@ -1373,12 +1373,12 @@ scale_or_ref (GdkPixbuf *src,
static GdkPixbuf *
gtk_default_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- const gchar *size,
- GtkWidget *widget,
- const gchar *detail)
+ const GtkIconSource *source,
+ GtkTextDirection direction,
+ GtkStateType state,
+ GtkIconSize size,
+ GtkWidget *widget,
+ const gchar *detail)
{
gint width = 1;
gint height = 1;
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
index d52248ae4d..bcb02be505 100644
--- a/gtk/gtkstyle.h
+++ b/gtk/gtkstyle.h
@@ -157,7 +157,7 @@ struct _GtkStyleClass
const GtkIconSource *source,
GtkTextDirection direction,
GtkStateType state,
- const gchar *size,
+ GtkIconSize size,
GtkWidget *widget,
const gchar *detail);
@@ -413,7 +413,7 @@ GdkPixbuf * gtk_style_render_icon (GtkStyle *style,
const GtkIconSource *source,
GtkTextDirection direction,
GtkStateType state,
- const gchar * size,
+ GtkIconSize size,
GtkWidget *widget,
const gchar *detail);
void gtk_draw_hline (GtkStyle *style,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 32b1165270..88491c4d5c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3764,12 +3764,12 @@ gtk_widget_create_pango_layout (GtkWidget *widget,
* identifies the widget or code doing the rendering, so that
* theme engines can special-case rendering for that widget or code.
*
- * Return value: a new pixbuf, or NULL if the stock ID wasn't known
+ * Return value: a new pixbuf, or %NULL if the stock ID wasn't known
**/
GdkPixbuf*
gtk_widget_render_icon (GtkWidget *widget,
const gchar *stock_id,
- const gchar *size,
+ GtkIconSize size,
const gchar *detail)
{
GtkIconSet *icon_set;
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 61c2c2f1b9..7a8b1b35eb 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -580,7 +580,7 @@ PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
const gchar *stock_id,
- const gchar *size,
+ GtkIconSize size,
const gchar *detail);
/* handle composite names for GTK_COMPOSITE_CHILD widgets,