#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#include <telepathy-logger/log-manager.h>
#include <libempathy/empathy-call-factory.h>
-#include <libempathy/empathy-log-manager.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-utils.h>
/* Separator */
if (features & (EMPATHY_CONTACT_FEATURE_EDIT |
- EMPATHY_CONTACT_FEATURE_INFO)) {
+ EMPATHY_CONTACT_FEATURE_INFO |
+ EMPATHY_CONTACT_FEATURE_FAVOURITE)) {
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (shell, item);
gtk_widget_show (item);
gtk_widget_show (item);
}
+ /* Favorite checkbox */
+ if (features & EMPATHY_CONTACT_FEATURE_FAVOURITE) {
+ item = empathy_contact_favourite_menu_item_new (contact);
+ gtk_menu_shell_append (shell, item);
+ gtk_widget_show (item);
+ }
+
return menu;
}
empathy_contact_chat_menu_item_activated (GtkMenuItem *item,
EmpathyContact *contact)
{
- empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
+ empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time ());
}
GtkWidget *
image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_MESSAGE,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ gtk_widget_set_sensitive (item, !empathy_contact_is_user (contact));
gtk_widget_show (image);
g_signal_connect (item, "activate",
empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item,
EmpathyContact *contact)
{
- EmpathyCallFactory *factory;
- factory = empathy_call_factory_get ();
- empathy_call_factory_new_call_with_streams (factory, contact, TRUE, FALSE);
+ empathy_call_factory_new_call_with_streams (contact, TRUE, FALSE,
+ gtk_get_current_event_time (), NULL);
}
GtkWidget *
image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VOIP,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_widget_set_sensitive (item, empathy_contact_can_voip_audio (contact));
+ gtk_widget_set_sensitive (item, empathy_contact_can_voip_audio (contact) &&
+ !empathy_contact_is_user (contact));
gtk_widget_show (image);
g_signal_connect (item, "activate",
empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
EmpathyContact *contact)
{
- EmpathyCallFactory *factory;
-
- factory = empathy_call_factory_get ();
- empathy_call_factory_new_call_with_streams (factory, contact, TRUE, TRUE);
+ empathy_call_factory_new_call_with_streams (contact, TRUE, TRUE,
+ gtk_get_current_event_time (), NULL);
}
GtkWidget *
image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VIDEO_CALL,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- gtk_widget_set_sensitive (item, empathy_contact_can_voip_video (contact));
+ gtk_widget_set_sensitive (item, empathy_contact_can_voip_video (contact) &&
+ !empathy_contact_is_user (contact));
gtk_widget_show (image);
g_signal_connect (item, "activate",
GtkWidget *
empathy_contact_log_menu_item_new (EmpathyContact *contact)
{
- EmpathyLogManager *manager;
+ TplLogManager *manager;
gboolean have_log;
GtkWidget *item;
GtkWidget *image;
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
- manager = empathy_log_manager_dup_singleton ();
- have_log = empathy_log_manager_exists (manager,
+ manager = tpl_log_manager_dup_singleton ();
+ have_log = tpl_log_manager_exists (manager,
empathy_contact_get_account (contact),
empathy_contact_get_id (contact),
FALSE);
+
g_object_unref (manager);
item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
- item = gtk_image_menu_item_new_with_mnemonic (_("Send file"));
+ 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_widget_set_sensitive (item, empathy_contact_can_send_files (contact) &&
+ !empathy_contact_is_user (contact));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
return item;
}
-/* FIXME we should check if the contact supports vnc stream tube */
GtkWidget *
empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact)
{
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
- item = gtk_image_menu_item_new_with_mnemonic (_("Share my desktop"));
+ item = gtk_image_menu_item_new_with_mnemonic (_("Share My Desktop"));
image = gtk_image_new_from_icon_name (GTK_STOCK_NETWORK,
GTK_ICON_SIZE_MENU);
- gtk_widget_set_sensitive (item, empathy_contact_can_use_stream_tube (contact));
+ gtk_widget_set_sensitive (item, empathy_contact_can_use_rfb_stream_tube (
+ contact));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
gtk_widget_show (image);
return item;
}
+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;
+}
+
static void
contact_info_menu_item_activate_cb (EmpathyContact *contact)
{
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
- item = gtk_image_menu_item_new_with_mnemonic (_("_Invite to chat room"));
+ item = gtk_image_menu_item_new_with_mnemonic (_("_Invite to Chat Room"));
image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_GROUP_MESSAGE,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ if (empathy_contact_is_user (contact)) {
+ gtk_widget_set_sensitive (item, FALSE);
+ gtk_widget_show (image);
+ return item;
+ }
+
mgr = empathy_chatroom_manager_dup_singleton (NULL);
rooms = empathy_chatroom_manager_get_chatrooms (mgr,
empathy_contact_get_account (contact));