Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>

Wed Mar 17 01:46:28 1999  Tim Janik  <timj@gtk.org>

        * merges from gtk-1-2:

Tue Mar 16 17:43:33 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
        item factory class has been created.
        (gtk_item_factory_parse_rc): likewise.

        * gtk/gtkmenu.c:
        keep proper references for old_active_menu_item.
        (gtk_menu_reparent): unset the usize of the new parent,
        so the menu can sanely be size requested and we don't get nasty screen
        artefacts upon next reparentation.
        (gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
        enter notify. only synthesize enter notifies if the pointer really is
        inside the event window.
        (gtk_menu_popdown): use gtk_menu_shell_deselect().
        (gtk_menu_popup): move the background setting stuff into
        gtk_menu_tearoff_bg_copy() so it can be called from other places as well.

        * gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
        gtk_menu_shell_select_item() to select the new item.
        (gtk_menu_shell_deselect): export this function, so gtkmenu.c can
        do the right thing for deselection as well.

Sat Mar 15 20:10:33 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkwidget.[hc]:
        (gtk_widget_accelerators_locked): return whether a widget's accelerators
        are locked.

        * gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
        existing accelerators if the widget's accelerators are locked.

Sat Mar 14 19:44:05 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.

        * gtk/gtkmenu.c: truely forward key press and key release events to
        the menu widget from the toplevel or tearoff window. we can't simply
        connect to that, we need to stop further processing of the events as
        well.

Sat Mar 13 13:14:17 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkmenu.c:
        (gtk_menu_key_press): pass event->keyval, event->state to
        gtk_accelerator_valid, instead of event->keyval twice.
        refuse to install single letter accelerators for menus that use
        single letter shortcuts.

        * gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
        gtk_menu_ensure_uline_accel_group().

        * gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
        which will always return an uline accel group, made
        gtk_menu_get_uline_accel_group() return NULL if the group isn't
        yet created.

Mon Mar 15 01:03:27 1999  Lars Hamann  <lars@gtk.org>

        * gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.

        * gtk/gtkclist.c (gtk_clist_column_title_passive):
        Leave button sensitive, trap  button_press, button_release,
        motion_notify, enter_notify and leave_notify events instead.
        (gtk_clist_column_title_active): disconnect event handler.
        (gtk_clist_drag_data_get): fixed memory leak. Reported by
        Guillaume Laurent <glaurent@worldnet.fr>

Wed Mar 10 23:49:55 1999  Lars Hamann  <lars@gtk.org>

        * gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
        width/height mixups.

        * gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
        if needed.

Wed Mar 10 00:11:32 1999  Tim Janik  <timj@gtk.org>

        * gtk/testgtk.c (create_item_factory): unref the item factory after
        window's destruction.

        * gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
        count on the menu shell around the menu item's activation, since the
        signal emission may cause menu shell destruction.

        * gtk/gtkitemfactory.c:
        the previous code leaked one accel group per menu. we use
        gtk_menu_get_uline_accel_group() now to fix that, and with that
        also create the underline accelerator group of the menus only if
        required (i.e. an underline accelerator has been specified).
        (gtk_item_factory_construct):
        (gtk_item_factory_create_item): removed code that would create an
        extra accel group for the menu (and leak references).
        (gtk_item_factory_create_item): adapted the underline accelerator
        installation code to properly feature gtk_menu_get_uline_accel_group().

        * gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
        menu->accel_group, this may return NULL if the accelerator group
        hasn't been set yet.
        added gtk_menu_get_uline_accel_group() to retrive the underline
        accelerator group of the menu, this will be created on demand
        and proper care is taken about its reference count.

        * gtk/gtkitemfactory.h:
        * gtk/gtkitemfactory.c:
        dumped the approach of keeping a widgets by action list on the
        factory since the factory<->widget destroy negotiation didn't work
        and would be hard to get going at all. instead we keep a list of
        GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
        persistant throughout a program's life time).
        also, i removed the static const gchar *key_* variables, and made
        them inline strings (they weren't actually used anyways).
        (gtk_item_factory_add_item): update ifactory->items.
        (gtk_item_factory_destroy): destroy ifactory->items (and remove
        the item factory pointer from the remaining ifactory widgets).
        (gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
        list to find the widget.
        (gtk_item_factory_get_item): new function that works around
        gtk_item_factory_get_widget() limitations, this function will only
        return menu items, even for <Branch> entries.

Tue Mar  9 01:01:28 1999  Tim Janik  <timj@gtk.org>

        * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
        font hash table, if we have a GdkFontPrivate entry for this font
        already, simply increment its reference count, provided by Olaf Dietsche
        <olaf.dietsche+list.gtk@netcologne.de>.

        * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
        provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.

Sun Mar  7 06:13:29 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.c:
        (gtk_container_add_with_args):
        (gtk_container_addv):
        (gtk_container_add): before adding a child to a conatiner, make sure
        it is (default) constructed, this is neccessary because under certain
        circumstances the child will get relized and mapped immediatedly, in
        which case it has to be constructed already.

Mon Mar  1 17:58:21 1999  Tim Janik  <timj@gtk.org>

        * gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
        values > 1 as TRUE also.
This commit is contained in:
Tim Janik 1999-03-17 01:39:42 +00:00 committed by Tim Janik
parent db30076b0b
commit f045ba415a
24 changed files with 1797 additions and 510 deletions

150
ChangeLog
View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -1,3 +1,153 @@
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-16 Tor Lillqvist <tml@iki.fi> 1999-03-16 Tor Lillqvist <tml@iki.fi>
* README.win32: New file. * README.win32: New file.

View File

@ -39,7 +39,7 @@
#define MAX_BUTTON 5 #define MAX_BUTTON 5
/* the number rows memchunk expands at a time */ /* the number rows memchunk expands at a time */
#define CLIST_OPTIMUM_SIZE 512 #define CLIST_OPTIMUM_SIZE 64
/* the width of the column resize windows */ /* the width of the column resize windows */
#define DRAG_WIDTH 6 #define DRAG_WIDTH 6
@ -443,6 +443,9 @@ static gboolean title_focus (GtkCList *clist,
static void real_row_move (GtkCList *clist, static void real_row_move (GtkCList *clist,
gint source_row, gint source_row,
gint dest_row); gint dest_row);
static gint column_title_passive_func (GtkWidget *widget,
GdkEvent *event,
gpointer data);
@ -1291,45 +1294,111 @@ void
gtk_clist_column_title_active (GtkCList *clist, gtk_clist_column_title_active (GtkCList *clist,
gint column) gint column)
{ {
GtkObject *object;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CLIST (clist));
if (column < 0 || column >= clist->columns) if (column < 0 || column >= clist->columns)
return; return;
if (!clist->column[column].button) if (!clist->column[column].button || !clist->column[column].button_passive)
return; return;
if (!GTK_WIDGET_SENSITIVE (clist->column[column].button) || object = GTK_OBJECT (clist->column[column].button);
!GTK_WIDGET_CAN_FOCUS (clist->column[column].button))
{ clist->column[column].button_passive = FALSE;
GTK_WIDGET_SET_FLAGS (clist->column[column].button,
GTK_SENSITIVE | GTK_CAN_FOCUS); gtk_signal_disconnect_by_func (object,
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("button_press_event",
GTK_TYPE_WIDGET)));
gtk_signal_disconnect_by_func (object,
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("button_release_event",
GTK_TYPE_WIDGET)));
gtk_signal_disconnect_by_func (object,
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("motion_notify_event",
GTK_TYPE_WIDGET)));
gtk_signal_disconnect_by_func (object,
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("enter_notify_event",
GTK_TYPE_WIDGET)));
gtk_signal_disconnect_by_func (object,
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("leave_notify_event",
GTK_TYPE_WIDGET)));
GTK_WIDGET_SET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (clist)) if (GTK_WIDGET_VISIBLE (clist))
gtk_widget_queue_draw (clist->column[column].button); gtk_widget_queue_draw (clist->column[column].button);
} }
}
void void
gtk_clist_column_title_passive (GtkCList *clist, gtk_clist_column_title_passive (GtkCList *clist,
gint column) gint column)
{ {
GtkObject *object;
GtkButton *button;
g_return_if_fail (clist != NULL); g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (GTK_IS_CLIST (clist));
if (column < 0 || column >= clist->columns) if (column < 0 || column >= clist->columns)
return; return;
if (!clist->column[column].button) if (!clist->column[column].button || clist->column[column].button_passive)
return; return;
if (GTK_WIDGET_SENSITIVE (clist->column[column].button) || object = GTK_OBJECT (clist->column[column].button);
GTK_WIDGET_CAN_FOCUS (clist->column[column].button)) button = GTK_BUTTON (clist->column[column].button);
{
GTK_WIDGET_UNSET_FLAGS (clist->column[column].button, clist->column[column].button_passive = TRUE;
GTK_SENSITIVE | GTK_CAN_FOCUS);
gtk_signal_connect (object, "button_press_event",
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("button_press_event",
GTK_TYPE_WIDGET)));
if (button->button_down)
gtk_button_released (button);
gtk_signal_connect (object, "button_release_event",
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("button_release_event",
GTK_TYPE_WIDGET)));
gtk_signal_connect (object, "motion_notify_event",
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("motion_notify_event",
GTK_TYPE_WIDGET)));
gtk_signal_connect (object, "enter_notify_event",
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("enter_notify_event",
GTK_TYPE_WIDGET)));
if (button->in_button)
gtk_button_leave (button);
gtk_signal_connect (object, "leave_notify_event",
(GtkSignalFunc) column_title_passive_func,
GINT_TO_POINTER (gtk_signal_lookup
("leave_notify_event",
GTK_TYPE_WIDGET)));
GTK_WIDGET_UNSET_FLAGS (clist->column[column].button, GTK_CAN_FOCUS);
if (GTK_WIDGET_VISIBLE (clist)) if (GTK_WIDGET_VISIBLE (clist))
gtk_widget_queue_draw (clist->column[column].button); gtk_widget_queue_draw (clist->column[column].button);
} }
}
void void
gtk_clist_column_titles_active (GtkCList *clist) gtk_clist_column_titles_active (GtkCList *clist)
@ -1764,6 +1833,7 @@ gtk_clist_set_column_max_width (GtkCList *clist,
* new_column_width * new_column_width
* column_button_create * column_button_create
* column_button_clicked * column_button_clicked
* column_title_passive_func
*/ */
static void static void
column_auto_resize (GtkCList *clist, column_auto_resize (GtkCList *clist,
@ -2103,84 +2173,15 @@ column_button_clicked (GtkWidget *widget,
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[CLICK_COLUMN], i); gtk_signal_emit (GTK_OBJECT (clist), clist_signals[CLICK_COLUMN], i);
} }
void static gint
gtk_clist_set_row_height (GtkCList *clist, column_title_passive_func (GtkWidget *widget,
guint height) GdkEvent *event,
gpointer data)
{ {
GtkWidget *widget; gtk_signal_emit_stop (GTK_OBJECT (widget), GPOINTER_TO_INT (data));
return FALSE;
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
widget = GTK_WIDGET (clist);
if (height > 0)
{
clist->row_height = height;
GTK_CLIST_SET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
}
else
{
GTK_CLIST_UNSET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
clist->row_height = 0;
} }
if (GTK_WIDGET_REALIZED (clist))
{
if (!GTK_CLIST_ROW_HEIGHT_SET(clist))
{
clist->row_height = (widget->style->font->ascent +
widget->style->font->descent + 1);
clist->row_center_offset = widget->style->font->ascent + 1.5;
}
else
clist->row_center_offset = 1.5 + (clist->row_height +
widget->style->font->ascent -
widget->style->font->descent - 1) / 2;
}
CLIST_REFRESH (clist);
}
void
gtk_clist_moveto (GtkCList *clist,
gint row,
gint column,
gfloat row_align,
gfloat col_align)
{
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
if (row < -1 || row >= clist->rows)
return;
if (column < -1 || column >= clist->columns)
return;
row_align = CLAMP (row_align, 0, 1);
col_align = CLAMP (col_align, 0, 1);
/* adjust horizontal scrollbar */
if (clist->hadjustment && column >= 0)
{
gint x;
x = (COLUMN_LEFT (clist, column) - CELL_SPACING - COLUMN_INSET -
(col_align * (clist->clist_window_width - 2 * COLUMN_INSET -
CELL_SPACING - clist->column[column].area.width)));
if (x < 0)
gtk_adjustment_set_value (clist->hadjustment, 0.0);
else if (x > LIST_WIDTH (clist) - clist->clist_window_width)
gtk_adjustment_set_value
(clist->hadjustment, LIST_WIDTH (clist) - clist->clist_window_width);
else
gtk_adjustment_set_value (clist->hadjustment, x);
}
/* adjust vertical scrollbar */
if (clist->vadjustment && row >= 0)
move_vertical (clist, row, row_align);
}
/* PUBLIC CELL FUNCTIONS /* PUBLIC CELL FUNCTIONS
* gtk_clist_get_cell_type * gtk_clist_get_cell_type
@ -2934,6 +2935,8 @@ real_row_move (GtkCList *clist,
} }
/* PUBLIC ROW FUNCTIONS /* PUBLIC ROW FUNCTIONS
* gtk_clist_moveto
* gtk_clist_set_row_height
* gtk_clist_set_row_data * gtk_clist_set_row_data
* gtk_clist_set_row_data_full * gtk_clist_set_row_data_full
* gtk_clist_get_row_data * gtk_clist_get_row_data
@ -2944,6 +2947,85 @@ real_row_move (GtkCList *clist,
* gtk_clist_set_foreground * gtk_clist_set_foreground
* gtk_clist_set_background * gtk_clist_set_background
*/ */
void
gtk_clist_moveto (GtkCList *clist,
gint row,
gint column,
gfloat row_align,
gfloat col_align)
{
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
if (row < -1 || row >= clist->rows)
return;
if (column < -1 || column >= clist->columns)
return;
row_align = CLAMP (row_align, 0, 1);
col_align = CLAMP (col_align, 0, 1);
/* adjust horizontal scrollbar */
if (clist->hadjustment && column >= 0)
{
gint x;
x = (COLUMN_LEFT (clist, column) - CELL_SPACING - COLUMN_INSET -
(col_align * (clist->clist_window_width - 2 * COLUMN_INSET -
CELL_SPACING - clist->column[column].area.width)));
if (x < 0)
gtk_adjustment_set_value (clist->hadjustment, 0.0);
else if (x > LIST_WIDTH (clist) - clist->clist_window_width)
gtk_adjustment_set_value
(clist->hadjustment, LIST_WIDTH (clist) - clist->clist_window_width);
else
gtk_adjustment_set_value (clist->hadjustment, x);
}
/* adjust vertical scrollbar */
if (clist->vadjustment && row >= 0)
move_vertical (clist, row, row_align);
}
void
gtk_clist_set_row_height (GtkCList *clist,
guint height)
{
GtkWidget *widget;
g_return_if_fail (clist != NULL);
g_return_if_fail (GTK_IS_CLIST (clist));
widget = GTK_WIDGET (clist);
if (height > 0)
{
clist->row_height = height;
GTK_CLIST_SET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
}
else
{
GTK_CLIST_UNSET_FLAG (clist, CLIST_ROW_HEIGHT_SET);
clist->row_height = 0;
}
if (GTK_WIDGET_REALIZED (clist))
{
if (!GTK_CLIST_ROW_HEIGHT_SET(clist))
{
clist->row_height = (widget->style->font->ascent +
widget->style->font->descent + 1);
clist->row_center_offset = widget->style->font->ascent + 1.5;
}
else
clist->row_center_offset = 1.5 + (clist->row_height +
widget->style->font->ascent -
widget->style->font->descent - 1) / 2;
}
CLIST_REFRESH (clist);
}
void void
gtk_clist_set_row_data (GtkCList *clist, gtk_clist_set_row_data (GtkCList *clist,
gint row, gint row,
@ -6356,6 +6438,7 @@ columns_new (GtkCList *clist)
column[i].width_set = FALSE; column[i].width_set = FALSE;
column[i].resizeable = TRUE; column[i].resizeable = TRUE;
column[i].auto_resize = FALSE; column[i].auto_resize = FALSE;
column[i].button_passive = FALSE;
column[i].justification = GTK_JUSTIFY_LEFT; column[i].justification = GTK_JUSTIFY_LEFT;
} }
@ -7708,16 +7791,13 @@ gtk_clist_drag_data_get (GtkWidget *widget,
if (info) if (info)
{ {
GtkCListCellInfo *ret_info; GtkCListCellInfo ret_info;
ret_info = g_new (GtkCListCellInfo, 1); ret_info.row = info->row;
ret_info->row = info->row; ret_info.column = info->column;
ret_info->column = info->column;
gtk_selection_data_set (selection_data, gtk_selection_data_set (selection_data, selection_data->target,
selection_data->target, GTK_TYPE_POINTER, (guchar *) &ret_info,
GTK_TYPE_POINTER,
(guchar *) ret_info,
sizeof (GtkCListCellInfo)); sizeof (GtkCListCellInfo));
} }
else else

View File

@ -334,6 +334,7 @@ struct _GtkCListColumn
guint width_set : 1; guint width_set : 1;
guint resizeable : 1; guint resizeable : 1;
guint auto_resize : 1; guint auto_resize : 1;
guint button_passive : 1;
}; };
struct _GtkCListRow struct _GtkCListRow

