diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-10-02 23:19:53 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-10-02 23:19:53 +0200 |
commit | 910a1eb17c10443d50a6c3d2ac86bcfc7d970612 (patch) | |
tree | 7d1a19d9f473239aa30dbf225352968177fa54f6 /src/ido-menu-item.c | |
parent | 213c3d37aee885e6767d800f66b0d55b39801c3c (diff) | |
parent | 78f8f75ee73478ecb704aecc467c861fa4558b52 (diff) | |
download | ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.tar.gz ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.tar.bz2 ayatana-indicator-messages-910a1eb17c10443d50a6c3d2ac86bcfc7d970612.zip |
* New upstream release:
- don't segfault if .desktop file is not installed (lp: #1058386)
- Use fallback icon names (without status emblems).
(lp: #1056595)
Diffstat (limited to 'src/ido-menu-item.c')
-rw-r--r-- | src/ido-menu-item.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/ido-menu-item.c b/src/ido-menu-item.c index 6b19d2a..32044ff 100644 --- a/src/ido-menu-item.c +++ b/src/ido-menu-item.c @@ -99,8 +99,37 @@ ido_menu_item_set_state (IdoMenuItem *self, if (priv->target) { ido_menu_item_set_has_indicator (self, TRUE); + ido_menu_item_set_active (self, FALSE); gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (self), TRUE); - ido_menu_item_set_active (self, g_variant_equal (priv->target, state)); + gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (self), FALSE); + + if (g_variant_is_of_type (state, G_VARIANT_TYPE_STRING)) + { + ido_menu_item_set_active (self, g_variant_equal (priv->target, state)); + } + else if (g_variant_is_of_type (state, G_VARIANT_TYPE ("as")) && + g_variant_is_of_type (priv->target, G_VARIANT_TYPE_STRING)) + { + const gchar *target_str; + const gchar **state_strs; + const gchar **it; + + target_str = g_variant_get_string (priv->target, NULL); + state_strs = g_variant_get_strv (state, NULL); + + it = state_strs; + while (*it != NULL && !g_str_equal (*it, target_str)) + it++; + + if (*it != NULL) + { + ido_menu_item_set_active (self, TRUE); + gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (self), + g_strv_length ((gchar **)state_strs) > 1); + } + + g_free (state_strs); + } } else if (g_variant_is_of_type (state, G_VARIANT_TYPE_BOOLEAN)) { @@ -258,7 +287,8 @@ ido_menu_item_activate (GtkMenuItem *item) if (!priv->in_set_active && priv->action && priv->action_group) g_action_group_activate_action (priv->action_group, priv->action, priv->target); - GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item); + if (priv->in_set_active) + GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item); } static void |