#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#ifdef ENABLE_TPL
+#include <telepathy-logger/log-manager.h>
+#else
-#include <libempathy/empathy-call-factory.h>
#include <libempathy/empathy-log-manager.h>
+#endif /* ENABLE_TPL */
+#include <libempathy/empathy-call-factory.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-utils.h>
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
+
return menu;
}
GtkWidget *
empathy_contact_log_menu_item_new (EmpathyContact *contact)
{
+#ifndef ENABLE_TPL
EmpathyLogManager *manager;
+#else
+ TplLogManager *manager;
+#endif /* ENABLE_TPL */
gboolean have_log;
GtkWidget *item;
GtkWidget *image;
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+#ifndef ENABLE_TPL
manager = empathy_log_manager_dup_singleton ();
have_log = empathy_log_manager_exists (manager,
empathy_contact_get_account (contact),
empathy_contact_get_id (contact),
FALSE);
+#else
+ manager = tpl_log_manager_dup_singleton ();
+ have_log = tpl_log_manager_exists (manager,
+ empathy_contact_get_account (contact),
+ empathy_contact_get_id (contact),
+ FALSE);
+#endif /* ENABLE_TPL */
g_object_unref (manager);
item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
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)
{
static void
room_sub_menu_data_free (RoomSubMenuData *data)
{
- /* FIXME: seems this is never called... */
g_object_unref (data->contact);
g_object_unref (data->chatroom);
g_slice_free (RoomSubMenuData, data);