View File

@ -264,6 +264,8 @@ gtk_container_add_with_args (GtkContainer *container,
gtk_widget_ref (GTK_WIDGET (container)); gtk_widget_ref (GTK_WIDGET (container));
gtk_widget_ref (widget); gtk_widget_ref (widget);
if (!GTK_OBJECT_CONSTRUCTED (widget))
gtk_object_default_construct (GTK_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
if (widget->parent) if (widget->parent)
@ -322,6 +324,8 @@ gtk_container_addv (GtkContainer *container,
gtk_widget_ref (GTK_WIDGET (container)); gtk_widget_ref (GTK_WIDGET (container));
gtk_widget_ref (widget); gtk_widget_ref (widget);
if (!GTK_OBJECT_CONSTRUCTED (widget))
gtk_object_default_construct (GTK_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
if (widget->parent) if (widget->parent)
@ -703,6 +707,8 @@ gtk_container_add (GtkContainer *container,
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (widget->parent == NULL); g_return_if_fail (widget->parent == NULL);
if (!GTK_OBJECT_CONSTRUCTED (widget))
gtk_object_default_construct (GTK_OBJECT (widget));
gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget); gtk_signal_emit (GTK_OBJECT (container), container_signals[ADD], widget);
} }

View File

@ -3065,24 +3065,7 @@ tree_delete (GtkCTree *ctree,
GtkCTreeNode *node, GtkCTreeNode *node,
gpointer data) gpointer data)
{ {
GtkCList *clist; tree_unselect (ctree, node, NULL);
clist = GTK_CLIST (ctree);
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
{
GList *work;
work = g_list_find (clist->selection, node);
if (work)
{
if (clist->selection_end && clist->selection_end == work)
clist->selection_end = clist->selection_end->prev;
clist->selection = g_list_remove_link (clist->selection, work);
g_list_free_1 (work);
}
}
row_delete (ctree, GTK_CTREE_ROW (node)); row_delete (ctree, GTK_CTREE_ROW (node));
g_list_free_1 ((GList *)node); g_list_free_1 ((GList *)node);
} }

View File

@ -32,6 +32,12 @@ extern "C" {
#define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@) #define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#define GTK_BINARY_AGE (@GTK_BINARY_AGE@) #define GTK_BINARY_AGE (@GTK_BINARY_AGE@)
#define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@) #define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@)
#define GTK_CHECK_VERSION(major,minor,micro) \
(GTK_MAJOR_VERSION > (major) || \
(GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION > (minor)) || \
(GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION == (minor) && \
GTK_MICRO_VERSION >= (micro)))
/* new gtk_container_set_focus_[hv]adjustment() /* new gtk_container_set_focus_[hv]adjustment()
*/ */

View File

@ -64,7 +64,6 @@
/* --- structures --- */ /* --- structures --- */
typedef struct _GtkIFCBData GtkIFCBData; typedef struct _GtkIFCBData GtkIFCBData;
typedef struct _GtkIFActionLink GtkIFActionLink;
typedef struct _GtkIFDumpData GtkIFDumpData; typedef struct _GtkIFDumpData GtkIFDumpData;
struct _GtkIFCBData struct _GtkIFCBData
{ {
@ -73,11 +72,6 @@ struct _GtkIFCBData
gpointer func_data; gpointer func_data;
guint callback_action; guint callback_action;
}; };
struct _GtkIFActionLink
{
GtkWidget *widget;
guint callback_action;
};
struct _GtkIFDumpData struct _GtkIFDumpData
{ {
GtkPrintFunc print_func; GtkPrintFunc print_func;
@ -100,31 +94,20 @@ static GtkObjectClass *parent_class = NULL;
static const gchar *item_factory_string = "Gtk-<ItemFactory>"; static const gchar *item_factory_string = "Gtk-<ItemFactory>";
static GMemChunk *ifactory_item_chunks = NULL; static GMemChunk *ifactory_item_chunks = NULL;
static GMemChunk *ifactory_cb_data_chunks = NULL; static GMemChunk *ifactory_cb_data_chunks = NULL;
static const gchar *key_popup_data = "GtkItemFactory-popup-data";
static GQuark quark_popup_data = 0; static GQuark quark_popup_data = 0;
static const gchar *key_if_menu_pos = "GtkItemFactory-menu-position";
static GQuark quark_if_menu_pos = 0; static GQuark quark_if_menu_pos = 0;
static const gchar *key_item_factory = "GtkItemFactory";
static GQuark quark_item_factory = 0; static GQuark quark_item_factory = 0;
static const gchar *key_item_factory_path = "GtkItemFactory-path"; static GQuark quark_item_path = 0;
static GQuark quark_item_factory_path = 0; static GQuark quark_action = 0;
static const gchar *key_type_item = "<Item>"; static GQuark quark_accel_group = 0;
static GQuark quark_type_item = 0; static GQuark quark_type_item = 0;
static const gchar *key_type_title = "<Title>";
static GQuark quark_type_title = 0; static GQuark quark_type_title = 0;
static const gchar *key_type_radio_item = "<RadioItem>";
static GQuark quark_type_radio_item = 0; static GQuark quark_type_radio_item = 0;
static const gchar *key_type_check_item = "<CheckItem>";
static GQuark quark_type_check_item = 0; static GQuark quark_type_check_item = 0;
static const gchar *key_type_toggle_item = "<ToggleItem>";
static GQuark quark_type_toggle_item = 0; static GQuark quark_type_toggle_item = 0;
static const gchar *key_type_tearoff_item = "<Tearoff>";
static GQuark quark_type_tearoff_item = 0; static GQuark quark_type_tearoff_item = 0;
static const gchar *key_type_separator_item = "<Separator>";
static GQuark quark_type_separator_item = 0; static GQuark quark_type_separator_item = 0;
static const gchar *key_type_branch = "<Branch>";
static GQuark quark_type_branch = 0; static GQuark quark_type_branch = 0;
static const gchar *key_type_last_branch = "<LastBranch>";
static GQuark quark_type_last_branch = 0; static GQuark quark_type_last_branch = 0;
static GScannerConfig ifactory_scanner_config = static GScannerConfig ifactory_scanner_config =
{ {
@ -212,6 +195,7 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
class->cpair_comment_single = g_strdup (";\n"); class->cpair_comment_single = g_strdup (";\n");
class->item_ht = g_hash_table_new (g_str_hash, g_str_equal); class->item_ht = g_hash_table_new (g_str_hash, g_str_equal);
class->dummy = NULL;
ifactory_item_chunks = ifactory_item_chunks =
g_mem_chunk_new ("GtkItemFactoryItem", g_mem_chunk_new ("GtkItemFactoryItem",
sizeof (GtkItemFactoryItem), sizeof (GtkItemFactoryItem),
@ -223,19 +207,21 @@ gtk_item_factory_class_init (GtkItemFactoryClass *class)
sizeof (GtkIFCBData) * ITEM_BLOCK_SIZE, sizeof (GtkIFCBData) * ITEM_BLOCK_SIZE,
G_ALLOC_AND_FREE); G_ALLOC_AND_FREE);
quark_popup_data = g_quark_from_static_string (key_popup_data); quark_popup_data = g_quark_from_static_string ("GtkItemFactory-popup-data");
quark_if_menu_pos = g_quark_from_static_string (key_if_menu_pos); quark_if_menu_pos = g_quark_from_static_string ("GtkItemFactory-menu-position");
quark_item_factory = g_quark_from_static_string (key_item_factory); quark_item_factory = g_quark_from_static_string ("GtkItemFactory");
quark_item_factory_path = g_quark_from_static_string (key_item_factory_path); quark_item_path = g_quark_from_static_string ("GtkItemFactory-path");
quark_type_item = g_quark_from_static_string (key_type_item); quark_action = g_quark_from_static_string ("GtkItemFactory-action");
quark_type_title = g_quark_from_static_string (key_type_title); quark_accel_group = g_quark_from_static_string ("GtkAccelGroup");
quark_type_radio_item = g_quark_from_static_string (key_type_radio_item); quark_type_item = g_quark_from_static_string ("<Item>");
quark_type_check_item = g_quark_from_static_string (key_type_check_item); quark_type_title = g_quark_from_static_string ("<Title>");
quark_type_toggle_item = g_quark_from_static_string (key_type_toggle_item); quark_type_radio_item = g_quark_from_static_string ("<RadioItem>");
quark_type_tearoff_item = g_quark_from_static_string (key_type_tearoff_item); quark_type_check_item = g_quark_from_static_string ("<CheckItem>");
quark_type_separator_item = g_quark_from_static_string (key_type_separator_item); quark_type_toggle_item = g_quark_from_static_string ("<ToggleItem>");
quark_type_branch = g_quark_from_static_string (key_type_branch); quark_type_tearoff_item = g_quark_from_static_string ("<Tearoff>");
quark_type_last_branch = g_quark_from_static_string (key_type_last_branch); quark_type_separator_item = g_quark_from_static_string ("<Separator>");
quark_type_branch = g_quark_from_static_string ("<Branch>");
quark_type_last_branch = g_quark_from_static_string ("<LastBranch>");
} }
static void static void
@ -248,7 +234,7 @@ gtk_item_factory_init (GtkItemFactory *ifactory)
ifactory->path = NULL; ifactory->path = NULL;
ifactory->accel_group = NULL; ifactory->accel_group = NULL;
ifactory->widget = NULL; ifactory->widget = NULL;
ifactory->widgets_by_action = NULL; ifactory->items = NULL;
} }
GtkItemFactory* GtkItemFactory*
@ -315,23 +301,20 @@ gtk_item_factory_propagate_accelerator (GtkItemFactoryItem *item,
for (slist = widget_list; slist; slist = slist->next) for (slist = widget_list; slist; slist = slist->next)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkItemFactory *ifactory; GtkAccelGroup *accel_group;
guint signal_id;
widget = slist->data; widget = slist->data;
ifactory = gtk_item_factory_from_widget (widget); accel_group = gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_accel_group);
if (ifactory)
{
guint signal_id;
signal_id = gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (widget)); signal_id = gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (widget));
if (signal_id) if (signal_id && accel_group)
{ {
if (item->accelerator_key) if (item->accelerator_key)
gtk_widget_add_accelerator (widget, gtk_widget_add_accelerator (widget,
"activate", "activate",
ifactory->accel_group, accel_group,
item->accelerator_key, item->accelerator_key,
item->accelerator_mods, item->accelerator_mods,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
@ -347,7 +330,7 @@ gtk_item_factory_propagate_accelerator (GtkItemFactoryItem *item,
ac_entry = work->data; ac_entry = work->data;
work = work->next; work = work->next;
if (ac_entry->accel_flags & GTK_ACCEL_VISIBLE && if (ac_entry->accel_flags & GTK_ACCEL_VISIBLE &&
ac_entry->accel_group == ifactory->accel_group && ac_entry->accel_group == accel_group &&
ac_entry->signal_id == signal_id) ac_entry->signal_id == signal_id)
gtk_widget_remove_accelerator (GTK_WIDGET (widget), gtk_widget_remove_accelerator (GTK_WIDGET (widget),
ac_entry->accel_group, ac_entry->accel_group,
@ -356,9 +339,10 @@ gtk_item_factory_propagate_accelerator (GtkItemFactoryItem *item,
} }
} }
} }
}
gtk_widget_unref (widget); gtk_widget_unref (widget);
} }
g_slist_free (widget_list); g_slist_free (widget_list);
item->in_propagation = FALSE; item->in_propagation = FALSE;
@ -413,7 +397,90 @@ gtk_item_factory_item_remove_widget (GtkWidget *widget,
{ {
item->widgets = g_slist_remove (item->widgets, widget); item->widgets = g_slist_remove (item->widgets, widget);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory); gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory);
gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_factory_path); gtk_object_remove_data_by_id (GTK_OBJECT (widget), quark_item_path);
}
void
gtk_item_factory_add_foreign (GtkWidget *accel_widget,
const gchar *full_path,
GtkAccelGroup *accel_group,
guint keyval,
GdkModifierType modifiers)
{
GtkItemFactoryClass *class;
GtkItemFactoryItem *item;
g_return_if_fail (GTK_IS_WIDGET (accel_widget));
g_return_if_fail (full_path != NULL);
class = gtk_type_class (GTK_TYPE_ITEM_FACTORY);
keyval = keyval != GDK_VoidSymbol ? keyval : 0;
item = g_hash_table_lookup (class->item_ht, full_path);
if (!item)
{
item = g_chunk_new (GtkItemFactoryItem, ifactory_item_chunks);
item->path = g_strdup (full_path);
item->accelerator_key = keyval;
item->accelerator_mods = modifiers;
item->modified = FALSE;
item->in_propagation = FALSE;
item->dummy = NULL;
item->widgets = NULL;
g_hash_table_insert (class->item_ht, item->path, item);
}
item->widgets = g_slist_prepend (item->widgets, accel_widget);
gtk_signal_connect (GTK_OBJECT (accel_widget),
"destroy",
GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_widget),
item);
/* set the item path for the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (accel_widget), quark_item_path, item->path);
gtk_widget_set_name (accel_widget, item->path);
if (accel_group)
{
gtk_accel_group_ref (accel_group);
gtk_object_set_data_by_id_full (GTK_OBJECT (accel_widget),
quark_accel_group,
accel_group,
(GtkDestroyNotify) gtk_accel_group_unref);
}
else
gtk_object_set_data_by_id (GTK_OBJECT (accel_widget), quark_accel_group, NULL);
/* install defined accelerators
*/
if (gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (accel_widget)))
{
if (item->accelerator_key && accel_group)
gtk_widget_add_accelerator (accel_widget,
"activate",
accel_group,
item->accelerator_key,
item->accelerator_mods,
GTK_ACCEL_VISIBLE);
else
gtk_widget_remove_accelerators (accel_widget,
"activate",
TRUE);
}
/* keep track of accelerator changes
*/
gtk_signal_connect_after (GTK_OBJECT (accel_widget),
"add-accelerator",
GTK_SIGNAL_FUNC (gtk_item_factory_item_add_accelerator),
item);
gtk_signal_connect_after (GTK_OBJECT (accel_widget),
"remove-accelerator",
GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_accelerator),
item);
} }
static void static void
@ -436,112 +503,18 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
GtkItemFactoryClass *class; GtkItemFactoryClass *class;
GtkItemFactoryItem *item; GtkItemFactoryItem *item;
gchar *fpath; gchar *fpath;
guint keyval, mods;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (item_type != NULL); g_return_if_fail (item_type != NULL);
class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass); class = GTK_ITEM_FACTORY_CLASS (GTK_OBJECT (ifactory)->klass);
fpath = g_strconcat (ifactory->path, path, NULL);
item = g_hash_table_lookup (class->item_ht, fpath);
/* link the widget into its item-entry
*/
if (!item)
{
guint keyval;
guint mods;
if (accelerator)
gtk_accelerator_parse (accelerator, &keyval, &mods);
else
{
keyval = 0;
mods = 0;
}
item = g_chunk_new (GtkItemFactoryItem, ifactory_item_chunks);
item->path = fpath;
fpath = NULL;
item->accelerator_key = keyval;
item->accelerator_mods = mods;
item->modified = FALSE;
item->in_propagation = FALSE;
item->item_type = NULL;
item->widgets = NULL;
g_hash_table_insert (class->item_ht, item->path, item);
}
g_free (fpath);
if (item->item_type == NULL)
{
g_assert (item->widgets == NULL);
if (item_type != ITEM_FACTORY_STRING)
item->item_type = g_strdup (item_type);
else
item->item_type = ITEM_FACTORY_STRING;
}
item->widgets = g_slist_prepend (item->widgets, widget);
gtk_signal_connect (GTK_OBJECT (widget),
"destroy",
GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_widget),
item);
/* set back pointers for the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory, ifactory);
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory_path, item->path);
gtk_widget_set_name (widget, item->path);
/* set accelerator group on menu widgets /* set accelerator group on menu widgets
*/ */
if (GTK_IS_MENU (widget)) if (GTK_IS_MENU (widget))
gtk_menu_set_accel_group ((GtkMenu*) widget, ifactory->accel_group); gtk_menu_set_accel_group ((GtkMenu*) widget, ifactory->accel_group);
/* install defined accelerators
*/
if (gtk_signal_lookup ("activate", GTK_OBJECT_TYPE (widget)))
{
if (item->accelerator_key)
gtk_widget_add_accelerator (widget,
"activate",
ifactory->accel_group,
item->accelerator_key,
item->accelerator_mods,
GTK_ACCEL_VISIBLE);
else
gtk_widget_remove_accelerators (widget,
"activate",
TRUE);
}
/* keep track of accelerator changes
*/
gtk_signal_connect_after (GTK_OBJECT (widget),
"add-accelerator",
GTK_SIGNAL_FUNC (gtk_item_factory_item_add_accelerator),
item);
gtk_signal_connect_after (GTK_OBJECT (widget),
"remove-accelerator",
GTK_SIGNAL_FUNC (gtk_item_factory_item_remove_accelerator),
item);
/* keep a per-action list of the widgets on the factory
*/
if (callback)
{
GtkIFActionLink *link;
link = g_new (GtkIFActionLink, 1);
link->widget = widget;
link->callback_action = callback_action;
ifactory->widgets_by_action = g_slist_prepend (ifactory->widgets_by_action, link);
}
/* connect callback if neccessary /* connect callback if neccessary
*/ */
if (callback) if (callback)
@ -562,6 +535,28 @@ gtk_item_factory_add_item (GtkItemFactory *ifactory,
GTK_SIGNAL_FUNC (gtk_item_factory_callback_marshal), GTK_SIGNAL_FUNC (gtk_item_factory_callback_marshal),
data); data);
} }
/* link the widget into its item-entry
* and keep back pointer on both the item factory and the widget
*/
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_action, GUINT_TO_POINTER (callback_action));
gtk_object_set_data_by_id (GTK_OBJECT (widget), quark_item_factory, ifactory);
if (accelerator)
gtk_accelerator_parse (accelerator, &keyval, &mods);
else
{
keyval = 0;
mods = 0;
}
fpath = g_strconcat (ifactory->path, path, NULL);
gtk_item_factory_add_foreign (widget, fpath, ifactory->accel_group, keyval, mods);
item = g_hash_table_lookup (class->item_ht, fpath);
g_free (fpath);
g_return_if_fail (item != NULL);
if (!g_slist_find (ifactory->items, item))
ifactory->items = g_slist_prepend (ifactory->items, item);
} }
void void
@ -570,7 +565,6 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
const gchar *path, const gchar *path,
GtkAccelGroup *accel_group) GtkAccelGroup *accel_group)
{ {
GtkAccelGroup *menu_group;
guint len; guint len;
g_return_if_fail (ifactory != NULL); g_return_if_fail (ifactory != NULL);
@ -604,15 +598,6 @@ gtk_item_factory_construct (GtkItemFactory *ifactory,
gtk_object_ref (GTK_OBJECT (ifactory)); gtk_object_ref (GTK_OBJECT (ifactory));
gtk_object_sink (GTK_OBJECT (ifactory)); gtk_object_sink (GTK_OBJECT (ifactory));
menu_group = gtk_accel_group_new ();
gtk_accel_group_attach (menu_group, GTK_OBJECT (ifactory->widget));
/*
gtk_signal_connect_object_while_alive (GTK_OBJECT (ifactory->widget),
"destroy",
GTK_SIGNAL_FUNC (gtk_object_destroy),
GTK_OBJECT (ifactory));
*/
gtk_item_factory_add_item (ifactory, gtk_item_factory_add_item (ifactory,
"", NULL, "", NULL,
NULL, 0, NULL, 0, NULL, 0, NULL, 0,
@ -681,10 +666,17 @@ gtk_item_factory_destroy (GtkObject *object)
ifactory->widget = NULL; ifactory->widget = NULL;
} }
for (slist = ifactory->widgets_by_action; slist; slist = slist->next) for (slist = ifactory->items; slist; slist = slist->next)
g_free (slist->data); {
g_slist_free (ifactory->widgets_by_action); GtkItemFactoryItem *item = slist->data;
ifactory->widgets_by_action = NULL; GSList *link;
for (link = item->widgets; link; link = link->next)
if (gtk_object_get_data_by_id (link->data, quark_item_factory))
gtk_object_remove_data_by_id (link->data, quark_item_factory);
}
g_slist_free (ifactory->items);
ifactory->items = NULL;
parent_class->destroy (object); parent_class->destroy (object);
} }
@ -724,7 +716,7 @@ gtk_item_factory_path_from_widget (GtkWidget *widget)
g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_factory_path); return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_path);
} }
static void static void
@ -861,7 +853,6 @@ gtk_item_factory_get_widget (GtkItemFactory *ifactory,
GtkItemFactoryClass *class; GtkItemFactoryClass *class;
GtkItemFactoryItem *item; GtkItemFactoryItem *item;
g_return_val_if_fail (ifactory != NULL, NULL);
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL); g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
g_return_val_if_fail (path != NULL, NULL); g_return_val_if_fail (path != NULL, NULL);
@ -898,22 +889,55 @@ gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
{ {
GSList *slist; GSList *slist;
g_return_val_if_fail (ifactory != NULL, NULL);
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL); g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
for (slist = ifactory->widgets_by_action; slist; slist = slist->next) for (slist = ifactory->items; slist; slist = slist->next)
{ {
GtkIFActionLink *link; GtkItemFactoryItem *item = slist->data;
GSList *link;
link = slist->data; for (link = item->widgets; link; link = link->next)
if (gtk_object_get_data_by_id (link->data, quark_item_factory) == ifactory &&
if (link->callback_action == action) gtk_object_get_data_by_id (link->data, quark_action) == GUINT_TO_POINTER (action))
return link->widget; return link->data;
} }
return NULL; return NULL;
} }
GtkWidget*
gtk_item_factory_get_item (GtkItemFactory *ifactory,
const gchar *path)
{
GtkWidget *widget;
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
g_return_val_if_fail (path != NULL, NULL);
widget = gtk_item_factory_get_widget (ifactory, path);
if (GTK_IS_MENU (widget))
widget = gtk_menu_get_attach_widget (GTK_MENU (widget));
return GTK_IS_ITEM (widget) ? widget : NULL;
}
GtkWidget*
gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory,
guint action)
{
GtkWidget *widget;
g_return_val_if_fail (GTK_IS_ITEM_FACTORY (ifactory), NULL);
widget = gtk_item_factory_get_widget_by_action (ifactory, action);
if (GTK_IS_MENU (widget))
widget = gtk_menu_get_attach_widget (GTK_MENU (widget));
return GTK_IS_ITEM (widget) ? widget : NULL;
}
static gboolean static gboolean
gtk_item_factory_parse_path (GtkItemFactory *ifactory, gtk_item_factory_parse_path (GtkItemFactory *ifactory,
gchar *str, gchar *str,
@ -975,8 +999,6 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
guint type_id; guint type_id;
GtkType type; GtkType type;
gchar *item_type_path; gchar *item_type_path;
GtkAccelGroup *parent_accel_group = NULL;
GSList *tmp_list;
g_return_if_fail (ifactory != NULL); g_return_if_fail (ifactory != NULL);
g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory)); g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
@ -988,7 +1010,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (!entry->item_type || if (!entry->item_type ||
entry->item_type[0] == 0) entry->item_type[0] == 0)
{ {
item_type_path = (gpointer) key_type_item; item_type_path = "<Item>";
type_id = quark_type_item; type_id = quark_type_item;
} }
else else
@ -1063,11 +1085,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
} }
g_free (parent_path); g_free (parent_path);
g_return_if_fail (parent != NULL); g_return_if_fail (GTK_IS_CONTAINER (parent));
tmp_list = gtk_accel_groups_from_object (GTK_OBJECT (parent));
if (tmp_list)
parent_accel_group = tmp_list->data;
widget = gtk_widget_new (type, widget = gtk_widget_new (type,
"GtkWidget::visible", TRUE, "GtkWidget::visible", TRUE,
@ -1081,14 +1099,15 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (GTK_IS_CHECK_MENU_ITEM (widget)) if (GTK_IS_CHECK_MENU_ITEM (widget))
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE); gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), TRUE);
if ((type_id != quark_type_separator_item) && /* install underline accelerators for this item
(type_id != quark_type_tearoff_item) && */
if (type_id != quark_type_separator_item &&
type_id != quark_type_tearoff_item &&
*name) *name)
{ {
GtkWidget *label; GtkWidget *label;
label = label = gtk_widget_new (GTK_TYPE_ACCEL_LABEL,
gtk_widget_new (GTK_TYPE_ACCEL_LABEL,
"GtkWidget::visible", TRUE, "GtkWidget::visible", TRUE,
"GtkWidget::parent", widget, "GtkWidget::parent", widget,
"GtkAccelLabel::accel_widget", widget, "GtkAccelLabel::accel_widget", widget,
@ -1097,20 +1116,19 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
accel_key = gtk_label_parse_uline (GTK_LABEL (label), name); accel_key = gtk_label_parse_uline (GTK_LABEL (label), name);
if ((accel_key != GDK_VoidSymbol) && GTK_IS_MENU_BAR (parent)) if (accel_key != GDK_VoidSymbol)
{ {
if (GTK_IS_MENU_BAR (parent))
gtk_widget_add_accelerator (widget, gtk_widget_add_accelerator (widget,
"activate_item", "activate_item",
ifactory->accel_group, ifactory->accel_group,
accel_key, GDK_MOD1_MASK, accel_key, GDK_MOD1_MASK,
GTK_ACCEL_LOCKED); GTK_ACCEL_LOCKED);
}
if ((accel_key != GDK_VoidSymbol) && parent_accel_group) if (GTK_IS_MENU (parent))
{
gtk_widget_add_accelerator (widget, gtk_widget_add_accelerator (widget,
"activate_item", "activate_item",
parent_accel_group, gtk_menu_ensure_uline_accel_group (GTK_MENU (parent)),
accel_key, 0, accel_key, 0,
GTK_ACCEL_LOCKED); GTK_ACCEL_LOCKED);
} }
@ -1121,23 +1139,17 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
if (type_id == quark_type_branch || if (type_id == quark_type_branch ||
type_id == quark_type_last_branch) type_id == quark_type_last_branch)
{ {
GtkAccelGroup *menu_group;
if (entry->callback) if (entry->callback)
g_warning ("gtk_item_factory_create_item(): Can't specify a callback on a branch: \"%s\"", g_warning ("gtk_item_factory_create_item(): Can't specify a callback on a branch: \"%s\"",
entry->path); entry->path);
menu_group = gtk_accel_group_new ();
if (type_id == quark_type_last_branch) if (type_id == quark_type_last_branch)
gtk_menu_item_right_justify (GTK_MENU_ITEM (widget)); gtk_menu_item_right_justify (GTK_MENU_ITEM (widget));
parent = widget; parent = widget;
widget = widget = gtk_widget_new (GTK_TYPE_MENU,
gtk_widget_new (GTK_TYPE_MENU,
NULL); NULL);
gtk_accel_group_attach (menu_group, GTK_OBJECT (widget));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), widget); gtk_menu_item_set_submenu (GTK_MENU_ITEM (parent), widget);
} }
@ -1199,7 +1211,7 @@ gtk_item_factory_create_menu_entries (guint n_entries,
entry.callback = entries[i].callback; entry.callback = entries[i].callback;
entry.callback_action = 0; entry.callback_action = 0;
if (gtk_pattern_match_string (&pspec_separator, path)) if (gtk_pattern_match_string (&pspec_separator, path))
entry.item_type = (gpointer) key_type_separator_item; entry.item_type = "<Separator>";
else if (!gtk_pattern_match_string (&pspec_check, path)) else if (!gtk_pattern_match_string (&pspec_check, path))
entry.item_type = NULL; entry.item_type = NULL;
else else
@ -1220,7 +1232,7 @@ gtk_item_factory_create_menu_entries (guint n_entries,
path++; path++;
} }
*c = 0; *c = 0;
entry.item_type = (gpointer) key_type_toggle_item; entry.item_type = "<ToggleItem>";
entry.path = cpath; entry.path = cpath;
} }
@ -1483,7 +1495,7 @@ gtk_item_factory_parse_menu_path (GScanner *scanner,
item->accelerator_mods = 0; item->accelerator_mods = 0;
item->modified = TRUE; item->modified = TRUE;
item->in_propagation = FALSE; item->in_propagation = FALSE;
item->item_type = NULL; item->dummy = NULL;
item->widgets = NULL; item->widgets = NULL;
g_hash_table_insert (class->item_ht, item->path, item); g_hash_table_insert (class->item_ht, item->path, item);
@ -1570,6 +1582,9 @@ gtk_item_factory_parse_rc_string (const gchar *rc_string)
g_return_if_fail (rc_string != NULL); g_return_if_fail (rc_string != NULL);
if (!gtk_item_factory_class)
gtk_type_class (GTK_TYPE_ITEM_FACTORY);
ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single; ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single;
scanner = g_scanner_new (&ifactory_scanner_config); scanner = g_scanner_new (&ifactory_scanner_config);
@ -1628,6 +1643,9 @@ gtk_item_factory_parse_rc (const gchar *file_name)
if (fd < 0) if (fd < 0)
return; return;
if (!gtk_item_factory_class)
gtk_type_class (GTK_TYPE_ITEM_FACTORY);
ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single; ifactory_scanner_config.cpair_comment_single = gtk_item_factory_class->cpair_comment_single;
scanner = g_scanner_new (&ifactory_scanner_config); scanner = g_scanner_new (&ifactory_scanner_config);

View File

@ -69,7 +69,7 @@ struct _GtkItemFactory
gchar *path; gchar *path;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
GtkWidget *widget; GtkWidget *widget;
GSList *widgets_by_action; GSList *items;
GtkTranslateFunc translate_func; GtkTranslateFunc translate_func;
gpointer translate_data; gpointer translate_data;
@ -118,7 +118,7 @@ struct _GtkItemFactoryItem
guint accelerator_mods; guint accelerator_mods;
guint modified : 1; guint modified : 1;
guint in_propagation : 1; guint in_propagation : 1;
gchar *item_type; gchar *dummy;
GSList *widgets; GSList *widgets;
}; };
@ -142,14 +142,23 @@ void gtk_item_factory_construct (GtkItemFactory *ifactory,
void gtk_item_factory_parse_rc (const gchar *file_name); void gtk_item_factory_parse_rc (const gchar *file_name);
void gtk_item_factory_parse_rc_string (const gchar *rc_string); void gtk_item_factory_parse_rc_string (const gchar *rc_string);
void gtk_item_factory_parse_rc_scanner (GScanner *scanner); void gtk_item_factory_parse_rc_scanner (GScanner *scanner);
void gtk_item_factory_add_foreign (GtkWidget *accel_widget,
const gchar *full_path,
GtkAccelGroup *accel_group,
guint keyval,
GdkModifierType modifiers);
GtkItemFactory* gtk_item_factory_from_widget (GtkWidget *widget); GtkItemFactory* gtk_item_factory_from_widget (GtkWidget *widget);
gchar* gtk_item_factory_path_from_widget (GtkWidget *widget); gchar* gtk_item_factory_path_from_widget (GtkWidget *widget);
GtkWidget* gtk_item_factory_get_item (GtkItemFactory *ifactory,
const gchar *path);
GtkWidget* gtk_item_factory_get_widget (GtkItemFactory *ifactory, GtkWidget* gtk_item_factory_get_widget (GtkItemFactory *ifactory,
const gchar *path); const gchar *path);
GtkWidget* gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory, GtkWidget* gtk_item_factory_get_widget_by_action (GtkItemFactory *ifactory,
guint action); guint action);
GtkWidget* gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory,
guint action);
/* If `path_pspec' is passed as `NULL', this function will iterate over /* If `path_pspec' is passed as `NULL', this function will iterate over
* all hash entries. otherwise only those entries will be dumped for which * all hash entries. otherwise only those entries will be dumped for which

View File

@ -1015,7 +1015,7 @@ gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
0, 0,
MAX ((gint)widget->allocation.height - dy, 0), MAX ((gint)widget->allocation.height - dy, 0),
widget->allocation.width, widget->allocation.width,
MIN (dy, widget->allocation.width)); MIN (dy, widget->allocation.height));
} }
else if (dy < 0) else if (dy < 0)
{ {
@ -1037,8 +1037,8 @@ gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
gtk_layout_expose_area (layout, gtk_layout_expose_area (layout,
0, 0,
0, 0,
widget->allocation.height, widget->allocation.width,
MIN (-dy, (gint)widget->allocation.width)); MIN (-dy, (gint)widget->allocation.height));
} }
gtk_layout_position_children (layout); gtk_layout_position_children (layout);

View File

@ -74,6 +74,7 @@ static void gtk_menu_reparent (GtkMenu *menu,
static GtkMenuShellClass *parent_class = NULL; static GtkMenuShellClass *parent_class = NULL;
static const gchar *attach_data_key = "gtk-menu-attach-data"; static const gchar *attach_data_key = "gtk-menu-attach-data";
static GQuark quark_uline_accel_group = 0;
GtkType GtkType
@ -155,6 +156,33 @@ gtk_menu_class_init (GtkMenuClass *class)
GTK_MENU_DIR_CHILD); GTK_MENU_DIR_CHILD);
} }
static gint
gtk_menu_window_event (GtkWidget *window,
GdkEvent *event,
GtkWidget *menu)
{
gboolean handled = FALSE;
gtk_widget_ref (window);
gtk_widget_ref (menu);
switch (event->type)
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
gtk_widget_event (menu, event);
handled = TRUE;
break;
default:
break;
}
gtk_widget_unref (window);
gtk_widget_unref (menu);
return handled;
}
static void static void
gtk_menu_init (GtkMenu *menu) gtk_menu_init (GtkMenu *menu)
{ {
@ -165,8 +193,9 @@ gtk_menu_init (GtkMenu *menu)
menu->position_func_data = NULL; menu->position_func_data = NULL;
menu->toplevel = gtk_window_new (GTK_WINDOW_POPUP); menu->toplevel = gtk_window_new (GTK_WINDOW_POPUP);
gtk_signal_connect_object (GTK_OBJECT (menu->toplevel), "key_press_event", gtk_signal_connect (GTK_OBJECT (menu->toplevel),
GTK_SIGNAL_FUNC (gtk_menu_key_press), "event",
GTK_SIGNAL_FUNC (gtk_menu_window_event),
GTK_OBJECT (menu)); GTK_OBJECT (menu));
gtk_window_set_policy (GTK_WINDOW (menu->toplevel), gtk_window_set_policy (GTK_WINDOW (menu->toplevel),
FALSE, FALSE, TRUE); FALSE, FALSE, TRUE);
@ -203,6 +232,12 @@ gtk_menu_destroy (GtkObject *object)
gtk_menu_set_accel_group (menu, NULL); gtk_menu_set_accel_group (menu, NULL);
if (menu->old_active_menu_item)
{
gtk_widget_unref (menu->old_active_menu_item);
menu->old_active_menu_item = NULL;
}
/* Add back the reference count for being a child */ /* Add back the reference count for being a child */
gtk_object_ref (object); gtk_object_ref (object);
@ -327,6 +362,42 @@ gtk_menu_insert (GtkMenu *menu,
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), child, position); gtk_menu_shell_insert (GTK_MENU_SHELL (menu), child, position);
} }
static void
gtk_menu_tearoff_bg_copy (GtkMenu *menu)
{
GtkWidget *widget;
widget = GTK_WIDGET (menu);
if (menu->torn_off)
{
GdkPixmap *pixmap;
GdkGC *gc;
GdkGCValues gc_values;
gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
gc = gdk_gc_new_with_values (widget->window,
&gc_values, GDK_GC_SUBWINDOW);
pixmap = gdk_pixmap_new (widget->window,
widget->requisition.width,
widget->requisition.height,
-1);
gdk_draw_pixmap (pixmap, gc,
widget->window,
0, 0, 0, 0, -1, -1);
gdk_gc_unref (gc);
gtk_widget_set_usize (menu->tearoff_window,
widget->requisition.width,
widget->requisition.height);
gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE);
gdk_pixmap_unref (pixmap);
}
}
void void
gtk_menu_popup (GtkMenu *menu, gtk_menu_popup (GtkMenu *menu,
GtkWidget *parent_menu_shell, GtkWidget *parent_menu_shell,
@ -368,30 +439,7 @@ gtk_menu_popup (GtkMenu *menu,
if (menu->torn_off) if (menu->torn_off)
{ {
GdkPixmap *pixmap; gtk_menu_tearoff_bg_copy (menu);
GdkGC *gc;
GdkGCValues gc_values;
gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
gc = gdk_gc_new_with_values (widget->window,
&gc_values, GDK_GC_SUBWINDOW);
pixmap = gdk_pixmap_new (widget->window,
widget->requisition.width,
widget->requisition.height,
-1);
gdk_draw_pixmap (pixmap, gc,
widget->window,
0, 0, 0, 0, -1, -1);
gdk_gc_unref(gc);
gtk_widget_set_usize (menu->tearoff_window,
widget->requisition.width,
widget->requisition.height);
gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE);
gdk_pixmap_unref (pixmap);
/* We force an unrealize here so that we don't trigger redrawing/ /* We force an unrealize here so that we don't trigger redrawing/
* clearing code - we just want to reveal our backing pixmap. * clearing code - we just want to reveal our backing pixmap.
@ -479,11 +527,14 @@ gtk_menu_popdown (GtkMenu *menu)
if (menu_shell->active_menu_item) if (menu_shell->active_menu_item)
{ {
if (menu->old_active_menu_item)
gtk_widget_unref (menu->old_active_menu_item);
menu->old_active_menu_item = menu_shell->active_menu_item; menu->old_active_menu_item = menu_shell->active_menu_item;
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item)); gtk_widget_ref (menu->old_active_menu_item);
menu_shell->active_menu_item = NULL;
} }
gtk_menu_shell_deselect (menu_shell);
/* The X Grab, if present, will automatically be removed when we hide /* The X Grab, if present, will automatically be removed when we hide
* the window */ * the window */
gtk_widget_hide (menu->toplevel); gtk_widget_hide (menu->toplevel);
@ -538,6 +589,8 @@ gtk_menu_get_active (GtkMenu *menu)
} }
menu->old_active_menu_item = child; menu->old_active_menu_item = child;
if (menu->old_active_menu_item)
gtk_widget_ref (menu->old_active_menu_item);
} }
return menu->old_active_menu_item; return menu->old_active_menu_item;
@ -558,7 +611,12 @@ gtk_menu_set_active (GtkMenu *menu,
{ {
child = tmp_list->data; child = tmp_list->data;
if (GTK_BIN (child)->child) if (GTK_BIN (child)->child)
{
if (menu->old_active_menu_item)
gtk_widget_unref (menu->old_active_menu_item);
menu->old_active_menu_item = child; menu->old_active_menu_item = child;
gtk_widget_ref (menu->old_active_menu_item);
}
} }
} }
@ -566,7 +624,6 @@ void
gtk_menu_set_accel_group (GtkMenu *menu, gtk_menu_set_accel_group (GtkMenu *menu,
GtkAccelGroup *accel_group) GtkAccelGroup *accel_group)
{ {
g_return_if_fail (menu != NULL);
g_return_if_fail (GTK_IS_MENU (menu)); g_return_if_fail (GTK_IS_MENU (menu));
if (menu->accel_group != accel_group) if (menu->accel_group != accel_group)
@ -579,6 +636,45 @@ gtk_menu_set_accel_group (GtkMenu *menu,
} }
} }
GtkAccelGroup*
gtk_menu_get_accel_group (GtkMenu *menu)
{
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
return menu->accel_group;
}
GtkAccelGroup*
gtk_menu_ensure_uline_accel_group (GtkMenu *menu)
{
GtkAccelGroup *accel_group;
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
if (!quark_uline_accel_group)
quark_uline_accel_group = g_quark_from_static_string ("GtkMenu-uline-accel-group");
accel_group = gtk_object_get_data_by_id (GTK_OBJECT (menu), quark_uline_accel_group);
if (!accel_group)
{
accel_group = gtk_accel_group_new ();
gtk_accel_group_attach (accel_group, GTK_OBJECT (menu));
gtk_object_set_data_by_id_full (GTK_OBJECT (menu),
quark_uline_accel_group,
accel_group,
(GtkDestroyNotify) gtk_accel_group_unref);
}
return accel_group;
}
GtkAccelGroup*
gtk_menu_get_uline_accel_group (GtkMenu *menu)
{
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
return gtk_object_get_data_by_id (GTK_OBJECT (menu), quark_uline_accel_group);
}
void void
gtk_menu_reposition (GtkMenu *menu) gtk_menu_reposition (GtkMenu *menu)
@ -614,9 +710,9 @@ gtk_menu_set_tearoff_state (GtkMenu *menu,
menu->tearoff_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); menu->tearoff_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_app_paintable (menu->tearoff_window, TRUE); gtk_widget_set_app_paintable (menu->tearoff_window, TRUE);
gtk_signal_connect_object (GTK_OBJECT (menu->tearoff_window), gtk_signal_connect (GTK_OBJECT (menu->tearoff_window),
"key_press_event", "event",
GTK_SIGNAL_FUNC (gtk_menu_key_press), GTK_SIGNAL_FUNC (gtk_menu_window_event),
GTK_OBJECT (menu)); GTK_OBJECT (menu));
gtk_widget_realize (menu->tearoff_window); gtk_widget_realize (menu->tearoff_window);
@ -888,16 +984,19 @@ gtk_menu_expose (GtkWidget *widget,
GtkWidget *child; GtkWidget *child;
GdkEventExpose child_event; GdkEventExpose child_event;
GList *children; GList *children;
GtkMenu *menu;
g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE); g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
menu_shell = GTK_MENU_SHELL (widget);
menu = GTK_MENU (widget);
if (GTK_WIDGET_DRAWABLE (widget)) if (GTK_WIDGET_DRAWABLE (widget))
{ {
gtk_menu_paint (widget); gtk_menu_paint (widget);
menu_shell = GTK_MENU_SHELL (widget);
child_event = *event; child_event = *event;
children = menu_shell->children; children = menu_shell->children;
@ -943,11 +1042,15 @@ gtk_menu_key_press (GtkWidget *widget,
} }
/* Modify the accelerators */ /* Modify the accelerators */
if (delete || gtk_accelerator_valid (event->keyval, event->keyval))
{
if (menu_shell->active_menu_item && if (menu_shell->active_menu_item &&
GTK_BIN (menu_shell->active_menu_item)->child && GTK_BIN (menu_shell->active_menu_item)->child &&
GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL) GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL &&
!gtk_widget_accelerators_locked (menu_shell->active_menu_item) &&
(delete ||
(gtk_accelerator_valid (event->keyval, event->state) &&
(event->state ||
!gtk_menu_get_uline_accel_group (GTK_MENU (menu_shell)) ||
(event->keyval >= GDK_F1 && event->keyval <= GDK_F35)))))
{ {
GtkMenuItem *menu_item; GtkMenuItem *menu_item;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
@ -993,9 +1096,8 @@ gtk_menu_key_press (GtkWidget *widget,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
} }
} }
}
return FALSE; return TRUE;
} }
static gint static gint
@ -1008,15 +1110,23 @@ gtk_menu_motion_notify (GtkWidget *widget,
if (GTK_MENU_SHELL (widget)->ignore_enter) if (GTK_MENU_SHELL (widget)->ignore_enter)
GTK_MENU_SHELL (widget)->ignore_enter = FALSE; GTK_MENU_SHELL (widget)->ignore_enter = FALSE;
else else
{
gint width, height;
gdk_window_get_size (event->window, &width, &height);
if (event->x >= 0 && event->x < width &&
event->y >= 0 && event->y < height)
{ {
GdkEvent send_event; GdkEvent send_event;
send_event.crossing.type = GDK_ENTER_NOTIFY; send_event.crossing.type = GDK_ENTER_NOTIFY;
send_event.crossing.window = event->window; send_event.crossing.window = event->window;
send_event.crossing.time = event->time; send_event.crossing.time = event->time;
send_event.crossing.send_event = TRUE;
gtk_widget_event (widget, &send_event); gtk_widget_event (widget, &send_event);
} }
}
return FALSE; return FALSE;
} }
@ -1111,6 +1221,7 @@ gtk_menu_reparent (GtkMenu *menu,
} }
else else
gtk_widget_reparent (GTK_WIDGET (menu), new_parent); gtk_widget_reparent (GTK_WIDGET (menu), new_parent);
gtk_widget_set_usize (new_parent, -1, -1);
if (was_floating) if (was_floating)
GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING); GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING);

