diff options
author | Davyd Madeley <davyd@madeley.id.au> | 2009-04-26 10:33:32 +0800 |
---|---|---|
committer | Davyd Madeley <davyd@madeley.id.au> | 2009-07-15 18:12:15 +0800 |
commit | 015e7e34ba24114d48352f4f5b0dc1a3073625fe (patch) | |
tree | dd1cf06352e7efc72168a4ae8bc5b1a9441288bb /libempathy-gtk/empathy-contact-menu.c | |
parent | 24f3f86b2bd9c42a9ea9f498980f0d255e35bb32 (diff) | |
download | gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar.gz gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar.bz2 gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar.lz gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar.xz gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.tar.zst gsoc2013-empathy-015e7e34ba24114d48352f4f5b0dc1a3073625fe.zip |
Only enable the 'Edit' menu option when the CAN_ALIAS or CAN_GROUP are set
Diffstat (limited to 'libempathy-gtk/empathy-contact-menu.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 20 |
1 files changed, 20 insertions, 0 deletions
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); |