diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-06-23 21:10:17 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2014-06-23 21:36:25 +0800 |
commit | 1f9230409b3e8bdba369a994102b53a9e591ba6e (patch) | |
tree | 3e24afd1c3e3c444bffb53e1313f9a532b26b297 /libempathy-gtk | |
parent | ad1b40b1d31b4c612a94736f27072baab4ac1364 (diff) | |
download | gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar.gz gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar.bz2 gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar.lz gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar.xz gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.tar.zst gsoc2013-empathy-1f9230409b3e8bdba369a994102b53a9e591ba6e.zip |
individual-menu: use the proper persona in submenus
'single_individual' uses to be a FolksIndivudal containing a single persona
(the one from the submenu) ensuring that operations (chat, call, etc) were
performed on this very persona.
But we broke this in 0909d1f884c4542553d98b18e7622664d2a02169 by replacing the
empathy_create_individual_from_tp_contact() call by
empathy_ensure_individual_from_tp_contact() as the same individuals (the one
will all the personas) was now used in all the sub menus.
Fixing this by introducing 'contact' variant of the menu_item_new methods
which is always cleaner.
https://bugzilla.gnome.org/show_bug.cgi?id=732100
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 155 |
1 files changed, 146 insertions, 9 deletions
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index 6759cc51a..ae489a77a 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -74,17 +74,34 @@ G_DEFINE_TYPE (EmpathyIndividualMenu, empathy_individual_menu, GTK_TYPE_MENU); static GtkWidget * chat_menu_item_new_individual (EmpathyIndividualMenu *self, FolksIndividual *individual); +static GtkWidget * chat_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact); static GtkWidget * sms_menu_item_new_individual (EmpathyIndividualMenu *self, FolksIndividual *individual); +static GtkWidget * sms_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact); +static GtkWidget * audio_call_menu_item_new_contact ( + EmpathyIndividualMenu *self, + EmpathyContact *contact); +static GtkWidget * video_call_menu_item_new_contact ( + EmpathyIndividualMenu *self, + EmpathyContact *contact); static GtkWidget * log_menu_item_new_individual (FolksIndividual *individual); +static GtkWidget * log_menu_item_new_contact (EmpathyContact *contact); static GtkWidget * info_menu_item_new_individual (FolksIndividual *individual); static GtkWidget * edit_menu_item_new_individual (FolksIndividual *individual); static GtkWidget * invite_menu_item_new (FolksIndividual *individual, EmpathyContact *contact); static GtkWidget * file_transfer_menu_item_new_individual (EmpathyIndividualMenu *self, FolksIndividual *individual); +static GtkWidget * file_transfer_menu_item_new_contact ( + EmpathyIndividualMenu *self, + EmpathyContact *contact); static GtkWidget * share_my_desktop_menu_item_new_individual (EmpathyIndividualMenu *self, FolksIndividual *individual); +static GtkWidget * share_my_desktop_menu_item_new_contact ( + EmpathyIndividualMenu *self, + EmpathyContact *contact); static GtkWidget * favourite_menu_item_new_individual (FolksIndividual *individual); static GtkWidget * add_menu_item_new_individual (EmpathyIndividualMenu *self, FolksIndividual *individual); @@ -186,7 +203,7 @@ individual_menu_add_personas (EmpathyIndividualMenu *self, /* Chat */ if (features & EMPATHY_INDIVIDUAL_FEATURE_CHAT) { - action = chat_menu_item_new_individual (self, single_individual); + action = chat_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); } @@ -194,7 +211,7 @@ individual_menu_add_personas (EmpathyIndividualMenu *self, /* SMS */ if (features & EMPATHY_INDIVIDUAL_FEATURE_SMS) { - action = sms_menu_item_new_individual (self, single_individual); + action = sms_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); } @@ -202,14 +219,12 @@ individual_menu_add_personas (EmpathyIndividualMenu *self, if (features & EMPATHY_INDIVIDUAL_FEATURE_CALL) { /* Audio Call */ - action = empathy_individual_audio_call_menu_item_new_individual ( - self, single_individual); + action = audio_call_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); /* Video Call */ - action = empathy_individual_video_call_menu_item_new_individual ( - self, single_individual); + action = video_call_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); } @@ -217,7 +232,7 @@ individual_menu_add_personas (EmpathyIndividualMenu *self, /* Log */ if (features & EMPATHY_INDIVIDUAL_FEATURE_LOG) { - action = log_menu_item_new_individual (single_individual); + action = log_menu_item_new_contact (contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); } @@ -230,13 +245,13 @@ individual_menu_add_personas (EmpathyIndividualMenu *self, /* File transfer */ if (features & EMPATHY_INDIVIDUAL_FEATURE_FILE_TRANSFER) { - action = file_transfer_menu_item_new_individual (self, single_individual); + action = file_transfer_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); } /* Share my desktop */ - action = share_my_desktop_menu_item_new_individual (self, single_individual); + action = share_my_desktop_menu_item_new_contact (self, contact); gtk_menu_shell_append (GTK_MENU_SHELL (contact_submenu), action); gtk_widget_show (action); @@ -1386,6 +1401,23 @@ chat_menu_item_new_individual (EmpathyIndividualMenu *self, return item; } +static GtkWidget * +chat_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = chat_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_chat_menu_item_activated), + EMPATHY_ACTION_CHAT); + + return item; +} + static void empathy_individual_sms_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) @@ -1436,6 +1468,24 @@ sms_menu_item_new_individual (EmpathyIndividualMenu *self, return item; } +static GtkWidget * +sms_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = sms_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_sms_menu_item_activated), + EMPATHY_ACTION_SMS); + + return item; +} + + static void empathy_individual_audio_call_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) @@ -1483,6 +1533,25 @@ empathy_individual_audio_call_menu_item_new_individual ( return item; } +static GtkWidget * +audio_call_menu_item_new_contact ( + EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = audio_call_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_audio_call_menu_item_activated), + EMPATHY_ACTION_AUDIO_CALL); + + return item; +} + + static void empathy_individual_video_call_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) @@ -1549,6 +1618,24 @@ empathy_individual_video_call_menu_item_new_individual ( return item; } +GtkWidget * +video_call_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = video_call_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_video_call_menu_item_activated), + EMPATHY_ACTION_VIDEO_CALL); + + check_camera_available (item); + + return item; +} static void empathy_individual_log_menu_item_activated (GtkMenuItem *item, @@ -1590,6 +1677,22 @@ log_menu_item_new_individual (FolksIndividual *individual) return item; } +static GtkWidget * +log_menu_item_new_contact (EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = log_menu_item_new (); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_log_menu_item_activated), + EMPATHY_ACTION_VIEW_LOGS); + + return item; +} + static void empathy_individual_file_transfer_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) @@ -1635,6 +1738,23 @@ file_transfer_menu_item_new_individual (EmpathyIndividualMenu *self, return item; } +static GtkWidget * +file_transfer_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = file_transfer_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_file_transfer_menu_item_activated), + EMPATHY_ACTION_SEND_FILE); + + return item; +} + static void empathy_individual_share_my_desktop_menu_item_activated (GtkMenuItem *item, EmpathyContact *contact) @@ -1679,6 +1799,23 @@ share_my_desktop_menu_item_new_individual (EmpathyIndividualMenu *self, return item; } +static GtkWidget * +share_my_desktop_menu_item_new_contact (EmpathyIndividualMenu *self, + EmpathyContact *contact) +{ + GtkWidget *item; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = share_my_desktop_menu_item_new (self); + + menu_item_set_contact (item, contact, + G_CALLBACK (empathy_individual_share_my_desktop_menu_item_activated), + EMPATHY_ACTION_SHARE_MY_DESKTOP); + + return item; +} + static void favourite_menu_item_toggled_cb (GtkCheckMenuItem *item, FolksIndividual *individual) |