View File

@ -117,8 +117,19 @@ GtkWidget* gtk_menu_get_active (GtkMenu *menu);
void gtk_menu_set_active (GtkMenu *menu, void gtk_menu_set_active (GtkMenu *menu,
guint index); guint index);
/* set/get the acclerator group that holds global accelerators (should
* be added to the corresponding toplevel with gtk_window_add_accel_group().
*/
void gtk_menu_set_accel_group (GtkMenu *menu, void gtk_menu_set_accel_group (GtkMenu *menu,
GtkAccelGroup *accel_group); GtkAccelGroup *accel_group);
GtkAccelGroup* gtk_menu_get_accel_group (GtkMenu *menu);
/* get the accelerator group that is used internally by the menu for
* underline accelerators while the menu is popped up.
*/
GtkAccelGroup* gtk_menu_get_uline_accel_group (GtkMenu *menu);
GtkAccelGroup* gtk_menu_ensure_uline_accel_group (GtkMenu *menu);
/* A reference count is kept for a widget when it is attached to /* A reference count is kept for a widget when it is attached to
* a particular widget. This is typically a menu item; it may also * a particular widget. This is typically a menu item; it may also

View File

@ -137,7 +137,6 @@ static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
GdkEvent *event); GdkEvent *event);
static GtkType gtk_menu_shell_child_type (GtkContainer *container); static GtkType gtk_menu_shell_child_type (GtkContainer *container);
static void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
static void gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell, static void gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction); GtkMenuDirectionType direction);
static void gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell, static void gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell,
@ -435,15 +434,7 @@ gtk_menu_shell_button_press (GtkWidget *widget,
{ {
if ((menu_item->parent == widget) && if ((menu_item->parent == widget) &&
(menu_item != menu_shell->active_menu_item)) (menu_item != menu_shell->active_menu_item))
{ gtk_menu_shell_select_item (menu_shell, menu_item);
if (menu_shell->active_menu_item)
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
menu_shell->active_menu_item = menu_item;
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
MENU_SHELL_CLASS (menu_shell)->submenu_placement);
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
}
} }
} }
else else
@ -783,8 +774,7 @@ gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
g_return_if_fail (menu_item != NULL); g_return_if_fail (menu_item != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
if (menu_shell->active_menu_item) gtk_menu_shell_deselect (menu_shell);
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
menu_shell->active_menu_item = menu_item; menu_shell->active_menu_item = menu_item;
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item), gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
@ -798,12 +788,17 @@ gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
gtk_widget_activate (menu_shell->active_menu_item); gtk_widget_activate (menu_shell->active_menu_item);
} }
static void void
gtk_menu_shell_deselect (GtkMenuShell *menu_shell) gtk_menu_shell_deselect (GtkMenuShell *menu_shell)
{
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
if (menu_shell->active_menu_item)
{ {
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item)); gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
menu_shell->active_menu_item = NULL; menu_shell->active_menu_item = NULL;
} }
}
void void
gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
@ -831,10 +826,13 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
*/ */
gdk_flush (); gdk_flush ();
} }
gtk_widget_ref (GTK_WIDGET (menu_shell));
gtk_widget_activate (menu_item); gtk_widget_activate (menu_item);
if (deactivate) if (deactivate)
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]);
gtk_widget_unref (GTK_WIDGET (menu_shell));
} }
/* Distance should be +/- 1 */ /* Distance should be +/- 1 */

