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.
This commit is contained in:
Tim Janik 2001-03-22 13:44:00 +00:00 committed by Tim Janik
parent 6e58fd1ee3
commit c2c98d9e12
25 changed files with 497 additions and 349 deletions

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -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> 2001-03-22 Havoc Pennington <hp@pobox.com>
* gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in * gtk/gtktoolbar.c (gtk_toolbar_insert_stock): handle mnemonics in

View File

@ -445,24 +445,6 @@ The position of the cursor.
</para> </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 ##### --> <!-- ##### ENUM GtkFontFilterType ##### -->
<para> <para>
A set of bit flags used to specify the filter being set 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:
@tentative_match_len: @tentative_match_len:
<!-- ##### ARG GtkLabel:accel-keyval ##### -->
<para>
</para>
<!-- ##### ARG GtkObject:object-signal ##### --> <!-- ##### ARG GtkObject:object-signal ##### -->
<para> <para>
Setting this with a GtkType of GTK_TYPE_SIGNAL connects 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_width: minimum default width for child buttons.
@min_height: minimum default height 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 ##### --> <!-- ##### FUNCTION gtk_clist_construct ##### -->
<para> <para>
Initializes a previously allocated #GtkCList widget for use. This should not 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. @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 ##### --> <!-- ##### FUNCTION gtk_object_arg_get ##### -->
<para> <para>
Private function to get an argument and argument info from an object. Private function to get an argument and argument info from an object.
@ -1056,20 +1087,6 @@ Internal function.
@ruler: the gtkruler @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 ##### --> <!-- ##### FUNCTION gtk_signal_add_emission_hook_full ##### -->
<para> <para>
Add an emission hook for a type of signal, for any object. 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. @object: the object whose signal handlers should be destroyed.
<!-- ##### FUNCTION gtk_signal_init ##### -->
<para>
</para>
<!-- ##### FUNCTION gtk_signal_n_emissions ##### --> <!-- ##### FUNCTION gtk_signal_n_emissions ##### -->
<para> <para>
Find out the recursion depth of emissions for a particular type 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. which contains all the information, or NULL.
The pointer is allocated just for you: you must g_free() it. 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 ##### --> <!-- ##### FUNCTION gtk_signal_set_funcs ##### -->
<para> <para>
These set default functions to call when the user didn't 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. fundamental type.
@varargs_type: Must be a GtkType which is either structured or flag, or NONE. @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:

View File

@ -45,26 +45,6 @@ text.
@Returns: The newly created #GtkButton widget. @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 ##### --> <!-- ##### FUNCTION gtk_button_pressed ##### -->
<para> <para>
Emits a #GtkButton::pressed signal to the given #GtkButton. Emits a #GtkButton::pressed signal to the given #GtkButton.

View File

@ -76,6 +76,8 @@ GtkItemFactory
@callback: @callback:
@callback_action: @callback_action:
@item_type: @item_type:
@extra_data:
@extra_data2:
<!-- ##### STRUCT GtkItemFactoryItem ##### --> <!-- ##### STRUCT GtkItemFactoryItem ##### -->
<para> <para>

View File

@ -64,16 +64,6 @@ gtk_label_set_pattern().
@str: @str:
<!-- ##### FUNCTION gtk_label_set_markup_with_accel ##### -->
<para>
</para>
@label:
@str:
@Returns:
<!-- ##### FUNCTION gtk_label_set_pattern ##### --> <!-- ##### FUNCTION gtk_label_set_pattern ##### -->
<para> <para>
The pattern of underlines you want under the existing text within the The pattern of underlines you want under the existing text within the
@ -183,7 +173,12 @@ pointer, it isn't copied.
</para> </para>
<!-- ##### ARG GtkLabel:accel-keyval ##### --> <!-- ##### ARG GtkLabel:mnemonic-keyval ##### -->
<para>
</para>
<!-- ##### ARG GtkLabel:mnemonic-widget ##### -->
<para> <para>
</para> </para>

View File

@ -171,24 +171,6 @@ Set the #GtkAccelGroup which holds global accelerators for the menu.
@Returns: @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 ##### --> <!-- ##### FUNCTION gtk_menu_set_title ##### -->
<para> <para>
Sets the title string for the menu. The title is displayed when the menu Sets the title string for the menu. The title is displayed when the menu

View File

