diff options
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 1 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index d187b0d73..fc096b288 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -1508,7 +1508,6 @@ empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view) } flags = empathy_contact_list_view_get_flags (view); - /* FIXME: how to get the contact list flags in empathy_contact_menu_new() */ menu = empathy_contact_menu_new (contact, priv->contact_features); /* Remove contact */ diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index 2bad5c9fe..f6d1ca154 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -31,6 +31,7 @@ #include <libempathy/empathy-dispatcher.h> #include <libempathy/empathy-utils.h> #include <libempathy/empathy-chatroom-manager.h> +#include <libempathy/empathy-contact-manager.h> #include "empathy-contact-menu.h" #include "empathy-images.h" @@ -306,17 +307,36 @@ contact_edit_menu_item_activate_cb (EmpathyContact *contact) GtkWidget * empathy_contact_edit_menu_item_new (EmpathyContact *contact) { + EmpathyContactManager *manager; GtkWidget *item; GtkWidget *image; + gboolean enable = FALSE; g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + if (empathy_contact_manager_initialized ()) { + TpConnection *connection; + EmpathyContactListFlags flags; + + manager = empathy_contact_manager_dup_singleton (); + connection = empathy_contact_get_connection (contact); + flags = empathy_contact_manager_get_flags_for_connection ( + manager, connection); + + enable = (flags & EMPATHY_CONTACT_LIST_CAN_ALIAS || + flags & EMPATHY_CONTACT_LIST_CAN_GROUP); + + g_object_unref (manager); + } + item = gtk_image_menu_item_new_with_mnemonic (_("_Edit")); image = gtk_image_new_from_icon_name (GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); gtk_widget_show (image); + gtk_widget_set_sensitive (item, enable); + g_signal_connect_swapped (item, "activate", G_CALLBACK (contact_edit_menu_item_activate_cb), contact); |