diff -Nru unity-gtk-module-0.0.0+14.04.20140319/debian/changelog unity-gtk-module-0.0.0+14.04.20140328/debian/changelog --- unity-gtk-module-0.0.0+14.04.20140319/debian/changelog 2014-03-28 15:20:13.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/debian/changelog 2014-03-28 15:20:13.000000000 +0000 @@ -1,3 +1,15 @@ +unity-gtk-module (0.0.0+14.04.20140328-0ubuntu1) trusty; urgency=low + + [ CI bot ] + * Stop using signal handler ids. Use + g_signal_handlers_disconnect_by_data () instead. + + [ William Hua ] + * Fix Eclipse and DBeaver menus. (LP: #1208019) + * Watch use-underline on label instead of menu item. (LP: #1294947) + + -- Ubuntu daily release Fri, 28 Mar 2014 10:54:34 +0000 + unity-gtk-module (0.0.0+14.04.20140319-0ubuntu1) trusty; urgency=low [ William Hua ] diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-action-group.c unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-action-group.c --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-action-group.c 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-action-group.c 2014-03-28 10:54:08.000000000 +0000 @@ -120,38 +120,13 @@ if (old_group != old_old_group) { - if (group->old_group_action_state_changed_handler_id) - { - g_assert (old_old_group != NULL); - g_signal_handler_disconnect (old_old_group, group->old_group_action_state_changed_handler_id); - group->old_group_action_state_changed_handler_id = 0; - } - - if (group->old_group_action_enabled_changed_handler_id) - { - g_assert (old_old_group != NULL); - g_signal_handler_disconnect (old_old_group, group->old_group_action_enabled_changed_handler_id); - group->old_group_action_enabled_changed_handler_id = 0; - } - - if (group->old_group_action_removed_handler_id) - { - g_assert (old_old_group != NULL); - g_signal_handler_disconnect (old_old_group, group->old_group_action_removed_handler_id); - group->old_group_action_removed_handler_id = 0; - } - - if (group->old_group_action_added_handler_id) - { - g_assert (old_old_group != NULL); - g_signal_handler_disconnect (old_old_group, group->old_group_action_added_handler_id); - group->old_group_action_added_handler_id = 0; - } - if (old_old_group != NULL) { - gchar **names = g_action_group_list_actions (old_old_group); + gchar **names; + + g_signal_handlers_disconnect_by_data (old_old_group, group); + names = g_action_group_list_actions (old_old_group); group->old_group = NULL; g_object_unref (old_old_group); @@ -171,10 +146,10 @@ gchar **names = g_action_group_list_actions (old_group); group->old_group = g_object_ref (old_group); - group->old_group_action_added_handler_id = g_signal_connect (old_group, "action-added", G_CALLBACK (unity_gtk_action_group_handle_group_action_added), group); - group->old_group_action_removed_handler_id = g_signal_connect (old_group, "action-removed", G_CALLBACK (unity_gtk_action_group_handle_group_action_removed), group); - group->old_group_action_enabled_changed_handler_id = g_signal_connect (old_group, "action-enabled-changed", G_CALLBACK (unity_gtk_action_group_handle_group_action_enabled_changed), group); - group->old_group_action_state_changed_handler_id = g_signal_connect (old_group, "action-state-changed", G_CALLBACK (unity_gtk_action_group_handle_group_action_state_changed), group); + g_signal_connect (old_group, "action-added", G_CALLBACK (unity_gtk_action_group_handle_group_action_added), group); + g_signal_connect (old_group, "action-removed", G_CALLBACK (unity_gtk_action_group_handle_group_action_removed), group); + g_signal_connect (old_group, "action-enabled-changed", G_CALLBACK (unity_gtk_action_group_handle_group_action_enabled_changed), group); + g_signal_connect (old_group, "action-state-changed", G_CALLBACK (unity_gtk_action_group_handle_group_action_state_changed), group); if (names != NULL) { @@ -672,7 +647,7 @@ name = gtk_menu_item_get_label (menu_item); if (name == NULL || name[0] == '\0') - name = gtk_menu_item_get_nth_label (menu_item, 0); + name = gtk_menu_item_get_nth_label_label (menu_item, 0); if (name != NULL && name[0] == '\0') name = NULL; diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-action-group.h unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-action-group.h --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-action-group.h 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-action-group.h 2014-03-28 10:54:08.000000000 +0000 @@ -51,10 +51,6 @@ /*< private >*/ GActionGroup *old_group; - gulong old_group_action_added_handler_id; - gulong old_group_action_removed_handler_id; - gulong old_group_action_enabled_changed_handler_id; - gulong old_group_action_state_changed_handler_id; GHashTable *actions_by_name; GHashTable *names_by_radio_menu_item; }; diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-item.c unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-item.c --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-item.c 2014-03-19 09:03:53.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-item.c 2014-03-28 10:54:24.000000000 +0000 @@ -57,12 +57,11 @@ } } -const gchar * +static GtkLabel * gtk_menu_item_get_nth_label (GtkMenuItem *menu_item, guint index) { UnityGtkSearch search; - const gchar *label = NULL; g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), NULL); @@ -72,10 +71,25 @@ g_object_get_nth_object (G_OBJECT (menu_item), &search); - if (search.object != NULL) - label = gtk_label_get_label (GTK_LABEL (search.object)); + return search.object != NULL ? GTK_LABEL (search.object) : NULL; +} + +const gchar * +gtk_menu_item_get_nth_label_label (GtkMenuItem *menu_item, + guint index) +{ + GtkLabel *label; + const gchar *label_label; + + g_return_val_if_fail (GTK_IS_MENU_ITEM (menu_item), NULL); + + label = gtk_menu_item_get_nth_label (menu_item, index); + label_label = NULL; - return label != NULL && label[0] != '\0' ? label : NULL; + if (label != NULL) + label_label = gtk_label_get_label (label); + + return label_label != NULL && label_label[0] != '\0' ? label_label : NULL; } static GtkImage * @@ -295,9 +309,13 @@ GParamSpec *pspec, gpointer user_data) { + static const gchar *label_name; + static const gchar *use_underline_name; + UnityGtkMenuItem *item; UnityGtkMenuShell *parent_shell; GObject *menu_item; + const gchar *name; g_return_if_fail (UNITY_GTK_IS_MENU_ITEM (user_data)); @@ -308,24 +326,67 @@ g_return_if_fail (parent_shell != NULL); g_warn_if_fail (object == menu_item); - unity_gtk_menu_shell_handle_item_notify (parent_shell, item, g_param_spec_get_name (pspec)); + if (G_UNLIKELY (label_name == NULL)) + label_name = g_intern_static_string ("label"); + if (G_UNLIKELY (use_underline_name == NULL)) + use_underline_name = g_intern_static_string ("use-underline"); + + name = g_param_spec_get_name (pspec); + + if (name != label_name && name != use_underline_name) + unity_gtk_menu_shell_handle_item_notify (parent_shell, item, name); +} + +static void +unity_gtk_menu_item_handle_label_notify (GObject *object, + GParamSpec *pspec, + gpointer user_data) +{ + static const gchar *label_name; + static const gchar *use_underline_name; + + UnityGtkMenuItem *item; + UnityGtkMenuShell *parent_shell; + const gchar *name; + + g_return_if_fail (UNITY_GTK_IS_MENU_ITEM (user_data)); + + item = UNITY_GTK_MENU_ITEM (user_data); + parent_shell = item->parent_shell; + + g_return_if_fail (parent_shell != NULL); + + if (G_UNLIKELY (label_name == NULL)) + label_name = g_intern_static_string ("label"); + if (G_UNLIKELY (use_underline_name == NULL)) + use_underline_name = g_intern_static_string ("use-underline"); + + name = g_param_spec_get_name (pspec); + + if (name == label_name || name == use_underline_name) + unity_gtk_menu_shell_handle_item_notify (parent_shell, item, name); } static void unity_gtk_menu_item_set_menu_item (UnityGtkMenuItem *item, GtkMenuItem *menu_item) { + GtkLabel *label; + g_return_if_fail (UNITY_GTK_IS_MENU_ITEM (item)); if (menu_item != item->menu_item) { UnityGtkMenuShell *child_shell = item->child_shell; - if (item->menu_item_notify_handler_id) + if (item->menu_item != NULL) { - g_warn_if_fail (item->menu_item != NULL); - g_signal_handler_disconnect (item->menu_item, item->menu_item_notify_handler_id); - item->menu_item_notify_handler_id = 0; + label = gtk_menu_item_get_nth_label (item->menu_item, 0); + + if (label != NULL) + g_signal_handlers_disconnect_by_data (label, item); + + g_signal_handlers_disconnect_by_data (item->menu_item, item); } if (child_shell != NULL) @@ -339,7 +400,20 @@ item->menu_item = menu_item; if (menu_item != NULL) - item->menu_item_notify_handler_id = g_signal_connect (menu_item, "notify", G_CALLBACK (unity_gtk_menu_item_handle_item_notify), item); + { + g_signal_connect (menu_item, "notify", G_CALLBACK (unity_gtk_menu_item_handle_item_notify), item); + + /* ensure label is available */ + gtk_menu_item_get_label (menu_item); + label = gtk_menu_item_get_nth_label (menu_item, 0); + + if (label != NULL) + g_signal_connect (label, "notify", G_CALLBACK (unity_gtk_menu_item_handle_label_notify), item); + + /* LP: #1208019 */ + if (gtk_menu_item_get_submenu (menu_item) != NULL) + g_signal_emit_by_name (gtk_menu_item_get_submenu (menu_item), "show"); + } } } @@ -554,6 +628,8 @@ *out++ = '_'; } + *out++ = '\0'; + return string; } @@ -568,9 +644,9 @@ if (item->label == NULL) { - const gchar *label = gtk_menu_item_get_label (item->menu_item); + const gchar *label_label = gtk_menu_item_get_label (item->menu_item); - if (label != NULL && label[0] != '\0') + if (label_label != NULL && label_label[0] != '\0') { if (GTK_IS_IMAGE_MENU_ITEM (item->menu_item)) { @@ -580,26 +656,28 @@ { GtkStockItem stock_item; - if (gtk_stock_lookup (label, &stock_item)) - label = stock_item.label; + if (gtk_stock_lookup (label_label, &stock_item)) + label_label = stock_item.label; } } } - if (label == NULL || label[0] == '\0') - label = gtk_menu_item_get_nth_label (item->menu_item, 0); + if (label_label == NULL || label_label[0] == '\0') + label_label = gtk_menu_item_get_nth_label_label (item->menu_item, 0); - if (label != NULL && label[0] != '\0') + if (label_label != NULL && label_label[0] != '\0') { - if (gtk_menu_item_get_use_underline (item->menu_item)) + GtkLabel *label = gtk_menu_item_get_nth_label (item->menu_item, 0); + + if (gtk_label_get_use_underline (label)) { if (item->parent_shell == NULL || item->parent_shell->has_mnemonics) - item->label = g_strdup (label); + item->label = g_strdup (label_label); else - item->label = g_strdup_no_mnemonics (label); + item->label = g_strdup_no_mnemonics (label_label); } else - item->label = g_strdup_escape_underscores (label); + item->label = g_strdup_escape_underscores (label_label); } } @@ -709,9 +787,7 @@ g_print ("%s%u (%s *) %p\n", space, item->item_index, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (item)), item); if (item->menu_item != NULL) - g_print ("%s %lu (%s *) %p\n", space, item->menu_item_notify_handler_id, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (item->menu_item)), item->menu_item); - else if (item->menu_item_notify_handler_id) - g_print ("%s %lu\n", space, item->menu_item_notify_handler_id); + g_print ("%s (%s *) %p\n", space, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (item->menu_item)), item->menu_item); if (item->parent_shell != NULL) g_print ("%s (%s *) %p\n", space, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (item->parent_shell)), item->parent_shell); diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-item-private.h unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-item-private.h --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-item-private.h 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-item-private.h 2014-03-28 10:54:08.000000000 +0000 @@ -47,7 +47,6 @@ /*< private >*/ GtkMenuItem *menu_item; - gulong menu_item_notify_handler_id; UnityGtkMenuShell *parent_shell; UnityGtkMenuShell *child_shell; guchar child_shell_valid : 1; @@ -90,7 +89,7 @@ void unity_gtk_menu_item_print (UnityGtkMenuItem *item, guint indent) G_GNUC_INTERNAL; -const gchar * gtk_menu_item_get_nth_label (GtkMenuItem *menu_item, +const gchar * gtk_menu_item_get_nth_label_label (GtkMenuItem *menu_item, guint index) G_GNUC_INTERNAL; G_END_DECLS diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-section.c unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-section.c --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-section.c 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-section.c 2014-03-28 10:54:08.000000000 +0000 @@ -166,7 +166,7 @@ } if (accel_name == NULL) - accel_name = g_strdup (gtk_menu_item_get_nth_label (item->menu_item, 1)); + accel_name = g_strdup (gtk_menu_item_get_nth_label_label (item->menu_item, 1)); if (accel_name != NULL) g_hash_table_insert (*attributes, G_MENU_ATTRIBUTE_ACCEL, g_variant_ref_sink (g_variant_new_string (accel_name))); diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-shell.c unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-shell.c --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-shell.c 2014-03-19 09:03:53.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-shell.c 2014-03-28 10:54:24.000000000 +0000 @@ -731,12 +731,8 @@ if (shell->action_group != NULL) unity_gtk_action_group_disconnect_shell (shell->action_group, shell); - if (shell->menu_shell_insert_handler_id) - { - g_assert (shell->menu_shell != NULL); - g_signal_handler_disconnect (shell->menu_shell, shell->menu_shell_insert_handler_id); - shell->menu_shell_insert_handler_id = 0; - } + if (shell->menu_shell != NULL) + g_signal_handlers_disconnect_by_data (shell->menu_shell, shell); if (separator_indices != NULL) { @@ -771,7 +767,7 @@ { g_object_set_qdata_full (G_OBJECT (menu_shell), menu_shell_quark (), shell, (GDestroyNotify) unity_gtk_menu_shell_clear_menu_shell); - shell->menu_shell_insert_handler_id = g_signal_connect (menu_shell, "insert", G_CALLBACK (unity_gtk_menu_shell_handle_shell_insert), shell); + g_signal_connect (menu_shell, "insert", G_CALLBACK (unity_gtk_menu_shell_handle_shell_insert), shell); } } } @@ -781,8 +777,6 @@ { g_return_if_fail (UNITY_GTK_IS_MENU_SHELL (shell)); - shell->menu_shell_insert_handler_id = 0; - unity_gtk_menu_shell_set_menu_shell (shell, NULL); } @@ -800,7 +794,7 @@ unity_gtk_menu_shell_set_menu_shell (shell, NULL); if (settings != NULL) - g_signal_handlers_disconnect_by_func (settings, unity_gtk_menu_shell_handle_settings_notify, shell); + g_signal_handlers_disconnect_by_data (settings, shell); G_OBJECT_CLASS (unity_gtk_menu_shell_parent_class)->dispose (object); } @@ -997,21 +991,21 @@ g_return_if_fail (UNITY_GTK_IS_MENU_SHELL (shell)); g_return_if_fail (UNITY_GTK_IS_MENU_ITEM (item)); - if (visible_name == NULL) + if (G_UNLIKELY (visible_name == NULL)) visible_name = g_intern_static_string ("visible"); - if (sensitive_name == NULL) + if (G_UNLIKELY (sensitive_name == NULL)) sensitive_name = g_intern_static_string ("sensitive"); - if (label_name == NULL) + if (G_UNLIKELY (label_name == NULL)) label_name = g_intern_static_string ("label"); - if (use_underline_name == NULL) + if (G_UNLIKELY (use_underline_name == NULL)) use_underline_name = g_intern_static_string ("use-underline"); - if (accel_path_name == NULL) + if (G_UNLIKELY (accel_path_name == NULL)) accel_path_name = g_intern_static_string ("accel-path"); - if (active_name == NULL) + if (G_UNLIKELY (active_name == NULL)) active_name = g_intern_static_string ("active"); - if (parent_name == NULL) + if (G_UNLIKELY (parent_name == NULL)) parent_name = g_intern_static_string ("parent"); - if (submenu_name == NULL) + if (G_UNLIKELY (submenu_name == NULL)) submenu_name = g_intern_static_string ("submenu"); name = g_intern_string (property); @@ -1085,9 +1079,7 @@ g_print ("%s(%s *) %p\n", space, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (shell)), shell); if (shell->menu_shell != NULL) - g_print ("%s %lu (%s *) %p\n", space, shell->menu_shell_insert_handler_id, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (shell->menu_shell)), shell->menu_shell); - else if (shell->menu_shell_insert_handler_id) - g_print ("%s %lu\n", space, shell->menu_shell_insert_handler_id); + g_print ("%s (%s *) %p\n", space, G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (shell->menu_shell)), shell->menu_shell); if (shell->items != NULL) { diff -Nru unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-shell.h unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-shell.h --- unity-gtk-module-0.0.0+14.04.20140319/lib/unity-gtk-menu-shell.h 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/lib/unity-gtk-menu-shell.h 2014-03-28 10:54:08.000000000 +0000 @@ -51,7 +51,6 @@ /*< private >*/ GtkMenuShell *menu_shell; - gulong menu_shell_insert_handler_id; gboolean has_mnemonics; GPtrArray *items; GPtrArray *sections; diff -Nru unity-gtk-module-0.0.0+14.04.20140319/src/main.c unity-gtk-module-0.0.0+14.04.20140328/src/main.c --- unity-gtk-module-0.0.0+14.04.20140319/src/main.c 2014-03-19 09:03:41.000000000 +0000 +++ unity-gtk-module-0.0.0+14.04.20140328/src/main.c 2014-03-28 10:54:08.000000000 +0000 @@ -27,7 +27,6 @@ */ static const char * const BLACKLIST[] = { - "Eclipse", "acroread", "emacs", "emacs23", @@ -70,7 +69,6 @@ struct _MenuShellData { GtkWindow *window; - gulong settings_notify_gtk_shell_shows_menubar_handler_id; }; static void (* pre_hijacked_window_realize) (GtkWidget *widget); @@ -589,7 +587,6 @@ { GtkWidget *window; GtkSettings *settings; - MenuShellData *menu_shell_data; g_return_if_fail (GTK_IS_MENU_BAR (widget)); @@ -602,24 +599,22 @@ gtk_window_connect_menu_shell (GTK_WINDOW (window), GTK_MENU_SHELL (widget)); settings = gtk_widget_get_settings (widget); - menu_shell_data = gtk_menu_shell_get_menu_shell_data (GTK_MENU_SHELL (widget)); - menu_shell_data->settings_notify_gtk_shell_shows_menubar_handler_id = g_signal_connect (settings, "notify::gtk-shell-shows-menubar", G_CALLBACK (gtk_settings_handle_gtk_shell_shows_menubar), widget); + g_signal_connect (settings, "notify::gtk-shell-shows-menubar", G_CALLBACK (gtk_settings_handle_gtk_shell_shows_menubar), widget); } static void hijacked_menu_bar_unrealize (GtkWidget *widget) { + GtkSettings *settings; MenuShellData *menu_shell_data; g_return_if_fail (GTK_IS_MENU_BAR (widget)); + settings = gtk_widget_get_settings (widget); menu_shell_data = gtk_menu_shell_get_menu_shell_data (GTK_MENU_SHELL (widget)); - if (menu_shell_data->settings_notify_gtk_shell_shows_menubar_handler_id) - { - g_signal_handler_disconnect (gtk_widget_get_settings (widget), menu_shell_data->settings_notify_gtk_shell_shows_menubar_handler_id); - menu_shell_data->settings_notify_gtk_shell_shows_menubar_handler_id = 0; - } + if (settings != NULL) + g_signal_handlers_disconnect_by_data (settings, widget); if (menu_shell_data->window != NULL) gtk_window_disconnect_menu_shell (menu_shell_data->window, GTK_MENU_SHELL (widget));