aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-26 10:33:32 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-07-15 18:12:15 +0800
commit015e7e34ba24114d48352f4f5b0dc1a3073625fe (patch)
treedd1cf06352e7efc72168a4ae8bc5b1a9441288bb
parent24f3f86b2bd9c42a9ea9f498980f0d255e35bb32 (diff)
downloadgsoc2013-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
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c1
-rw-r--r--libempathy-gtk/empathy-contact-menu.c20
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);