diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-09 18:20:33 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-15 16:28:41 +0800 |
commit | 8df2cf237283de1b049b4c24b0906384e45c4320 (patch) | |
tree | 50bd1f3505d3f06cbda51c07692ec25ea498e796 | |
parent | 27591216de0bdbf8cfecd562414faa34138a1a52 (diff) | |
download | gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar.gz gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar.bz2 gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar.lz gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar.xz gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.tar.zst gsoc2013-empathy-8df2cf237283de1b049b4c24b0906384e45c4320.zip |
Add 'favorite' checkbox to the contact menu
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.c | 49 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-menu.h | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index 54bb4b286..47f68e8eb 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -112,6 +112,13 @@ empathy_contact_menu_new (EmpathyContact *contact, gtk_menu_shell_append (shell, item); gtk_widget_show (item); +#if HAVE_FAVOURITE_CONTACTS + /* Favorite checkbox */ + item = empathy_contact_favourite_menu_item_new (contact); + gtk_menu_shell_append (shell, item); + gtk_widget_show (item); +#endif + /* Separator */ if (features & (EMPATHY_CONTACT_FEATURE_EDIT | EMPATHY_CONTACT_FEATURE_INFO)) { @@ -396,6 +403,48 @@ empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact) return item; } +#if HAVE_FAVOURITE_CONTACTS +static void +favourite_menu_item_toggled_cb (GtkCheckMenuItem *item, + EmpathyContact *contact) +{ + EmpathyContactManager *manager; + EmpathyContactList *list; + + manager = empathy_contact_manager_dup_singleton (); + list = EMPATHY_CONTACT_LIST (manager); + + if (gtk_check_menu_item_get_active (item)) { + empathy_contact_list_add_to_favourites (list, contact); + } else { + empathy_contact_list_remove_from_favourites (list, contact); + } + + g_object_unref (manager); +} + +GtkWidget * +empathy_contact_favourite_menu_item_new (EmpathyContact *contact) +{ + GtkWidget *item; + EmpathyContactManager *manager; + + item = gtk_check_menu_item_new_with_label (_("Favorite")); + + manager = empathy_contact_manager_dup_singleton (); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), + empathy_contact_list_is_favourite (EMPATHY_CONTACT_LIST (manager), + contact)); + + g_signal_connect (item, "toggled", + G_CALLBACK (favourite_menu_item_toggled_cb), + contact); + + g_object_unref (manager); + return item; +} +#endif + static void contact_info_menu_item_activate_cb (EmpathyContact *contact) { diff --git a/libempathy-gtk/empathy-contact-menu.h b/libempathy-gtk/empathy-contact-menu.h index 2c623e6ba..25f18e03f 100644 --- a/libempathy-gtk/empathy-contact-menu.h +++ b/libempathy-gtk/empathy-contact-menu.h @@ -50,6 +50,7 @@ GtkWidget * empathy_contact_edit_menu_item_new (EmpathyContact *cont GtkWidget * empathy_contact_invite_menu_item_new (EmpathyContact *contact); GtkWidget * empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact); GtkWidget * empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact); +GtkWidget * empathy_contact_favourite_menu_item_new (EmpathyContact *contact); G_END_DECLS |