View File

@ -94,6 +94,7 @@ void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell); void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
void gtk_menu_shell_select_item (GtkMenuShell *menu_shell, void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item); GtkWidget *menu_item);
void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item, GtkWidget *menu_item,
gboolean force_deactivate); gboolean force_deactivate);

View File

@ -1768,7 +1768,7 @@ gtk_signal_connect_by_type (GtkObject *object,
handler = gtk_signal_handler_new (); handler = gtk_signal_handler_new ();
handler->id = gtk_handler_id++; handler->id = gtk_handler_id++;
handler->signal_id = signal_id; handler->signal_id = signal_id;
handler->object_signal = object_signal; handler->object_signal = object_signal != FALSE;
handler->func = func; handler->func = func;
handler->func_data = func_data; handler->func_data = func_data;
handler->destroy_func = destroy_func; handler->destroy_func = destroy_func;

View File

@ -2500,11 +2500,7 @@ gtk_widget_lock_accelerators (GtkWidget *widget)
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_signal_handler_pending_by_func (GTK_OBJECT (widget), if (!gtk_widget_accelerators_locked (widget))
widget_signals[ADD_ACCELERATOR],
TRUE,
GTK_SIGNAL_FUNC (gtk_widget_stop_add_accelerator),
NULL) == 0)
{ {
gtk_signal_connect (GTK_OBJECT (widget), gtk_signal_connect (GTK_OBJECT (widget),
"add_accelerator", "add_accelerator",
@ -2523,11 +2519,7 @@ gtk_widget_unlock_accelerators (GtkWidget *widget)
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_signal_handler_pending_by_func (GTK_OBJECT (widget), if (gtk_widget_accelerators_locked (widget))
widget_signals[ADD_ACCELERATOR],
TRUE,
GTK_SIGNAL_FUNC (gtk_widget_stop_add_accelerator),
NULL) > 0)
{ {
gtk_signal_disconnect_by_func (GTK_OBJECT (widget), gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_widget_stop_add_accelerator), GTK_SIGNAL_FUNC (gtk_widget_stop_add_accelerator),
@ -2538,6 +2530,18 @@ gtk_widget_unlock_accelerators (GtkWidget *widget)
} }
} }
gboolean
gtk_widget_accelerators_locked (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
return gtk_signal_handler_pending_by_func (GTK_OBJECT (widget),
widget_signals[ADD_ACCELERATOR],
TRUE,
GTK_SIGNAL_FUNC (gtk_widget_stop_add_accelerator),
NULL) > 0;
}
void void
gtk_widget_add_accelerator (GtkWidget *widget, gtk_widget_add_accelerator (GtkWidget *widget,
const gchar *accel_signal, const gchar *accel_signal,

View File

@ -491,6 +491,7 @@ guint gtk_widget_accelerator_signal (GtkWidget *widget,
guint accel_mods); guint accel_mods);
void gtk_widget_lock_accelerators (GtkWidget *widget); void gtk_widget_lock_accelerators (GtkWidget *widget);
void gtk_widget_unlock_accelerators (GtkWidget *widget); void gtk_widget_unlock_accelerators (GtkWidget *widget);
gboolean gtk_widget_accelerators_locked (GtkWidget *widget);
gint gtk_widget_event (GtkWidget *widget, gint gtk_widget_event (GtkWidget *widget,
GdkEvent *event); GdkEvent *event);

View File

@ -2418,8 +2418,12 @@ create_item_factory (void)
accel_group = gtk_accel_group_new (); accel_group = gtk_accel_group_new ();
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group); item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); gtk_object_set_data_full (GTK_OBJECT (window),
"<main>",
item_factory,
(GtkDestroyNotify) gtk_object_unref);
gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
gtk_window_set_title (GTK_WINDOW (window), "Item Factory"); gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);

View File

@ -2418,8 +2418,12 @@ create_item_factory (void)
accel_group = gtk_accel_group_new (); accel_group = gtk_accel_group_new ();
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group); item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); gtk_object_set_data_full (GTK_OBJECT (window),
"<main>",
item_factory,
(GtkDestroyNotify) gtk_object_unref);
gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
gtk_window_set_title (GTK_WINDOW (window), "Item Factory"); gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);