@ -157,6 +157,25 @@ you might have to write a marshaller.
@field: @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 ##### --> <!-- ##### ENUM GtkSignalRunType ##### -->
<para> <para>
These configure the signal's emission. They control These configure the signal's emission. They control
@ -232,6 +251,13 @@ to the signal.
@GTK_RUN_ACTION: @GTK_RUN_ACTION:
@GTK_RUN_NO_HOOKS: @GTK_RUN_NO_HOOKS:
<!-- ##### FUNCTION gtk_signal_init ##### -->
<para>
</para>
<!-- ##### FUNCTION gtk_signal_new ##### --> <!-- ##### FUNCTION gtk_signal_new ##### -->
<para> <para>
Create a new signal type. (This is usually done in the Create a new signal type. (This is usually done in the
@ -289,7 +315,7 @@ you don't want a return value.
the callbacks. the callbacks.
<!-- ##### MACRO gtk_signal_lookup ##### --> <!-- ##### FUNCTION gtk_signal_lookup ##### -->
<para> <para>
Given the name of the signal and the type of object it connects Given the name of the signal and the type of object it connects
to, get the signal's identifying integer. Emitting the signal 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. It also tries the ancestors of the given type.
</para> </para>
@Returns: the signal's identifying number, or 0 if no signal was found.
<!-- # Unused Parameters # -->
@name: the signal's name, e.g. clicked. @name: the signal's name, e.g. clicked.
@object_type: the type that the signal operates on, e.g. #GTK_TYPE_BUTTON. @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> <para>
Given the signal's identifier, find its name. Given the signal's identifier, find its name.
</para> </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. Two different signals may have the same name, if they have differing types.
</para> </para>
@Returns: the signal name, or NULL if the signal number was invalid.
<!-- # Unused Parameters # -->
@signal_id: the signal's identifying number. @signal_id: the signal's identifying number.
@Returns: the signal name, or NULL if the signal number was invalid.
<!-- ##### FUNCTION gtk_signal_emit ##### --> <!-- ##### 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. followed by one which is a pointer to the return type.
<!-- ##### MACRO gtk_signal_emit_stop ##### --> <!-- ##### FUNCTION gtk_signal_emit_stop ##### -->
<para> <para>
This function aborts a signal's current emission. This function aborts a signal's current emission.
</para> </para>
@ -397,11 +421,11 @@ It will print a warning if used on a signal which
isn't being emitted. isn't being emitted.
</para> </para>
@i:
@s:
<!-- # Unused Parameters # -->
@object: the object whose signal handlers you wish to stop. @object: the object whose signal handlers you wish to stop.
@signal_id: the signal identifier, as returned by gtk_signal_lookup(). @signal_id: the signal identifier, as returned by gtk_signal_lookup().
<!-- # Unused Parameters # -->
@i:
@s:
<!-- ##### FUNCTION gtk_signal_emit_stop_by_name ##### --> <!-- ##### 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. @name: the name of the signal you wish to stop.
<!-- ##### MACRO gtk_signal_connect ##### --> <!-- ##### FUNCTION gtk_signal_connect ##### -->
<para> <para>
Attach a function pointer and user data to a signal for Attach a function pointer and user data to a signal for
a particular object. a particular object.
@ -456,38 +480,38 @@ static void attach_print_signal(GtkButton* button, gint to_print)
</programlisting> </programlisting>
</informalexample> </informalexample>
@o:
@s:
@f:
@d:
@Returns: the connection id.
<!-- # Unused Parameters # -->
@object: the object associated with the signal, e.g. if a button @object: the object associated with the signal, e.g. if a button
is getting pressed, this is that button. is getting pressed, this is that button.
@name: name of the signal. @name: name of the signal.
@func: function pointer to attach to the signal. @func: function pointer to attach to the signal.
@func_data: value to pass as to your function (through the marshaller). @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> <para>
Attach a function pointer and user data to a signal Attach a function pointer and user data to a signal
so that this handler will be called after the other handlers. so that this handler will be called after the other handlers.
</para> </para>
@o:
@s:
@f:
@d:
@Returns: the unique identifier for this attachment: the connection id.
<!-- # Unused Parameters # -->
@object: the object associated with the signal. @object: the object associated with the signal.
@name: name of the signal. @name: name of the signal.
@func: function pointer to attach to the signal. @func: function pointer to attach to the signal.
@func_data: value to pass as to your function (through the marshaller). @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> <para>
This function is for registering a callback that will This function is for registering a callback that will
call another object's callback. That is, call another object's callback. That is,
@ -508,21 +532,21 @@ gtk_signal_connect_object(button, "clicked", gtk_widget_show, window);
</programlisting> </programlisting>
</informalexample> </informalexample>
@o:
@s:
@f:
@d:
@Returns: the connection id.
<!-- # Unused Parameters # -->
@object: the object which emits the signal. @object: the object which emits the signal.
@name: the name of the signal. @name: the name of the signal.
@func: the function to callback. @func: the function to callback.
@slot_object: the object to pass as the first parameter to func. @slot_object: the object to pass as the first parameter to func.
(Though it pretends to take an object, you can (Though it pretends to take an object, you can
really pass any gpointer as the #slot_object .) 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> <para>
Attach a signal hook to a signal, passing in an alternate Attach a signal hook to a signal, passing in an alternate
object as the first parameter, and guaranteeing object as the first parameter, and guaranteeing
@ -530,16 +554,16 @@ that the default handler and all normal
handlers are called first. handlers are called first.
</para> </para>
@o:
@s:
@f:
@d:
@Returns: the connection id.
<!-- # Unused Parameters # -->
@object: the object associated with the signal. @object: the object associated with the signal.
@name: name of the signal. @name: name of the signal.
@func: function pointer to attach to the signal. @func: function pointer to attach to the signal.
@slot_object: the object to pass as the first parameter to #func. @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 ##### --> <!-- ##### FUNCTION gtk_signal_connect_full ##### -->
@ -628,98 +652,95 @@ should signal the removal of this signal.
@name: name of the signal. @name: name of the signal.
<!-- ##### MACRO gtk_signal_disconnect ##### --> <!-- ##### FUNCTION gtk_signal_disconnect ##### -->
<para> <para>
Destroy a user-defined handler connection. Destroy a user-defined handler connection.
</para> </para>
<!-- # Unused Parameters # -->
@object: the object which the handler pertains to. @object: the object which the handler pertains to.
@handler_id: the connection id. @handler_id: the connection id.
<!-- ##### MACRO gtk_signal_disconnect_by_func ##### --> <!-- ##### FUNCTION gtk_signal_disconnect_by_func ##### -->
<para> <para>
Destroy all connections for a particular object, with Destroy all connections for a particular object, with
the given function-pointer and user-data. the given function-pointer and user-data.
</para> </para>
@o:
@f:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal. @object: the object which emits the signal.
@func: the function pointer to search for. @func: the function pointer to search for.
@data: the user data 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> <para>
Destroy all connections for a particular object, with Destroy all connections for a particular object, with
the given user-data. the given user-data.
</para> </para>
@o:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal. @object: the object which emits the signal.
@data: the user data to search for. @data: the user data to search for.
<!-- # Unused Parameters # -->
@o:
@d:
<!-- ##### MACRO gtk_signal_handler_block ##### --> <!-- ##### FUNCTION gtk_signal_handler_block ##### -->
<para> <para>
Prevent an user-defined handler from being invoked. All other Prevent an user-defined handler from being invoked. All other
signal processing will go on as normal, but this particular signal processing will go on as normal, but this particular
handler will ignore it. handler will ignore it.
</para> </para>
<!-- # Unused Parameters # -->
@object: the object which emits the signal to block. @object: the object which emits the signal to block.
@handler_id: the connection id. @handler_id: the connection id.
<!-- ##### MACRO gtk_signal_handler_block_by_func ##### --> <!-- ##### FUNCTION gtk_signal_handler_block_by_func ##### -->
<para> <para>
Prevent a user-defined handler from being invoked, by reference to 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 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.) multiple hooks being blocked, if you've called connect multiple times.)
</para> </para>
@o:
@f:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal to block. @object: the object which emits the signal to block.
@func: the function pointer of the handler to block. @func: the function pointer of the handler to block.
@data: the user data 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> <para>
Prevent all user-defined handlers with a certain user data from being invoked. Prevent all user-defined handlers with a certain user data from being invoked.
</para> </para>
@o:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to block. @object: the object which emits the signal we want to block.
@data: the user data of the handlers 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> <para>
Undo a block, by connection id. Note that undoing a block doesn't Undo a block, by connection id. Note that undoing a block doesn't
necessarily make the hook callable, because if you block a necessarily make the hook callable, because if you block a
hook twice, you must unblock it twice. hook twice, you must unblock it twice.
</para> </para>
<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock. @object: the object which emits the signal we want to unblock.
@handler_id: the emission handler identifier, as returned by @handler_id: the emission handler identifier, as returned by
gtk_signal_connect(), etc. gtk_signal_connect(), etc.
<!-- ##### MACRO gtk_signal_handler_unblock_by_func ##### --> <!-- ##### FUNCTION gtk_signal_handler_unblock_by_func ##### -->
<para> <para>
Undo a block, by function pointer and data. Undo a block, by function pointer and data.
Note that undoing a block doesn't 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. hook twice, you must unblock it twice.
</para> </para>
@o:
@f:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock. @object: the object which emits the signal we want to unblock.
@func: the function pointer to search for. @func: the function pointer to search for.
@data: the user data 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> <para>
Undo block(s), to all signals for a particular object Undo block(s), to all signals for a particular object
with a particular user-data pointer with a particular user-data pointer
</para> </para>
@o:
@d:
<!-- # Unused Parameters # -->
@object: the object which emits the signal we want to unblock. @object: the object which emits the signal we want to unblock.
@data: the user data to search for. @data: the user data to search for.
<!-- # Unused Parameters # -->
@o:
@d:
<!-- ##### MACRO gtk_signal_handler_pending ##### --> <!-- ##### FUNCTION gtk_signal_handler_pending ##### -->
<para> <para>
Returns a connection id corresponding to a given signal id and object. Returns a connection id corresponding to a given signal id and object.
</para> </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. thus saving the cost of building the arguments.
</para> </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. @object: the object to search for the desired user-defined handler.
@signal_id: the number of the signal to search for. @signal_id: the number of the signal to search for.
@may_be_blocked: whether it is acceptable to return a blocked @may_be_blocked: whether it is acceptable to return a blocked
handler. 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> <para>
Returns a connection id corresponding to a given signal id, object, function Returns a connection id corresponding to a given signal id, object, function
pointer and user data. pointer and user data.
</para> </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. @object: the object to search for the desired handler.
@signal_id: the number of the signal to search for. @signal_id: the number of the signal to search for.
@may_be_blocked: whether it is acceptable to return a blocked @may_be_blocked: whether it is acceptable to return a blocked
handler. handler.
@func: the function pointer to search for. @func: the function pointer to search for.
@data: the user data 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 ##### --> <!-- ##### MACRO gtk_signal_default_marshaller ##### -->

View File

@ -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. @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>
</para> </para>
@Returns: a pointer to the name of a type, or NULL if it has none.
<!-- # Unused Parameters # -->
@type: a GtkType @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> <para>
Get the internal representation of a type given its name. Get the internal representation of a type given its name.
</para> </para>
@Returns: a GtkType
<!-- # Unused Parameters # -->
@name: the name of a gtk type @name: the name of a gtk type
@Returns: a GtkType
<!-- ##### MACRO gtk_type_parent ##### --> <!-- ##### FUNCTION gtk_type_parent ##### -->
<para> <para>
</para> </para>
@Returns: the GtkType of the parent
<!-- # Unused Parameters # -->
@type: a GtkType @type: a GtkType
@Returns: the GtkType of the parent
<!-- ##### FUNCTION gtk_type_class ##### --> <!-- ##### FUNCTION gtk_type_class ##### -->
@ -611,16 +608,15 @@ has all the proper initializers called.
@Returns: gpointer to a GtkTypeObject @Returns: gpointer to a GtkTypeObject
<!-- ##### MACRO gtk_type_is_a ##### --> <!-- ##### FUNCTION gtk_type_is_a ##### -->
<para> <para>
Look in the type hierarchy to see if @type has @is_a_type among its 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. ancestors. Do so with a simple lookup, not a loop.
</para> </para>
@Returns:
<!-- # Unused Parameters # -->
@type: GtkType @type: GtkType
@is_a_type: GtkType @is_a_type: GtkType
@Returns:
<!-- ##### FUNCTION gtk_type_enum_get_values ##### --> <!-- ##### FUNCTION gtk_type_enum_get_values ##### -->

View File

@ -1247,6 +1247,15 @@ GtkWidget
@Returns: @Returns:
<!-- ##### SIGNAL GtkWidget::activate-mnemonic ##### -->
<para>
</para>
@widget: the object which received the signal.
@arg1:
@Returns:
<!-- ##### SIGNAL GtkWidget::add-accelerator ##### --> <!-- ##### SIGNAL GtkWidget::add-accelerator ##### -->
<para> <para>

View File

@ -236,15 +236,6 @@ it's larger
@Returns: @Returns:
<!-- ##### FUNCTION gtk_window_get_default_accel_group ##### -->
<para>
</para>
@window:
@Returns:
<!-- ##### SIGNAL GtkWindow::frame-event ##### --> <!-- ##### SIGNAL GtkWindow::frame-event ##### -->
<para> <para>

View File

@ -54,7 +54,8 @@ enum {
PROP_PATTERN, PROP_PATTERN,
PROP_WRAP, PROP_WRAP,
PROP_SELECTABLE, PROP_SELECTABLE,
PROP_MNEMONIC_KEYVAL PROP_MNEMONIC_KEYVAL,
PROP_MNEMONIC_WIDGET
}; };
static void gtk_label_class_init (GtkLabelClass *klass); static void gtk_label_class_init (GtkLabelClass *klass);
@ -67,6 +68,7 @@ static void gtk_label_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gtk_label_destroy (GtkObject *object);
static void gtk_label_finalize (GObject *object); static void gtk_label_finalize (GObject *object);
static void gtk_label_size_request (GtkWidget *widget, static void gtk_label_size_request (GtkWidget *widget,
GtkRequisition *requisition); GtkRequisition *requisition);
@ -158,11 +160,8 @@ static void
gtk_label_class_init (GtkLabelClass *class) gtk_label_class_init (GtkLabelClass *class)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkObjectClass *object_class; GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
parent_class = gtk_type_class (GTK_TYPE_MISC); parent_class = gtk_type_class (GTK_TYPE_MISC);
@ -170,6 +169,8 @@ gtk_label_class_init (GtkLabelClass *class)
gobject_class->get_property = gtk_label_get_property; gobject_class->get_property = gtk_label_get_property;
gobject_class->finalize = gtk_label_finalize; gobject_class->finalize = gtk_label_finalize;
object_class->destroy = gtk_label_destroy;
widget_class->size_request = gtk_label_size_request; widget_class->size_request = gtk_label_size_request;
widget_class->size_allocate = gtk_label_size_allocate; widget_class->size_allocate = gtk_label_size_allocate;
widget_class->style_set = gtk_label_style_set; widget_class->style_set = gtk_label_style_set;
@ -248,13 +249,20 @@ gtk_label_class_init (GtkLabelClass *class)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_MNEMONIC_KEYVAL, PROP_MNEMONIC_KEYVAL,
g_param_spec_uint ("mnemonic_keyval", g_param_spec_uint ("mnemonic_keyval",
_("Mnemonic accelerator key value"), _("Mnemonic key"),
_("The mnemonic accelerator key for this label."), _("The mnemonic accelerator key for this label."),
0, 0,
G_MAXUINT, G_MAXUINT,
GDK_VoidSymbol, GDK_VoidSymbol,
G_PARAM_READABLE)); 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 static void
@ -297,6 +305,9 @@ gtk_label_set_property (GObject *object,
case PROP_SELECTABLE: case PROP_SELECTABLE:
gtk_label_set_selectable (label, g_value_get_boolean (value)); gtk_label_set_selectable (label, g_value_get_boolean (value));
break; break;
case PROP_MNEMONIC_WIDGET:
gtk_label_set_mnemonic_widget (label, (GtkWidget*) g_value_get_object (value));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -339,6 +350,9 @@ gtk_label_get_property (GObject *object,
case PROP_MNEMONIC_KEYVAL: case PROP_MNEMONIC_KEYVAL:
g_value_set_uint (value, label->mnemonic_keyval); g_value_set_uint (value, label->mnemonic_keyval);
break; break;
case PROP_MNEMONIC_WIDGET:
g_value_set_object (value, (GObject*) label->mnemonic_widget);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -425,10 +439,9 @@ gtk_label_activate_mnemonic (GtkWidget *widget,
if (GTK_LABEL (widget)->mnemonic_widget) if (GTK_LABEL (widget)->mnemonic_widget)
return gtk_widget_activate_mnemonic (GTK_LABEL (widget)->mnemonic_widget, group_cycling); return gtk_widget_activate_mnemonic (GTK_LABEL (widget)->mnemonic_widget, group_cycling);
/* Try to find the widget to activate by traversing the widget /* Try to find the widget to activate by traversing the
* hierarachy. * widget's ancestry.
*/ */
parent = widget->parent; parent = widget->parent;
while (parent) while (parent)
{ {
@ -440,6 +453,7 @@ gtk_label_activate_mnemonic (GtkWidget *widget,
parent = parent->parent; parent = parent->parent;
} }
/* barf if there was nothing to activate */
g_warning ("Couldn't find a target for a mnemonic activation."); g_warning ("Couldn't find a target for a mnemonic activation.");
gdk_beep (); gdk_beep ();
@ -447,11 +461,12 @@ gtk_label_activate_mnemonic (GtkWidget *widget,
} }
static void static void
gtk_label_setup_mnemonic (GtkLabel *label, guint last_key) gtk_label_setup_mnemonic (GtkLabel *label,
guint last_key)
{ {
GtkWidget *toplevel; 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, gtk_window_remove_mnemonic (label->mnemonic_window,
last_key, last_key,
GTK_WIDGET (label)); GTK_WIDGET (label));
@ -503,9 +518,14 @@ gtk_label_set_mnemonic_widget (GtkLabel *label,
GtkWidget *widget) GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_LABEL (label)); g_return_if_fail (GTK_IS_LABEL (label));
if (widget)
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (label->mnemonic_widget)
gtk_widget_unref (label->mnemonic_widget);
label->mnemonic_widget = 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 /* Calculates text, attrs and mnemonic_keyval from
* label, use_underline and use_markup */ * label, use_underline and use_markup
*/
static void static void
gtk_label_recalculate (GtkLabel *label) gtk_label_recalculate (GtkLabel *label)
{ {
@ -604,6 +625,7 @@ gtk_label_recalculate (GtkLabel *label)
if (!label->use_underline) if (!label->use_underline)
{ {
guint keyval = label->mnemonic_keyval; guint keyval = label->mnemonic_keyval;
label->mnemonic_keyval = GDK_VoidSymbol; label->mnemonic_keyval = GDK_VoidSymbol;
gtk_label_setup_mnemonic (label, keyval); gtk_label_setup_mnemonic (label, keyval);
} }
@ -873,6 +895,16 @@ gtk_label_get (GtkLabel *label,
*str = label->text; *str = label->text;
} }
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 static void
gtk_label_finalize (GObject *object) gtk_label_finalize (GObject *object)
{ {
@ -1497,6 +1529,7 @@ window_to_layout_coords (GtkLabel *label,
} }
} }
#if 0
static void static void
layout_to_window_coords (GtkLabel *label, layout_to_window_coords (GtkLabel *label,
gint *x, gint *x,
@ -1522,6 +1555,7 @@ layout_to_window_coords (GtkLabel *label,
*y -= widget->allocation.y; /* go to selection window */ *y -= widget->allocation.y; /* go to selection window */
} }
} }
#endif
static void static void
get_layout_index (GtkLabel *label, get_layout_index (GtkLabel *label,

View File

@ -80,42 +80,34 @@ struct _GtkLabelClass
}; };
GtkType gtk_label_get_type (void) G_GNUC_CONST; GtkType gtk_label_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_label_new (const char *str); GtkWidget* gtk_label_new (const char *str);
GtkWidget *gtk_label_new_with_mnemonic (const char *str); GtkWidget* gtk_label_new_with_mnemonic (const char *str);
void gtk_label_set_text (GtkLabel *label, void gtk_label_set_text (GtkLabel *label,
const char *str); const char *str);
G_CONST_RETURN gchar *gtk_label_get_text (GtkLabel *label); G_CONST_RETURN gchar* gtk_label_get_text (GtkLabel *label);
void gtk_label_set_attributes (GtkLabel *label, void gtk_label_set_attributes (GtkLabel *label,
PangoAttrList *attrs); PangoAttrList *attrs);
void gtk_label_set_markup (GtkLabel *label, void gtk_label_set_markup (GtkLabel *label,
const gchar *str); const gchar *str);
void gtk_label_set_markup_with_mnemonic (GtkLabel *label, void gtk_label_set_markup_with_mnemonic (GtkLabel *label,
const gchar *str); const gchar *str);
guint gtk_label_get_mnemonic_keyval (GtkLabel *label); 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, void gtk_label_set_justify (GtkLabel *label,
GtkJustification jtype); GtkJustification jtype);
void gtk_label_set_pattern (GtkLabel *label, void gtk_label_set_pattern (GtkLabel *label,
const gchar *pattern); const gchar *pattern);
void gtk_label_set_line_wrap (GtkLabel *label, void gtk_label_set_line_wrap (GtkLabel *label,
gboolean wrap); 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, void gtk_label_set_selectable (GtkLabel *label,
gboolean setting); gboolean setting);
gboolean gtk_label_get_selectable (GtkLabel *label); gboolean gtk_label_get_selectable (GtkLabel *label);
void gtk_label_select_region (GtkLabel *label, void gtk_label_select_region (GtkLabel *label,
gint start_offset, gint start_offset,
gint end_offset); gint end_offset);
void gtk_label_get_layout_offsets (GtkLabel *label, void gtk_label_get_layout_offsets (GtkLabel *label,
gint *x, gint *x,
gint *y); gint *y);

View File

@ -3638,18 +3638,17 @@ gtk_notebook_activate_mnemonic_switch_page (GtkWidget *child,
gpointer data) gpointer data)
{ {
GtkNotebook *notebook = GTK_NOTEBOOK (data); GtkNotebook *notebook = GTK_NOTEBOOK (data);
GtkNotebookPage *page;
GList *list; GList *list;
list = g_list_find_custom (notebook->children, child, list = g_list_find_custom (notebook->children, child,
gtk_notebook_page_compare_tab); gtk_notebook_page_compare_tab);
if (!list) if (list)
return TRUE; {
GtkNotebookPage *page = list->data;
page = list->data;
gtk_notebook_switch_page (notebook, page, -1); gtk_notebook_switch_page (notebook, page, -1);
}
return TRUE; return TRUE;
} }

View File

@ -252,6 +252,22 @@ gtk_widget_get_type (void)
return widget_type; 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: * gtk_widget_class_init:
* *
@ -465,10 +481,11 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_accel_group_create_remove (GTK_CLASS_TYPE (object_class), GTK_RUN_LAST, gtk_accel_group_create_remove (GTK_CLASS_TYPE (object_class), GTK_RUN_LAST,
GTK_SIGNAL_OFFSET (GtkWidgetClass, remove_accelerator)); GTK_SIGNAL_OFFSET (GtkWidgetClass, remove_accelerator));
widget_signals[ACTIVATE_MNEMONIC] = widget_signals[ACTIVATE_MNEMONIC] =
gtk_signal_new ("activate_mnemonic", g_signal_newc ("activate_mnemonic",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class), GTK_CLASS_TYPE (object_class),
GTK_RUN_LAST,
GTK_SIGNAL_OFFSET (GtkWidgetClass, activate_mnemonic), GTK_SIGNAL_OFFSET (GtkWidgetClass, activate_mnemonic),
accumulator_stop_handled_emission, NULL,
gtk_marshal_BOOLEAN__BOOLEAN, gtk_marshal_BOOLEAN__BOOLEAN,
GTK_TYPE_BOOL, 1, GTK_TYPE_BOOL, 1,
GTK_TYPE_BOOL); GTK_TYPE_BOOL);
@ -2191,15 +2208,16 @@ gboolean
gtk_widget_activate_mnemonic (GtkWidget *widget, gtk_widget_activate_mnemonic (GtkWidget *widget,
gboolean group_cycling) gboolean group_cycling)
{ {
gboolean handled = FALSE; gboolean handled;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
group_cycling = group_cycling != FALSE;
if (!GTK_WIDGET_IS_SENSITIVE (widget)) if (!GTK_WIDGET_IS_SENSITIVE (widget))
return TRUE; handled = TRUE;
else
gtk_signal_emit_by_name (GTK_OBJECT (widget), gtk_signal_emit (GTK_OBJECT (widget),
"activate_mnemonic", widget_signals[ACTIVATE_MNEMONIC],
group_cycling, group_cycling,
&handled); &handled);
return handled; return handled;
@ -2209,14 +2227,19 @@ static gboolean
gtk_widget_real_activate_mnemonic (GtkWidget *widget, gtk_widget_real_activate_mnemonic (GtkWidget *widget,
gboolean group_cycling) gboolean group_cycling)
{ {
if (group_cycling) if (!group_cycling && GTK_WIDGET_GET_CLASS (widget)->activate_signal)
gtk_widget_grab_focus (widget);
else if (!group_cycling)
gtk_widget_activate (widget); 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; return TRUE;
} }
static gint static gint
gtk_widget_real_key_press_event (GtkWidget *widget, gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)

View File

@ -55,11 +55,13 @@ typedef enum
GTK_HAS_FOCUS = 1 << 12, GTK_HAS_FOCUS = 1 << 12,
/* widget is allowed to receive the default via gtk_widget_grab_default /* 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, GTK_CAN_DEFAULT = 1 << 13,
/* the widget currently is receiving the default action and should be drawn /* 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_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15, GTK_HAS_GRAB = 1 << 15,
@ -69,7 +71,8 @@ typedef enum
GTK_APP_PAINTABLE = 1 << 19, GTK_APP_PAINTABLE = 1 << 19,
/* the widget when focused will receive the default action and have /* 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_RECEIVES_DEFAULT = 1 << 20,
GTK_DOUBLE_BUFFERED = 1 << 21 GTK_DOUBLE_BUFFERED = 1 << 21

View File

@ -822,29 +822,6 @@ gtk_window_remove_accel_group (GtkWindow *window,
gtk_accel_group_detach (accel_group, GTK_OBJECT (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 void
gtk_window_add_mnemonic (GtkWindow *window, gtk_window_add_mnemonic (GtkWindow *window,
guint keyval, guint keyval,
@ -853,17 +830,18 @@ gtk_window_add_mnemonic (GtkWindow *window,
GtkWindowMnemonic key; GtkWindowMnemonic key;
GtkWindowMnemonic *mnemonic; GtkWindowMnemonic *mnemonic;
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_IS_WIDGET (target)); g_return_if_fail (GTK_IS_WIDGET (target));
key.window = window; key.window = window;
key.keyval = keyval; key.keyval = keyval;
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key); mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key);
if (mnemonic) if (mnemonic)
{
g_return_if_fail (g_slist_find (mnemonic->targets, target) == NULL);
mnemonic->targets = g_slist_prepend (mnemonic->targets, target); mnemonic->targets = g_slist_prepend (mnemonic->targets, target);
}
else else
{ {
mnemonic = g_new (GtkWindowMnemonic, 1); mnemonic = g_new (GtkWindowMnemonic, 1);
@ -881,27 +859,21 @@ gtk_window_remove_mnemonic (GtkWindow *window,
GtkWindowMnemonic key; GtkWindowMnemonic key;
GtkWindowMnemonic *mnemonic; GtkWindowMnemonic *mnemonic;
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GTK_IS_WIDGET (target)); g_return_if_fail (GTK_IS_WIDGET (target));
key.window = window; key.window = window;
key.keyval = keyval; key.keyval = keyval;
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key); 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); mnemonic->targets = g_slist_remove (mnemonic->targets, target);
if (mnemonic->targets == NULL) if (mnemonic->targets == NULL)
{ {
g_hash_table_remove (mnemonic_hash_table, mnemonic); g_hash_table_remove (mnemonic_hash_table, mnemonic);
g_free (mnemonic); g_free (mnemonic);
} }
}
} }
gboolean gboolean
@ -915,15 +887,13 @@ gtk_window_activate_mnemonic (GtkWindow *window,
GtkWidget *widget, *chosen_widget; GtkWidget *widget, *chosen_widget;
gboolean overloaded; gboolean overloaded;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), 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; return FALSE;
key.window = window; key.window = window;
key.keyval = keyval; key.keyval = keyval;
mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key); mnemonic = g_hash_table_lookup (mnemonic_hash_table, &key);
if (!mnemonic) if (!mnemonic)
@ -953,9 +923,11 @@ gtk_window_activate_mnemonic (GtkWindow *window,
if (chosen_widget) if (chosen_widget)
{ {
/* For round robin we put the activated entry on /* 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_remove (mnemonic->targets, chosen_widget);
mnemonic->targets = g_slist_append (mnemonic->targets, chosen_widget); mnemonic->targets = g_slist_append (mnemonic->targets, chosen_widget);
return gtk_widget_activate_mnemonic (chosen_widget, overloaded); return gtk_widget_activate_mnemonic (chosen_widget, overloaded);
} }
return FALSE; return FALSE;
@ -965,8 +937,8 @@ void
gtk_window_set_mnemonic_modifier (GtkWindow *window, gtk_window_set_mnemonic_modifier (GtkWindow *window,
GdkModifierType modifier) GdkModifierType modifier)
{ {
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail ((modifier & ~GDK_MODIFIER_MASK) == 0);
window->mnemonic_modifier = modifier; window->mnemonic_modifier = modifier;
} }
@ -975,7 +947,6 @@ void
gtk_window_set_position (GtkWindow *window, gtk_window_set_position (GtkWindow *window,
GtkWindowPosition position) GtkWindowPosition position)
{ {
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window)); g_return_if_fail (GTK_IS_WINDOW (window));
window->position = position; window->position = position;
@ -1539,6 +1510,14 @@ gtk_window_mnemonic_hash_remove (gpointer key,
if (mnemonic->window == window) 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_slist_free (mnemonic->targets);
g_free (mnemonic); g_free (mnemonic);
@ -2064,12 +2043,9 @@ gtk_window_key_press_event (GtkWidget *widget,
handled = FALSE; handled = FALSE;
if (window->focus_widget && if (window->focus_widget && window->focus_widget != widget &&
window->focus_widget != widget &&
GTK_WIDGET_IS_SENSITIVE (window->focus_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) if (!handled)
handled = gtk_window_activate_mnemonic (window, handled = gtk_window_activate_mnemonic (window,

View File

@ -174,9 +174,6 @@ void gtk_window_set_modal (GtkWindow *window,
gboolean modal); gboolean modal);
GList* gtk_window_list_toplevels (void); 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, void gtk_window_add_mnemonic (GtkWindow *window,
guint keyval, guint keyval,
GtkWidget *target); GtkWidget *target);

View File

@ -166,12 +166,8 @@ create_buttons (void)
if (!window) if (!window)
{ {
GtkAccelGroup *accel_group;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 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_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed), GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window); &window);

View File

@ -166,12 +166,8 @@ create_buttons (void)
if (!window) if (!window)
{ {
GtkAccelGroup *accel_group;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 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_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed), GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window); &window);