diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-30 19:38:21 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-04-02 15:28:47 +0800 |
commit | 34d921f36ef396aa81cf6491d932fe51c2a23283 (patch) | |
tree | 73ad8f37ca1c3f9248cd517fa43f6fca3b083435 /src/empathy-accounts-dialog.c | |
parent | e511539f836d06b5ca05ffabccbce4e432f6b0c7 (diff) | |
download | gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar.gz gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar.bz2 gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar.lz gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar.xz gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.tar.zst gsoc2013-empathy-34d921f36ef396aa81cf6491d932fe51c2a23283.zip |
replace Enable/Disable menu items by a check item
https://bugzilla.gnome.org/show_bug.cgi?id=673159
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r-- | src/empathy-accounts-dialog.c | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index fb679ba3c..93b8c781b 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1742,8 +1742,7 @@ accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view, GtkTreePath *path = NULL; GtkTreeIter iter; GtkWidget *menu; - GtkWidget *item_enable, *item_disable; - GtkWidget *image_enable, *image_disable; + GtkWidget *item; /* ignore multiple clicks */ if (event->type != GDK_BUTTON_PRESS) @@ -1766,49 +1765,28 @@ accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view, /* Create the menu */ menu = empathy_context_menu_new (GTK_WIDGET (view)); - /* Get images for menu items */ - image_enable = gtk_image_new_from_icon_name (empathy_icon_name_for_presence ( - tp_account_manager_get_most_available_presence ( - priv->account_manager, NULL, NULL)), - GTK_ICON_SIZE_MENU); - image_disable = gtk_image_new_from_icon_name ( - empathy_icon_name_for_presence (TP_CONNECTION_PRESENCE_TYPE_OFFLINE), - GTK_ICON_SIZE_MENU); - - /* Menu items: to enabled/disable the account */ - item_enable = gtk_image_menu_item_new_with_mnemonic (_("_Enable")); - item_disable = gtk_image_menu_item_new_with_mnemonic (_("_Disable")); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_enable), - image_enable); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_disable), - image_disable); - - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_enable); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_disable); + /* Menu item: to enabled/disable the account */ + item = gtk_check_menu_item_new_with_mnemonic (_("_Enabled")); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); if (account_can_be_enabled (account)) { - if (tp_account_is_enabled (account)) - { - tp_g_signal_connect_object (item_disable, "activate", - G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0); - gtk_widget_set_sensitive (item_enable, FALSE); - } - else - { - tp_g_signal_connect_object (item_enable, "activate", - G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0); - gtk_widget_set_sensitive (item_disable, FALSE); - } + gboolean active; + + active = tp_account_is_enabled (account); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), + active); + + tp_g_signal_connect_object (item, "activate", + G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0); } else { - gtk_widget_set_sensitive (item_enable, FALSE); - gtk_widget_set_sensitive (item_disable, FALSE); + gtk_widget_set_sensitive (item, FALSE); } - gtk_widget_show (item_enable); - gtk_widget_show (item_disable); + gtk_widget_show (item); /* FIXME: Add here presence items, to be able to set per-account presence */ |