[empathy] Make Send File context menu choose the first capable contact.



commit 65ebc3c5f77b566def16ef0477109877d82fe185
Author: Travis Reitter <treitter gmail com>
Date:   Wed Aug 11 10:33:40 2010 -0700

    Make Send File context menu choose the first capable contact.

 libempathy-gtk/empathy-individual-menu.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index 61269e7..67baa3d 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -458,17 +458,12 @@ empathy_individual_log_menu_item_new (FolksIndividual *individual)
 }
 
 static void
-individual_file_transfer_menu_item_activate_cb (FolksIndividual *individual)
+empathy_individual_file_transfer_menu_item_activated (GtkMenuItem *item,
+    EmpathyContact *contact)
 {
-  EmpathyContact *contact;
-
-  contact = empathy_contact_dup_from_folks_individual (individual);
-
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
   empathy_send_file_with_file_chooser (contact);
-
-  g_object_unref (contact);
 }
 
 GtkWidget *
@@ -476,25 +471,18 @@ empathy_individual_file_transfer_menu_item_new (FolksIndividual *individual)
 {
   GtkWidget *item;
   GtkWidget *image;
-  EmpathyContact *contact;
 
   g_return_val_if_fail (FOLKS_IS_INDIVIDUAL (individual), NULL);
 
-  contact = empathy_contact_dup_from_folks_individual (individual);
-
-  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
-
   item = gtk_image_menu_item_new_with_mnemonic (_("Send File"));
   image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_DOCUMENT_SEND,
-                GTK_ICON_SIZE_MENU);
-  gtk_widget_set_sensitive (item, empathy_contact_can_send_files (contact));
+      GTK_ICON_SIZE_MENU);
   gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
   gtk_widget_show (image);
 
-  g_signal_connect_swapped (item, "activate",
-      G_CALLBACK (individual_file_transfer_menu_item_activate_cb), individual);
-
-  g_object_unref (contact);
+  menu_item_set_first_contact (item, individual,
+      G_CALLBACK (empathy_individual_file_transfer_menu_item_activated),
+      empathy_contact_can_send_files);
 
   return item;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]