From 5c88df7dcff3fcb98507a9b1c073bb5b23e1487d Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Mon, 27 Aug 2012 16:13:36 +0200 Subject: IdoMenuItem: don't try to set state on stateless actions --- src/app-section.c | 7 ++++++- src/ido-menu-item.c | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/app-section.c b/src/app-section.c index 0487fbb..d4bc3dd 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -346,6 +346,7 @@ app_section_set_app_info (AppSection *self, for (i = 0; nicks[i] != NULL; i++) { gchar *name; GSimpleAction *action; + GMenuItem *item; name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]); @@ -354,8 +355,12 @@ app_section_set_app_info (AppSection *self, g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action)); g_object_unref (action); - g_menu_append (priv->menu, name, nicks[i]); + item = g_menu_item_new (name, nicks[i]); + g_menu_item_set_attribute (item, "x-canonical-type", "s", "IdoMenuItem"); + g_menu_item_set_attribute (item, "x-canonical-icon", "s", ""); /* empty to get indentation */ + g_menu_append_item (priv->menu, item); + g_object_unref (item); g_free(name); } diff --git a/src/ido-menu-item.c b/src/ido-menu-item.c index 391f0df..c2a8309 100644 --- a/src/ido-menu-item.c +++ b/src/ido-menu-item.c @@ -132,10 +132,12 @@ ido_menu_item_set_action_name (IdoMenuItem *self, &enabled, ¶m_type, NULL, NULL, &state)) { gtk_widget_set_sensitive (GTK_WIDGET (self), enabled); - ido_menu_item_set_state (self, state); if (state) - g_variant_unref (state); + { + ido_menu_item_set_state (self, state); + g_variant_unref (state); + } } else { -- cgit v1.2.3