summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2001-03-22 13:44:00 +0000
committerTim Janik <timj@src.gnome.org>2001-03-22 13:44:00 +0000
commitc2c98d9e120a0ed4493c7743c9e79ef5b71fb5b1 (patch)
tree5ffef2868ce1715172daaee09aaaabe0a069ab50
parent6e58fd1ee3fe8916a89480fb3454f3f02397aab6 (diff)
downloadgdk-pixbuf-c2c98d9e120a0ed4493c7743c9e79ef5b71fb5b1.tar.gz
some cleanups, fixed mnemonic_widget handling, added PROP_MNEMONIC_WIDGET.
Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org> * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling, added PROP_MNEMONIC_WIDGET. * gtk/gtkwindow.c (gtk_window_activate_mnemonic): (gtk_window_remove_mnemonic): (gtk_window_add_mnemonic): fixed assertions. (gtk_window_activate_mnemonic): constrain modifier checks to those permitted by gtk_accelerator_get_default_mod_mask(). got rid of gtk_window_get_default_accel_group(). * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non activatable widgets either by focussing or a warning. added a signal accumulator to ::activate_mnemonic which stops the emission once a handler returned TRUE.
-rw-r--r--ChangeLog17
-rw-r--r--ChangeLog.pre-2-017
-rw-r--r--ChangeLog.pre-2-1017
-rw-r--r--ChangeLog.pre-2-217
-rw-r--r--ChangeLog.pre-2-417
-rw-r--r--ChangeLog.pre-2-617
-rw-r--r--ChangeLog.pre-2-817
-rw-r--r--docs/reference/gtk/tmpl/gtk-unused.sgml105
-rw-r--r--docs/reference/gtk/tmpl/gtkbutton.sgml20
-rw-r--r--docs/reference/gtk/tmpl/gtkitemfactory.sgml2
-rw-r--r--docs/reference/gtk/tmpl/gtklabel.sgml17
-rw-r--r--docs/reference/gtk/tmpl/gtkmenu.sgml18
-rw-r--r--docs/reference/gtk/tmpl/gtksignal.sgml219
-rw-r--r--docs/reference/gtk/tmpl/gtktypeutils.sgml20
-rw-r--r--docs/reference/gtk/tmpl/gtkwidget.sgml9
-rw-r--r--docs/reference/gtk/tmpl/gtkwindow.sgml9
-rw-r--r--gtk/gtklabel.c72
-rw-r--r--gtk/gtklabel.h72
-rw-r--r--gtk/gtknotebook.c13
-rw-r--r--gtk/gtkwidget.c59
-rw-r--r--gtk/gtkwidget.h9
-rw-r--r--gtk/gtkwindow.c72
-rw-r--r--gtk/gtkwindow.h3
-rw-r--r--gtk/testgtk.c4
-rw-r--r--tests/testgtk.c4
25 files changed, 497 insertions, 349 deletions
diff --git a/ChangeLog b/ChangeLog
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 638ed8455..6d3f0fcce 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,20 @@
+Thu Mar 22 13:01:44 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtklabel.[hc]: some cleanups, fixed mnemonic_widget handling,
+ added PROP_MNEMONIC_WIDGET.
+
+ * gtk/gtkwindow.c (gtk_window_activate_mnemonic):
+ (gtk_window_remove_mnemonic):
+ (gtk_window_add_mnemonic): fixed assertions.
+ (gtk_window_activate_mnemonic): constrain modifier checks to those
+ permitted by gtk_accelerator_get_default_mod_mask().
+ got rid of gtk_window_get_default_accel_group().
+
+ * gtk/gtkwidget.c (gtk_widget_real_activate_mnemonic): handle non
+ activatable widgets either by focussing or a warning.
+ added a signal accumulator to ::activate_mnemonic which stops the
+ emission once a handler returned TRUE.
+
2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in
diff --git a/docs/reference/gtk/tmpl/gtk-unused.sgml b/docs/reference/gtk/tmpl/gtk-unused.sgml
index 0c19d1276..420f3b311 100644
--- a/docs/reference/gtk/tmpl/gtk-unused.sgml
+++ b/docs/reference/gtk/tmpl/gtk-unused.sgml
@@ -445,24 +445,6 @@ 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
@@ -497,6 +479,12 @@ gtk_font_selection_set_filter().
@tentative_match:
@tentative_match_len:
+<!-- ##### ARG GtkLabel:accel-keyval ##### -->
+<para>
+
+</para>
+
+
<!-- ##### ARG GtkObject:object-signal ##### -->
<para>
Setting this with a GtkType of GTK_TYPE_SIGNAL connects
@@ -734,6 +722,24 @@ Sets the default size of child buttons.
@min_width: minimum default width for child buttons.
@min_height: minimum default height for child buttons.
+<!-- ##### FUNCTION gtk_button_new_accel ##### -->
+<para>
+
+</para>
+
+@uline_label:
+@accel_group:
+@Returns:
+
+<!-- ##### FUNCTION gtk_button_new_stock ##### -->
+<para>
+
+</para>
+
+@stock_id:
+@accel_group:
+@Returns:
+
<!-- ##### FUNCTION gtk_clist_construct ##### -->
<para>
Initializes a previously allocated #GtkCList widget for use. This should not
@@ -842,6 +848,31 @@ Get the type of GtkIdentifier.
@Returns: GtkType -- the enumerated type of something.
+<!-- ##### FUNCTION gtk_label_set_markup_with_accel ##### -->
+<para>
+
+</para>
+
+@label:
+@str:
+@Returns:
+
+<!-- ##### FUNCTION gtk_menu_ensure_uline_accel_group ##### -->
+<para>
+
+</para>
+
+@menu:
+@Returns:
+
+<!-- ##### FUNCTION gtk_menu_get_uline_accel_group ##### -->
+<para>
+
+</para>
+
+@menu:
+@Returns:
+
<!-- ##### FUNCTION gtk_object_arg_get ##### -->
<para>
Private function to get an argument and argument info from an object.
@@ -1056,20 +1087,6 @@ 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.
@@ -1109,12 +1126,6 @@ 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
@@ -1156,16 +1167,6 @@ 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
@@ -1331,3 +1332,11 @@ Set the varargs type for a fundamental type @foreign_type.
fundamental type.
@varargs_type: Must be a GtkType which is either structured or flag, or NONE.
+<!-- ##### FUNCTION gtk_window_get_default_accel_group ##### -->
+<para>
+
+</para>
+
+@window:
+@Returns:
+
diff --git a/docs/reference/gtk/tmpl/gtkbutton.sgml b/docs/reference/gtk/tmpl/gtkbutton.sgml
index c7dda98a4..db22ccf65 100644
--- a/docs/reference/gtk/tmpl/gtkbutton.sgml
+++ b/docs/reference/gtk/tmpl/gtkbutton.sgml
@@ -45,26 +45,6 @@ text.
@Returns: The newly created #GtkButton widget.
-<!-- ##### FUNCTION gtk_button_new_accel ##### -->
-<para>
-
-</para>
-
-@uline_label:
-@accel_group:
-@Returns:
-
-
-<!-- ##### FUNCTION gtk_button_new_stock ##### -->
-<para>
-
-</para>
-
-@stock_id:
-@accel_group:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_button_pressed ##### -->
<para>
Emits a #GtkButton::pressed signal to the given #GtkButton.
diff --git a/docs/reference/gtk/tmpl/gtkitemfactory.sgml b/docs/reference/gtk/tmpl/gtkitemfactory.sgml
index 8c4dd6a9d..18c4cc601 100644
--- a/docs/reference/gtk/tmpl/gtkitemfactory.sgml
+++ b/docs/reference/gtk/tmpl/gtkitemfactory.sgml
@@ -76,6 +76,8 @@ GtkItemFactory
@callback:
@callback_action:
@item_type:
+@extra_data:
+@extra_data2:
<!-- ##### STRUCT GtkItemFactoryItem ##### -->
<para>
diff --git a/docs/reference/gtk/tmpl/gtklabel.sgml b/docs/reference/gtk/tmpl/gtklabel.sgml
index 40e7d1d34..b168ac0e2 100644
--- a/docs/reference/gtk/tmpl/gtklabel.sgml
+++ b/docs/reference/gtk/tmpl/gtklabel.sgml
@@ -64,16 +64,6 @@ gtk_label_set_pattern().
@str:
-<!-- ##### FUNCTION gtk_label_set_markup_with_accel ##### -->
-<para>
-
-</para>
-
-@label:
-@str:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_label_set_pattern ##### -->
<para>
The pattern of underlines you want under the existing text within the
@@ -183,7 +173,12 @@ pointer, it isn't copied.
</para>
-<!-- ##### ARG GtkLabel:accel-keyval ##### -->
+<!-- ##### ARG GtkLabel:mnemonic-keyval ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG GtkLabel:mnemonic-widget ##### -->
<para>
</para>
diff --git a/docs/reference/gtk/tmpl/gtkmenu.sgml b/docs/reference/gtk/tmpl/gtkmenu.sgml
index 7ba340919..f68992453 100644
--- a/docs/reference/gtk/tmpl/gtkmenu.sgml
+++ b/docs/reference/gtk/tmpl/gtkmenu.sgml
@@ -171,24 +171,6 @@ Set the #GtkAccelGroup which holds global accelerators for the menu.
@Returns:
-<!-- ##### FUNCTION gtk_menu_get_uline_accel_group ##### -->
-<para>
-
-</para>
-
-@menu:
-@Returns:
-
-
-<!-- ##### FUNCTION gtk_menu_ensure_uline_accel_group ##### -->
-<para>
-
-</para>
-
-@menu:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_menu_set_title ##### -->
<para>
Sets the title string for the menu. The title is displayed when the menu
diff --git a/docs/reference/gtk/tmpl/gtksignal.sgml b/docs/reference/gtk/tmpl/gtksignal.sgml
index 1bb805c8b..11705206f 100644
--- a/docs/reference/gtk/tmpl/gtksignal.sgml
+++ b/docs/reference/gtk/tmpl/gtksignal.sgml
@@ -157,6 +157,25 @@ 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
@@ -232,6 +251,13 @@ 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
@@ -289,7 +315,7 @@ you don't want a return value.
the callbacks.
-<!-- ##### MACRO gtk_signal_lookup ##### -->
+<!-- ##### FUNCTION 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
@@ -299,13 +325,12 @@ 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.
-<!-- ##### MACRO gtk_signal_name ##### -->
+<!-- ##### FUNCTION gtk_signal_name ##### -->
<para>
Given the signal's identifier, find its name.
</para>
@@ -313,9 +338,8 @@ Given the signal's identifier, find its name.
Two different signals may have the same name, if they have differing types.
</para>
-@Returns: the signal name, or NULL if the signal number was invalid.
-<!-- # Unused Parameters # -->
@signal_id: the signal's identifying number.
+@Returns: the signal name, or NULL if the signal number was invalid.
<!-- ##### FUNCTION gtk_signal_emit ##### -->
@@ -383,7 +407,7 @@ an array of GtkArgs instead of using C's varargs mechanism.
followed by one which is a pointer to the return type.
-<!-- ##### MACRO gtk_signal_emit_stop ##### -->
+<!-- ##### FUNCTION gtk_signal_emit_stop ##### -->
<para>
This function aborts a signal's current emission.
</para>
@@ -397,11 +421,11 @@ It will print a warning if used on a signal which
isn't being emitted.
</para>
-@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().
+<!-- # Unused Parameters # -->
+@i:
+@s:
<!-- ##### FUNCTION gtk_signal_emit_stop_by_name ##### -->
@@ -417,7 +441,7 @@ except it will lookup the signal id for you.
@name: the name of the signal you wish to stop.
-<!-- ##### MACRO gtk_signal_connect ##### -->
+<!-- ##### FUNCTION gtk_signal_connect ##### -->
<para>
Attach a function pointer and user data to a signal for
a particular object.
@@ -456,38 +480,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:
-<!-- ##### MACRO gtk_signal_connect_after ##### -->
+<!-- ##### FUNCTION 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>
-@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).
+@Returns: the unique identifier for this attachment: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_connect_object ##### -->
+<!-- ##### FUNCTION gtk_signal_connect_object ##### -->
<para>
This function is for registering a callback that will
call another object's callback. That is,
@@ -508,21 +532,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:
-<!-- ##### MACRO gtk_signal_connect_object_after ##### -->
+<!-- ##### FUNCTION gtk_signal_connect_object_after ##### -->
<para>
Attach a signal hook to a signal, passing in an alternate
object as the first parameter, and guaranteeing
@@ -530,16 +554,16 @@ that the default handler and all normal
handlers are called first.
</para>
-@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.
+@Returns: the connection id.
+<!-- # Unused Parameters # -->
+@o:
+@s:
+@f:
+@d:
<!-- ##### FUNCTION gtk_signal_connect_full ##### -->
@@ -628,98 +652,95 @@ should signal the removal of this signal.
@name: name of the signal.
-<!-- ##### MACRO gtk_signal_disconnect ##### -->
+<!-- ##### FUNCTION 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.
-<!-- ##### MACRO gtk_signal_disconnect_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_disconnect_by_func ##### -->
<para>
Destroy all connections for a particular object, with
the given function-pointer and user-data.
</para>
-@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.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_disconnect_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_disconnect_by_data ##### -->
<para>
Destroy all connections for a particular object, with
the given user-data.
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_block ##### -->
+<!-- ##### FUNCTION 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.
-<!-- ##### MACRO gtk_signal_handler_block_by_func ##### -->
+<!-- ##### FUNCTION 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>
-@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.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_handler_block_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_block_by_data ##### -->
<para>
Prevent all user-defined handlers with a certain user data from being invoked.
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to block.
@data: the user data of the handlers to block.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_unblock ##### -->
+<!-- ##### FUNCTION 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.
-<!-- ##### MACRO gtk_signal_handler_unblock_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_unblock_by_func ##### -->
<para>
Undo a block, by function pointer and data.
Note that undoing a block doesn't
@@ -727,29 +748,29 @@ necessarily make the hook callable, because if you block a
hook twice, you must unblock it twice.
</para>
-@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.
+<!-- # Unused Parameters # -->
+@o:
+@f:
+@d:
-<!-- ##### MACRO gtk_signal_handler_unblock_by_data ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_unblock_by_data ##### -->
<para>
Undo block(s), to all signals for a particular object
with a particular user-data pointer
</para>
-@o:
-@d:
-<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock.
@data: the user data to search for.
+<!-- # Unused Parameters # -->
+@o:
+@d:
-<!-- ##### MACRO gtk_signal_handler_pending ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_pending ##### -->
<para>
Returns a connection id corresponding to a given signal id and object.
</para>
@@ -760,36 +781,64 @@ 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:
-<!-- ##### MACRO gtk_signal_handler_pending_by_func ##### -->
+<!-- ##### FUNCTION gtk_signal_handler_pending_by_func ##### -->
<para>
Returns a connection id corresponding to a given signal id, object, function
pointer and user data.
</para>
-@o:
-@s:
-@b:
-@f:
-@d:
-@Returns: the connection id, if a handler was found. 0 otherwise.
-<!-- # Unused Parameters # -->
@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().
+<!-- # Unused Parameters # -->
+@i:
+@h:
<!-- ##### MACRO gtk_signal_default_marshaller ##### -->
diff --git a/docs/reference/gtk/tmpl/gtktypeutils.sgml b/docs/reference/gtk/tmpl/gtktypeutils.sgml
index 16a7e543f..6295e2dfa 100644
--- a/docs/reference/gtk/tmpl/gtktypeutils.sgml
+++ b/docs/reference/gtk/tmpl/gtktypeutils.sgml
@@ -560,33 +560,30 @@ Create a new, unique type.
@type_info: must not be null, and @type_info->type_name must also not be null.
-<!-- ##### MACRO gtk_type_name ##### -->
+<!-- ##### FUNCTION gtk_type_name ##### -->
<para>
</para>
-@Returns: a pointer to the name of a type, or NULL if it has none.
-<!-- # Unused Parameters # -->
@type: a GtkType
+@Returns: a pointer to the name of a type, or NULL if it has none.
-<!-- ##### MACRO gtk_type_from_name ##### -->
+<!-- ##### FUNCTION gtk_type_from_name ##### -->
<para>
Get the internal representation of a type given its name.
</para>
-@Returns: a GtkType
-<!-- # Unused Parameters # -->
@name: the name of a gtk type
+@Returns: a GtkType
-<!-- ##### MACRO gtk_type_parent ##### -->
+<!-- ##### FUNCTION gtk_type_parent ##### -->
<para>
</para>
-@Returns: the GtkType of the parent
-<!-- # Unused Parameters # -->
@type: a GtkType
+@Returns: the GtkType of the parent
<!-- ##### FUNCTION gtk_type_class ##### -->
@@ -611,16 +608,15 @@ has all the proper initializers called.
@Returns: gpointer to a GtkTypeObject
-<!-- ##### MACRO gtk_type_is_a ##### -->
+<!-- ##### FUNCTION 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/docs/reference/gtk/tmpl/gtkwidget.sgml b/docs/reference/gtk/tmpl/gtkwidget.sgml
index 6f1e03319..f5349f94d 100644
--- a/docs/reference/gtk/tmpl/gtkwidget.sgml
+++ b/docs/reference/gtk/tmpl/gtkwidget.sgml
@@ -1247,6 +1247,15 @@ GtkWidget
@Returns:
+<!-- ##### SIGNAL GtkWidget::activate-mnemonic ##### -->
+<para>
+
+</para>
+
+@widget: the object which received the signal.
+@arg1:
+@Returns:
+
<!-- ##### SIGNAL GtkWidget::add-accelerator ##### -->
<para>
diff --git a/docs/reference/gtk/tmpl/gtkwindow.sgml b/docs/reference/gtk/tmpl/gtkwindow.sgml
index c3db63e8c..cd300a260 100644
--- a/docs/reference/gtk/tmpl/gtkwindow.sgml
+++ b/docs/reference/gtk/tmpl/gtkwindow.sgml
@@ -236,15 +236,6 @@ it's larger
@Returns:
-<!-- ##### FUNCTION gtk_window_get_default_accel_group ##### -->
-<para>
-
-</para>
-
-@window:
-@Returns:
-
-
<!-- ##### SIGNAL GtkWindow::frame-event ##### -->
<para>
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index a269f8634..42d6300f5 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -54,7 +54,8 @@ enum {
PROP_PATTERN,
PROP_WRAP,
PROP_SELECTABLE,
- PROP_MNEMONIC_KEYVAL
+ PROP_MNEMONIC_KEYVAL,
+ PROP_MNEMONIC_WIDGET
};
static void gtk_label_class_init (GtkLabelClass *klass);
@@ -67,6 +68,7 @@ static void gtk_label_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void gtk_label_destroy (GtkObject *object);
static void gtk_label_finalize (GObject *object);
static void gtk_label_size_request (GtkWidget *widget,
GtkRequisition *requisition);
@@ -158,17 +160,16 @@ static void
gtk_label_class_init (GtkLabelClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
+ GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
parent_class = gtk_type_class (GTK_TYPE_MISC);
gobject_class->set_property = gtk_label_set_property;
gobject_class->get_property = gtk_label_get_property;
gobject_class->finalize = gtk_label_finalize;
+
+ object_class->destroy = gtk_label_destroy;
widget_class->size_request = gtk_label_size_request;
widget_class->size_allocate = gtk_label_size_allocate;
@@ -248,13 +249,20 @@ gtk_label_class_init (GtkLabelClass *class)
g_object_class_install_property (gobject_class,
PROP_MNEMONIC_KEYVAL,
g_param_spec_uint ("mnemonic_keyval",
- _("Mnemonic accelerator key value"),
+ _("Mnemonic key"),
_("The mnemonic accelerator key for this label."),
0,
G_MAXUINT,
GDK_VoidSymbol,
G_PARAM_READABLE));
-
+ g_object_class_install_property (gobject_class,
+ PROP_MNEMONIC_WIDGET,
+ g_param_spec_object ("mnemonic_widget",
+ _("Mnemonic widget"),
+ _("The widget to be activated when the label's mnemonic "
+ "key is pressed."),
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
}
static void
@@ -297,6 +305,9 @@ gtk_label_set_property (GObject *object,
case PROP_SELECTABLE:
gtk_label_set_selectable (label, g_value_get_boolean (value));
break;
+ case PROP_MNEMONIC_WIDGET:
+ gtk_label_set_mnemonic_widget (label, (GtkWidget*) g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -339,6 +350,9 @@ gtk_label_get_property (GObject *object,
case PROP_MNEMONIC_KEYVAL:
g_value_set_uint (value, label->mnemonic_keyval);
break;
+ case PROP_MNEMONIC_WIDGET:
+ g_value_set_object (value, (GObject*) label->mnemonic_widget);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -425,21 +439,21 @@ gtk_label_activate_mnemonic (GtkWidget *widget,
if (GTK_LABEL (widget)->mnemonic_widget)
return gtk_widget_activate_mnemonic (GTK_LABEL (widget)->mnemonic_widget, group_cycling);
- /* Try to find the widget to activate by traversing the widget
- * hierarachy.
+ /* Try to find the widget to activate by traversing the
+ * widget's ancestry.
*/
-
parent = widget->parent;
while (parent)
{
if (GTK_WIDGET_CAN_FOCUS (parent) ||
(!group_cycling && GTK_WIDGET_GET_CLASS (parent)->activate_signal) ||
- (parent->parent && GTK_IS_NOTEBOOK (parent->parent)) ||
+ (parent->parent && GTK_IS_NOTEBOOK (parent->parent)) ||
(GTK_IS_MENU_ITEM (parent)))
return gtk_widget_activate_mnemonic (parent, group_cycling);
parent = parent->parent;
}
+ /* barf if there was nothing to activate */
g_warning ("Couldn't find a target for a mnemonic activation.");
gdk_beep ();
@@ -447,11 +461,12 @@ gtk_label_activate_mnemonic (GtkWidget *widget,
}
static void
-gtk_label_setup_mnemonic (GtkLabel *label, guint last_key)
+gtk_label_setup_mnemonic (GtkLabel *label,
+ guint last_key)
{
GtkWidget *toplevel;
- if ((last_key != GDK_VoidSymbol) && label->mnemonic_window)
+ if (last_key != GDK_VoidSymbol && label->mnemonic_window)
gtk_window_remove_mnemonic (label->mnemonic_window,
last_key,
GTK_WIDGET (label));
@@ -499,13 +514,18 @@ gtk_label_hierarchy_changed (GtkWidget *widget)
* mnemonic collisions and toggle focus between the colliding widgets otherwise.
**/
void
-gtk_label_set_mnemonic_widget (GtkLabel *label,
- GtkWidget *widget)
+gtk_label_set_mnemonic_widget (GtkLabel *label,
+ GtkWidget *widget)
{
g_return_if_fail (GTK_IS_LABEL (label));
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (widget)
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (label->mnemonic_widget)
+ gtk_widget_unref (label->mnemonic_widget);
label->mnemonic_widget = widget;
+ if (label->mnemonic_widget)
+ gtk_widget_ref (label->mnemonic_widget);
}
@@ -584,7 +604,8 @@ gtk_label_set_attributes_internal (GtkLabel *label,
/* Calculates text, attrs and mnemonic_keyval from
- * label, use_underline and use_markup */
+ * label, use_underline and use_markup
+ */
static void
gtk_label_recalculate (GtkLabel *label)
{
@@ -604,6 +625,7 @@ gtk_label_recalculate (GtkLabel *label)
if (!label->use_underline)
{
guint keyval = label->mnemonic_keyval;
+
label->mnemonic_keyval = GDK_VoidSymbol;
gtk_label_setup_mnemonic (label, keyval);
}
@@ -874,6 +896,16 @@ gtk_label_get (GtkLabel *label,
}
static void
+gtk_label_destroy (GtkObject *object)
+{
+ GtkLabel *label = GTK_LABEL (object);
+
+ gtk_label_set_mnemonic_widget (label, NULL);
+
+ GTK_OBJECT_CLASS (parent_class)->destroy (object);
+}
+
+static void
gtk_label_finalize (GObject *object)
{
GtkLabel *label;
@@ -1497,6 +1529,7 @@ window_to_layout_coords (GtkLabel *label,
}
}
+#if 0
static void
layout_to_window_coords (GtkLabel *label,
gint *x,
@@ -1522,6 +1555,7 @@ layout_to_window_coords (GtkLabel *label,
*y -= widget->allocation.y; /* go to selection window */
}
}
+#endif
static void
get_layout_index (GtkLabel *label,
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
index 3e3d783e4..bef1ca491 100644
--- a/gtk/gtklabel.h
+++ b/gtk/gtklabel.h
@@ -79,46 +79,38 @@ struct _GtkLabelClass
GtkMiscClass parent_class;
};
-GtkType gtk_label_get_type (void) G_GNUC_CONST;
-GtkWidget *gtk_label_new (const char *str);
-GtkWidget *gtk_label_new_with_mnemonic (const char *str);
-
-void gtk_label_set_text (GtkLabel *label,
- const char *str);
-G_CONST_RETURN gchar *gtk_label_get_text (GtkLabel *label);
-
-void gtk_label_set_attributes (GtkLabel *label,
- PangoAttrList *attrs);
-
-void gtk_label_set_markup (GtkLabel *label,
- const gchar *str);
-void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
- const gchar *str);
-
-guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
-void gtk_label_set_justify (GtkLabel *label,
- GtkJustification jtype);
-void gtk_label_set_pattern (GtkLabel *label,
- const gchar *pattern);
-void gtk_label_set_line_wrap (GtkLabel *label,
- gboolean wrap);
-
-void gtk_label_set_text_with_mnemonic (GtkLabel *label,
- const gchar *string);
-void gtk_label_set_mnemonic_widget (GtkLabel *label,
- GtkWidget *widget);
-
-void gtk_label_set_selectable (GtkLabel *label,
- gboolean setting);
-gboolean gtk_label_get_selectable (GtkLabel *label);
-
-void gtk_label_select_region (GtkLabel *label,
- gint start_offset,
- gint end_offset);
-
-void gtk_label_get_layout_offsets (GtkLabel *label,
- gint *x,
- gint *y);
+GtkType gtk_label_get_type (void) G_GNUC_CONST;
+GtkWidget* gtk_label_new (const char *str);
+GtkWidget* gtk_label_new_with_mnemonic (const char *str);
+void gtk_label_set_text (GtkLabel *label,
+ const char *str);
+G_CONST_RETURN gchar* gtk_label_get_text (GtkLabel *label);
+void gtk_label_set_attributes (GtkLabel *label,
+ PangoAttrList *attrs);
+void gtk_label_set_markup (GtkLabel *label,
+ const gchar *str);
+void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
+ const gchar *str);
+guint gtk_label_get_mnemonic_keyval (GtkLabel *label);
+void gtk_label_set_mnemonic_widget (GtkLabel *label,
+ GtkWidget *widget);
+void gtk_label_set_text_with_mnemonic (GtkLabel *label,
+ const gchar *string);
+void gtk_label_set_justify (GtkLabel *label,
+ GtkJustification jtype);
+void gtk_label_set_pattern (GtkLabel *label,
+ const gchar *pattern);
+void gtk_label_set_line_wrap (GtkLabel *label,
+ gboolean wrap);
+void gtk_label_set_selectable (GtkLabel *label,
+ gboolean setting);
+gboolean gtk_label_get_selectable (GtkLabel *label);
+void gtk_label_select_region (GtkLabel *label,
+ gint start_offset,
+ gint end_offset);
+void gtk_label_get_layout_offsets (GtkLabel *label,
+ gint *x,
+ gint *y);
#ifndef GTK_DISABLE_COMPAT_H
# define gtk_label_set gtk_label_set_text
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 390538de9..1ee200d4d 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -3638,18 +3638,17 @@ gtk_notebook_activate_mnemonic_switch_page (GtkWidget *child,
gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
- GtkNotebookPage *page;
GList *list;
-
+
list = g_list_find_custom (notebook->children, child,
gtk_notebook_page_compare_tab);
- if (!list)
- return TRUE;
-
+ if (list)
+ {
+ GtkNotebookPage *page = list->data;
- page = list->data;
+ gtk_notebook_switch_page (notebook, page, -1);
+ }
- gtk_notebook_switch_page (notebook, page, -1);
return TRUE;
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c63ff4a59..52cf619ad 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -252,6 +252,22 @@ gtk_widget_get_type (void)
return widget_type;
}
+static gboolean
+accumulator_stop_handled_emission (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer data)
+{
+ gboolean continue_emission;
+ gboolean signal_handled;
+
+ signal_handled = g_value_get_boolean (handler_return);
+ g_value_set_boolean (return_accu, signal_handled);
+ continue_emission = !signal_handled;
+
+ return continue_emission;
+}
+
/*****************************************
* gtk_widget_class_init:
*
@@ -465,13 +481,14 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_accel_group_create_remove (GTK_CLASS_TYPE (object_class), GTK_RUN_LAST,
GTK_SIGNAL_OFFSET (GtkWidgetClass, remove_accelerator));
widget_signals[ACTIVATE_MNEMONIC] =
- gtk_signal_new ("activate_mnemonic",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkWidgetClass, activate_mnemonic),
- gtk_marshal_BOOLEAN__BOOLEAN,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_BOOL);
+ g_signal_newc ("activate_mnemonic",
+ GTK_CLASS_TYPE (object_class),
+ GTK_RUN_LAST,
+ GTK_SIGNAL_OFFSET (GtkWidgetClass, activate_mnemonic),
+ accumulator_stop_handled_emission, NULL,
+ gtk_marshal_BOOLEAN__BOOLEAN,
+ GTK_TYPE_BOOL, 1,
+ GTK_TYPE_BOOL);
widget_signals[GRAB_FOCUS] =
gtk_signal_new ("grab_focus",
GTK_RUN_LAST | GTK_RUN_ACTION,
@@ -2191,17 +2208,18 @@ gboolean
gtk_widget_activate_mnemonic (GtkWidget *widget,
gboolean group_cycling)
{
- gboolean handled = FALSE;
+ gboolean handled;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+ group_cycling = group_cycling != FALSE;
if (!GTK_WIDGET_IS_SENSITIVE (widget))
- return TRUE;
-
- gtk_signal_emit_by_name (GTK_OBJECT (widget),
- "activate_mnemonic",
- group_cycling,
- &handled);
+ handled = TRUE;
+ else
+ gtk_signal_emit (GTK_OBJECT (widget),
+ widget_signals[ACTIVATE_MNEMONIC],
+ group_cycling,
+ &handled);
return handled;
}
@@ -2209,14 +2227,19 @@ static gboolean
gtk_widget_real_activate_mnemonic (GtkWidget *widget,
gboolean group_cycling)
{
- if (group_cycling)
- gtk_widget_grab_focus (widget);
- else if (!group_cycling)
+ if (!group_cycling && GTK_WIDGET_GET_CLASS (widget)->activate_signal)
gtk_widget_activate (widget);
+ else if (GTK_WIDGET_CAN_FOCUS (widget))
+ gtk_widget_grab_focus (widget);
+ else
+ {
+ g_warning ("widget `%s' isn't suitable for mnemonic activation",
+ G_OBJECT_TYPE_NAME (widget));
+ gdk_beep ();
+ }
return TRUE;
}
-
static gint
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index dbad8c98e..1d5d4bee8 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -55,11 +55,13 @@ typedef enum
GTK_HAS_FOCUS = 1 << 12,
/* widget is allowed to receive the default via gtk_widget_grab_default
- * and will reserve space to draw the default if possible */
+ * and will reserve space to draw the default if possible
+ */
GTK_CAN_DEFAULT = 1 << 13,
/* the widget currently is receiving the default action and should be drawn
- * appropriately if possible */
+ * appropriately if possible
+ */
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
@@ -69,7 +71,8 @@ typedef enum
GTK_APP_PAINTABLE = 1 << 19,
/* the widget when focused will receive the default action and have
- * HAS_DEFAULT set even if there is a different widget set as default */
+ * HAS_DEFAULT set even if there is a different widget set as default
+ */
GTK_RECEIVES_DEFAULT = 1 << 20,
GTK_DOUBLE_BUFFERED = 1 << 21
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 62067deac..a61ca7741 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -822,29 +822,6 @@ gtk_window_remove_accel_group (GtkWindow *window,
gtk_accel_group_detach (accel_group, GTK_OBJECT (window));
}
-GtkAccelGroup*
-gtk_window_get_default_accel_group (GtkWindow *window)
-{
- GtkAccelGroup *group;
-
- g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
-
- group = gtk_object_get_data (GTK_OBJECT (window),
- "gtk-accel-group");
-
- if (group == NULL)
- {
- group = gtk_accel_group_new ();
- gtk_window_add_accel_group (window, group);
- gtk_object_set_data (GTK_OBJECT (window),
- "gtk-accel-group",
- group);
- gtk_accel_group_unref (group);
- }
-
- return group;
-}
-
void
gtk_window_add_mnemonic (GtkWindow *window,
guint keyval,
@@ -853,17 +830,18 @@ gtk_window_add_mnemonic (GtkWindow *window,
GtkWindowMnemonic key;
GtkWindowMnemonic *mnemonic;
- g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_IS_WIDGET (target));
key.window = window;
key.keyval = keyval;
-
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key);
if (mnemonic)
- mnemonic->targets = g_slist_prepend (mnemonic->targets, target);
+ {
+ g_return_if_fail (g_slist_find (mnemonic->targets, target) == NULL);
+ mnemonic->targets = g_slist_prepend (mnemonic->targets, target);
+ }
else
{
mnemonic = g_new (GtkWindowMnemonic, 1);
@@ -881,26 +859,20 @@ gtk_window_remove_mnemonic (GtkWindow *window,
GtkWindowMnemonic key;
GtkWindowMnemonic *mnemonic;
- g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_IS_WIDGET (target));
key.window = window;
key.keyval = keyval;
-
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key);
- g_assert (mnemonic);
+ g_return_if_fail (mnemonic && g_slist_find (mnemonic->targets, target) != NULL);
- if (mnemonic)
+ mnemonic->targets = g_slist_remove (mnemonic->targets, target);
+ if (mnemonic->targets == NULL)
{
- mnemonic->targets = g_slist_remove (mnemonic->targets, target);
-
- if (mnemonic->targets == NULL)
- {
- g_hash_table_remove (mnemonic_hash_table, mnemonic);
- g_free (mnemonic);
- }
+ g_hash_table_remove (mnemonic_hash_table, mnemonic);
+ g_free (mnemonic);
}
}
@@ -915,15 +887,13 @@ gtk_window_activate_mnemonic (GtkWindow *window,
GtkWidget *widget, *chosen_widget;
gboolean overloaded;
- g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
- if (modifier != window->mnemonic_modifier)
+ if (window->mnemonic_modifier != (modifier & gtk_accelerator_get_default_mod_mask ()))
return FALSE;
key.window = window;
key.keyval = keyval;
-
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key);
if (!mnemonic)
@@ -953,9 +923,11 @@ gtk_window_activate_mnemonic (GtkWindow *window,
if (chosen_widget)
{
/* For round robin we put the activated entry on
- * the end of the list after activation */
+ * the end of the list after activation
+ */
mnemonic->targets = g_slist_remove (mnemonic->targets, chosen_widget);
mnemonic->targets = g_slist_append (mnemonic->targets, chosen_widget);
+
return gtk_widget_activate_mnemonic (chosen_widget, overloaded);
}
return FALSE;
@@ -965,8 +937,8 @@ void
gtk_window_set_mnemonic_modifier (GtkWindow *window,
GdkModifierType modifier)
{
- g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
+ g_return_if_fail ((modifier & ~GDK_MODIFIER_MASK) == 0);
window->mnemonic_modifier = modifier;
}
@@ -975,7 +947,6 @@ void
gtk_window_set_position (GtkWindow *window,
GtkWindowPosition position)
{
- g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
window->position = position;
@@ -1539,6 +1510,14 @@ gtk_window_mnemonic_hash_remove (gpointer key,
if (mnemonic->window == window)
{
+ if (mnemonic->targets)
+ {
+ gchar *name = gtk_accelerator_name (mnemonic->keyval, 0);
+
+ g_warning ("mnemonic \"%s\" wasn't removed for widget (%p)",
+ name, mnemonic->targets->data);
+ g_free (name);
+ }
g_slist_free (mnemonic->targets);
g_free (mnemonic);
@@ -2064,12 +2043,9 @@ gtk_window_key_press_event (GtkWidget *widget,
handled = FALSE;
- if (window->focus_widget &&
- window->focus_widget != widget &&
+ if (window->focus_widget && window->focus_widget != widget &&
GTK_WIDGET_IS_SENSITIVE (window->focus_widget))
- {
- handled = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
- }
+ handled = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
if (!handled)
handled = gtk_window_activate_mnemonic (window,
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 0de5aa5e6..04e015c85 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -174,9 +174,6 @@ void gtk_window_set_modal (GtkWindow *window,
gboolean modal);
GList* gtk_window_list_toplevels (void);
-/* Get the "built-in" accel group (convenience thing) */
-GtkAccelGroup* gtk_window_get_default_accel_group (GtkWindow *window);
-
void gtk_window_add_mnemonic (GtkWindow *window,
guint keyval,
GtkWidget *target);
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 49c405b0d..b44d880c6 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -166,12 +166,8 @@ create_buttons (void)
if (!window)
{
- GtkAccelGroup *accel_group;
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- accel_group = gtk_window_get_default_accel_group (GTK_WINDOW (window));
-
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 49c405b0d..b44d880c6 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -166,12 +166,8 @@ create_buttons (void)
if (!window)
{
- GtkAccelGroup *accel_group;
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- accel_group = gtk_window_get_default_accel_group (GTK_WINDOW (window));
-
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window);