コード例 #1
0
GtkWidget *
empathy_contact_log_menu_item_new (EmpathyContact *contact)
{
	EmpathyLogManager *manager;
	gboolean           have_log;
	GtkWidget         *item;
	GtkWidget         *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	manager = empathy_log_manager_new ();
	have_log = empathy_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 (_("_View Previous Conversations"));
	image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_LOG,
					      GTK_ICON_SIZE_MENU);
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
	gtk_widget_set_sensitive (item, have_log);
	gtk_widget_show (image);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (contact_log_menu_item_activate_cb),
				  contact);
	
	return item;
}
コード例 #2
0
static gboolean
contact_manager_is_favourite (EmpathyContactList *manager,
			      EmpathyContact     *contact)
{
	EmpathyContactManagerPriv *priv;
	TpAccount *account;
	const gchar *account_name;
	GHashTable *contact_hash;

	g_return_val_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager), FALSE);
	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);

	priv = GET_PRIV (manager);

	account = empathy_contact_get_account (contact);
	account_name = tp_proxy_get_object_path (TP_PROXY (account));
	contact_hash = g_hash_table_lookup (priv->favourites, account_name);

	if (contact_hash != NULL) {
		const gchar *contact_id = empathy_contact_get_id (contact);

		if (g_hash_table_lookup (contact_hash, contact_id) != NULL)
			return TRUE;
	}

	return FALSE;
}
コード例 #3
0
/**
 * empathy_ft_handler_new_outgoing:
 * @contact: the #EmpathyContact to send @source to
 * @source: the #GFile to send
 * @callback: callback to be called when the handler has been created
 * @user_data: user data to be passed to @callback
 *
 * Triggers the creation of a new #EmpathyFTHandler for an outgoing transfer.
 */
void
empathy_ft_handler_new_outgoing (EmpathyContact *contact,
    GFile *source,
    EmpathyFTHandlerReadyCallback callback,
    gpointer user_data)
{
  EmpathyFTHandler *handler;
  CallbacksData *data;
  EmpathyFTHandlerPriv *priv;

  DEBUG ("New handler outgoing");

  g_return_if_fail (EMPATHY_IS_CONTACT (contact));
  g_return_if_fail (G_IS_FILE (source));

  handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
      "contact", contact, "gfile", source, NULL);

  priv = GET_PRIV (handler);

  data = g_slice_new0 (CallbacksData);
  data->callback = callback;
  data->user_data = user_data;
  data->handler = g_object_ref (handler);

  /* start collecting info about the file */
  g_file_query_info_async (priv->gfile,
      G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
      G_FILE_ATTRIBUTE_STANDARD_SIZE ","
      G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
      G_FILE_ATTRIBUTE_STANDARD_TYPE ","
      G_FILE_ATTRIBUTE_TIME_MODIFIED,
      G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT,
      NULL, (GAsyncReadyCallback) ft_handler_gfile_ready_cb, data);
}
コード例 #4
0
void
empathy_contact_information_dialog_show (EmpathyContact *contact,
					 GtkWindow      *parent)
{
	GtkWidget *dialog;
	GtkWidget *button;
	GtkWidget *contact_widget;
	GList     *l;

	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	l = g_list_find_custom (information_dialogs,
				contact,
				(GCompareFunc) contact_dialogs_find);
	if (l) {
		gtk_window_present (GTK_WINDOW (l->data));
		return;
	}

	/* Create dialog */
	dialog = gtk_dialog_new ();
	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
	gtk_window_set_title (GTK_WINDOW (dialog),
		empathy_contact_get_name (contact));

	/* Close button */
	button = gtk_button_new_with_label (GTK_STOCK_CLOSE);
	gtk_button_set_use_stock (GTK_BUTTON (button), TRUE);
	gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
				      button,
				      GTK_RESPONSE_CLOSE);
	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
	gtk_window_set_default (GTK_WINDOW (dialog), button);
	gtk_widget_show (button);

	/* Contact info widget */
	contact_widget = empathy_contact_widget_new (contact,
		EMPATHY_CONTACT_WIDGET_SHOW_LOCATION |
		EMPATHY_CONTACT_WIDGET_EDIT_NONE);
	gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
			    contact_widget,
			    TRUE, TRUE, 0);
	gtk_widget_show (contact_widget);

	g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
	information_dialogs = g_list_prepend (information_dialogs, dialog);

	g_signal_connect (dialog, "response",
			  G_CALLBACK (contact_dialogs_response_cb),
			  &information_dialogs);

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
	}

	gtk_widget_show (dialog);
}
コード例 #5
0
GtkWidget *
empathy_contact_add_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	GtkWidget *image;
	EmpathyContactManager *manager;
	TpConnection *connection;
	GList *l, *members;
	gboolean found = FALSE;
	EmpathyContactListFlags flags;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	if (!empathy_contact_manager_initialized ()) {
		return NULL;
	}

	manager = empathy_contact_manager_dup_singleton ();
	connection = empathy_contact_get_connection (contact);

	flags = empathy_contact_manager_get_flags_for_connection (manager,
			connection);

	if (!(flags & EMPATHY_CONTACT_LIST_CAN_ADD)) {
		return NULL;
	}

	members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (manager));
	for (l = members; l; l = l->next) {
		if (!found && empathy_contact_equal (l->data, contact)) {
			found = TRUE;
			/* we keep iterating so that we don't leak contact
			 * refs */
		}

		g_object_unref (l->data);
	}
	g_list_free (members);
	g_object_unref (manager);

	if (found) {
		return NULL;
	}

	item = gtk_image_menu_item_new_with_mnemonic (_("_Add Contact…"));
	image = gtk_image_new_from_icon_name (GTK_STOCK_ADD,
					      GTK_ICON_SIZE_MENU);
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);

	g_signal_connect (item, "activate",
			G_CALLBACK (empathy_contact_add_menu_item_activated),
			contact);

	return item;
}
コード例 #6
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
const gchar *
empathy_icon_name_for_contact (EmpathyContact *contact)
{
  TpConnectionPresenceType presence;

  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact),
      EMPATHY_IMAGE_OFFLINE);

  presence = empathy_contact_get_presence (contact);
  return empathy_icon_name_for_presence (presence);
}
コード例 #7
0
/**
 * empathy_ft_factory_new_transfer_outgoing:
 * @factory: an #EmpathyFTFactory
 * @contact: the #EmpathyContact destination of the transfer
 * @source: the #GFile to be transferred to @contact
 *
 * Trigger the creation of an #EmpathyFTHandler object to send @source to
 * the specified @contact.
 */
void
empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
    EmpathyContact *contact,
    GFile *source)
{
  g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
  g_return_if_fail (EMPATHY_IS_CONTACT (contact));
  g_return_if_fail (G_IS_FILE (source));

  empathy_ft_handler_new_outgoing (contact, source,
      ft_handler_outgoing_ready_cb, factory);
}
コード例 #8
0
void
empathy_contact_list_remove (EmpathyContactList *list,
			     EmpathyContact     *contact,
			     const gchar        *message)
{
	g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove) {
		EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove (list, contact, message);
	}
}
コード例 #9
0
void
empathy_subscription_dialog_show (EmpathyContact *contact,
				  GtkWindow     *parent)
{
	GtkBuilder *gui;
	GtkWidget *dialog;
	GtkWidget *hbox_subscription;
	GtkWidget *contact_widget;
	GList     *l;
	gchar     *filename;

	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	l = g_list_find_custom (subscription_dialogs,
				contact,
				(GCompareFunc) contact_dialogs_find);
	if (l) {
		gtk_window_present (GTK_WINDOW (l->data));
		return;
	}

	filename = empathy_file_lookup ("empathy-contact-dialogs.ui",
					"libempathy-gtk");
	gui = empathy_builder_get_file (filename,
				      "subscription_request_dialog", &dialog,
				      "hbox_subscription", &hbox_subscription,
				      NULL);
	g_free (filename);
	g_object_unref (gui);

	/* Contact info widget */
	contact_widget = empathy_contact_widget_new (contact,
						     EMPATHY_CONTACT_WIDGET_EDIT_ALIAS |
						     EMPATHY_CONTACT_WIDGET_EDIT_GROUPS);
	gtk_box_pack_end (GTK_BOX (hbox_subscription),
			  contact_widget,
			  TRUE, TRUE,
			  0);
	gtk_widget_show (contact_widget);

	g_object_set_data (G_OBJECT (dialog), "contact_widget", contact_widget);
	subscription_dialogs = g_list_prepend (subscription_dialogs, dialog);

	g_signal_connect (dialog, "response",
			  G_CALLBACK (subscription_dialog_response_cb),
			  contact_widget);

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
	}

	gtk_widget_show (dialog);
}
コード例 #10
0
GtkWidget *
empathy_contact_invite_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	GtkWidget *image;
	GtkWidget *room_item;
	EmpathyChatroomManager *mgr;
	GList *rooms, *l;
	GtkWidget *submenu = NULL;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	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));

	for (l = rooms; l != NULL; l = g_list_next (l)) {
		EmpathyChatroom *chatroom = l->data;

		if (empathy_chatroom_get_tp_chat (chatroom) != NULL) {
			if (G_UNLIKELY (submenu == NULL))
				submenu = gtk_menu_new ();

			room_item = create_room_sub_menu (contact, chatroom);
			gtk_menu_shell_append ((GtkMenuShell *) submenu, room_item);
			gtk_widget_show (room_item);
		}
	}

	if (submenu) {
		gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
	} else {
		gtk_widget_set_sensitive (item, FALSE);
	}

	gtk_widget_show (image);

	g_object_unref (mgr);
	g_list_free (rooms);

	return item;
}
コード例 #11
0
void
empathy_contact_list_remove_from_group (EmpathyContactList *list,
					EmpathyContact     *contact,
					const gchar        *group)
{
	g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));
	g_return_if_fail (group != NULL);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_from_group) {
		EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_from_group (list, contact, group);
	}
}
コード例 #12
0
GList *
empathy_contact_list_get_groups (EmpathyContactList *list,
				 EmpathyContact     *contact)
{
	g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), NULL);
	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_groups) {
		return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_groups (list, contact);
	}

	return NULL;
}
コード例 #13
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
GdkPixbuf *
empathy_pixbuf_avatar_from_contact_scaled (EmpathyContact *contact,
    gint width,
    gint height)
{
  EmpathyAvatar *avatar;

  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

  avatar = empathy_contact_get_avatar (contact);

  return empathy_pixbuf_from_avatar_scaled (avatar, width, height);
}
コード例 #14
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
const gchar *
empathy_protocol_name_for_contact (EmpathyContact *contact)
{
  TpAccount *account;

  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

  account = empathy_contact_get_account (contact);
  if (account == NULL)
    return NULL;

  return tp_account_get_icon_name (account);
}
コード例 #15
0
/**
 * empathy_contact_widget_set_contact:
 * @widget: an #EmpathyContactWidget
 * @contact: a different #EmpathyContact
 *
 * Change the #EmpathyContact related with the #EmpathyContactWidget @widget.
 */
void
empathy_contact_widget_set_contact (GtkWidget *widget,
                                    EmpathyContact *contact)
{
  EmpathyContactWidget *information;

  g_return_if_fail (GTK_IS_WIDGET (widget));
  g_return_if_fail (EMPATHY_IS_CONTACT (contact));

  information = g_object_get_data (G_OBJECT (widget), "EmpathyContactWidget");
  if (!information)
    return;

  contact_widget_set_contact (information, contact);
}
コード例 #16
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
GdkPixbuf *
empathy_pixbuf_contact_status_icon (EmpathyContact *contact,
    gboolean show_protocol)
{
  const gchar *icon_name;

  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

  icon_name = empathy_icon_name_for_contact (contact);

  if (icon_name == NULL)
    return NULL;

  return empathy_pixbuf_contact_status_icon_with_icon_name (contact,
      icon_name, show_protocol);
}
コード例 #17
0
ファイル: empathy-tp-chat.c プロジェクト: james-w/empathy
static void
tp_chat_remove (EmpathyContactList *list,
		EmpathyContact     *contact,
		const gchar        *message)
{
	EmpathyTpChatPriv *priv = GET_PRIV (list);
	TpHandle           handle;
	GArray             handles = {(gchar *) &handle, 1};

	g_return_if_fail (EMPATHY_IS_TP_CHAT (list));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	handle = empathy_contact_get_handle (contact);
	tp_cli_channel_interface_group_call_remove_members (priv->channel, -1,
							    &handles, NULL,
							    NULL, NULL, NULL,
							    NULL);
}
コード例 #18
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
void
empathy_send_file_with_file_chooser (EmpathyContact *contact)
{
  GtkWidget *widget;
  GtkWidget *button;

  g_return_if_fail (EMPATHY_IS_CONTACT (contact));

  DEBUG ("Creating selection file chooser");

  widget = gtk_file_chooser_dialog_new (_("Select a file"), NULL,
      GTK_FILE_CHOOSER_ACTION_OPEN,
      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
      NULL);

  /* send button */
  button = gtk_button_new_with_mnemonic (_("_Send"));
  gtk_button_set_image (GTK_BUTTON (button),
      gtk_image_new_from_icon_name (EMPATHY_IMAGE_DOCUMENT_SEND,
        GTK_ICON_SIZE_BUTTON));
  gtk_widget_show (button);

  gtk_dialog_add_action_widget (GTK_DIALOG (widget), button,
      GTK_RESPONSE_OK);

  gtk_widget_set_can_default (button, TRUE);
  gtk_dialog_set_default_response (GTK_DIALOG (widget),
      GTK_RESPONSE_OK);

  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), FALSE);

  gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (widget),
      g_get_home_dir ());

  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget),
      create_file_filter ());

  g_signal_connect (widget, "response",
      G_CALLBACK (file_manager_send_file_response_cb), g_object_ref (contact));

  gtk_widget_show (widget);
}
コード例 #19
0
GtkWidget *
empathy_contact_chat_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	GtkWidget *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	item = gtk_image_menu_item_new_with_mnemonic (_("_Chat"));
	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_show (image);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (empathy_dispatcher_chat_with_contact),
				  contact);
	
	return item;
}
コード例 #20
0
GtkWidget *
empathy_contact_info_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	GtkWidget *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	item = gtk_image_menu_item_new_with_mnemonic (_("Infor_mation"));
	image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_CONTACT_INFORMATION,
					      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 (contact_info_menu_item_activate_cb),
				  contact);

	return item;
}
コード例 #21
0
GtkWidget *
empathy_contact_edit_menu_item_new (EmpathyContact *contact)
{
	EmpathyContactManager *manager;
	GtkWidget *item;
	GtkWidget *image;
	gboolean enable = FALSE;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	if (empathy_contact_manager_initialized ()) {
		TpConnection *connection;
		EmpathyContactListFlags flags;

		manager = empathy_contact_manager_dup_singleton ();
		connection = empathy_contact_get_connection (contact);
		flags = empathy_contact_manager_get_flags_for_connection (
				manager, connection);

		enable = (flags & EMPATHY_CONTACT_LIST_CAN_ALIAS ||
		          flags & EMPATHY_CONTACT_LIST_CAN_GROUP);

		g_object_unref (manager);
	}

	item = gtk_image_menu_item_new_with_mnemonic (
						     C_("Edit contact (contextual menu)",
						        "_Edit"));
	image = gtk_image_new_from_icon_name (GTK_STOCK_EDIT,
					      GTK_ICON_SIZE_MENU);
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
	gtk_widget_show (image);

	gtk_widget_set_sensitive (item, enable);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (contact_edit_menu_item_activate_cb),
				  contact);

	return item;
}
コード例 #22
0
static void
contact_manager_remove_favourite (EmpathyContactList *manager,
				  EmpathyContact *contact)
{
	EmpathyContactManagerPriv *priv;
	TpAccount *account;
	const gchar *account_name;

	g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	priv = GET_PRIV (manager);

	account = empathy_contact_get_account (contact);
	account_name = tp_proxy_get_object_path (TP_PROXY (account));

	emp_cli_logger_call_remove_favourite_contact (priv->logger, -1,
						      account_name,
						      empathy_contact_get_id (contact),
						      remove_favourite_contact_cb, NULL, NULL, G_OBJECT (manager));
}
コード例 #23
0
GtkWidget *
empathy_contact_video_call_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	GtkWidget *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Video Call"));
	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) &&
					!empathy_contact_is_user (contact));
	gtk_widget_show (image);

	g_signal_connect (item, "activate",
				  G_CALLBACK (empathy_contact_video_call_menu_item_activated),
				  contact);

	return item;
}
コード例 #24
0
static GtkWidget *
empathy_contact_block_menu_item_new (EmpathyContact *contact)
{
	GtkWidget *item;
	EmpathyContactManager *manager;
	TpConnection *connection;
	EmpathyContactListFlags flags;
	gboolean blocked;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	manager = empathy_contact_manager_dup_singleton ();

	if (!empathy_contact_manager_initialized ()) {
		return NULL;
	}

	connection = empathy_contact_get_connection (contact);

	flags = empathy_contact_manager_get_flags_for_connection (manager,
			connection);

	if (!(flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)) {
		return NULL;
	}

	item = gtk_check_menu_item_new_with_mnemonic (_("_Block Contact"));
	blocked = empathy_contact_list_get_blocked (
			EMPATHY_CONTACT_LIST (manager),
			contact);

	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), blocked);

	g_signal_connect (item, "toggled",
			G_CALLBACK (empathy_contact_block_menu_item_toggled),
			contact);

	return item;
}
コード例 #25
0
GtkWidget *
empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact)
{
	GtkWidget         *item;
	GtkWidget         *image;

	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) &&
					!empathy_contact_is_user (contact));
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
	gtk_widget_show (image);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (empathy_send_file_with_file_chooser),
				  contact);

	return item;
}
コード例 #26
0
GtkWidget *
empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact)
{
	GtkWidget         *item;
	GtkWidget         *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	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_rfb_stream_tube (
		contact));
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
	gtk_widget_show (image);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (empathy_share_my_desktop_share_with_contact),
				  contact);

	return item;
}
コード例 #27
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
static GdkPixbuf *
empathy_pixbuf_protocol_from_contact_scaled (EmpathyContact *contact,
    gint width,
    gint height)
{
  TpAccount *account;
  gchar *filename;
  GdkPixbuf *pixbuf = NULL;

  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

  account = empathy_contact_get_account (contact);
  filename = tpaw_filename_from_icon_name (
      tp_account_get_icon_name (account), GTK_ICON_SIZE_MENU);

  if (filename != NULL)
    {
      pixbuf = gdk_pixbuf_new_from_file_at_size (filename, width, height, NULL);
      g_free (filename);
    }

  return pixbuf;
}
コード例 #28
0
ファイル: empathy-ui-utils.c プロジェクト: Dhinihan/empathy
void
empathy_send_file (EmpathyContact *contact,
    GFile *file)
{
  EmpathyFTFactory *factory;
  GtkRecentManager *manager;
  gchar *uri;

  g_return_if_fail (EMPATHY_IS_CONTACT (contact));
  g_return_if_fail (G_IS_FILE (file));

  factory = empathy_ft_factory_dup_singleton ();

  empathy_ft_factory_new_transfer_outgoing (factory, contact, file,
      empathy_get_current_action_time ());

  uri = g_file_get_uri (file);
  manager = gtk_recent_manager_get_default ();
  gtk_recent_manager_add_item (manager, uri);
  g_free (uri);

  g_object_unref (factory);
}
コード例 #29
0
void
empathy_tp_contact_factory_set_alias (EmpathyTpContactFactory *tp_factory,
				      EmpathyContact          *contact,
				      const gchar             *alias)
{
	EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory);
	GHashTable                  *new_alias;
	guint                        handle;

	g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	handle = empathy_contact_get_handle (contact);

	DEBUG ("Setting alias for contact %s (%d) to %s",
		empathy_contact_get_id (contact),
		handle, alias);

	new_alias = g_hash_table_new_full (g_direct_hash,
					   g_direct_equal,
					   NULL,
					   g_free);

	g_hash_table_insert (new_alias,
			     GUINT_TO_POINTER (handle),
			     g_strdup (alias));

	tp_cli_connection_interface_aliasing_call_set_aliases (priv->connection,
							       -1,
							       new_alias,
							       tp_contact_factory_set_aliases_cb,
							       NULL, NULL,
							       G_OBJECT (tp_factory));

	g_hash_table_destroy (new_alias);
}
コード例 #30
0
GtkWidget *
empathy_contact_log_menu_item_new (EmpathyContact *contact)
{
	TplLogManager     *manager;
	TplEntity         *entity;
	gboolean           have_log;
	GtkWidget         *item;
	GtkWidget         *image;

	g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);

	manager = tpl_log_manager_dup_singleton ();
	entity = tpl_entity_new_from_tp_contact (empathy_contact_get_tp_contact (contact),
						 TPL_ENTITY_CONTACT);

	have_log = tpl_log_manager_exists (manager,
					   empathy_contact_get_account (contact),
					   entity,
					   TPL_EVENT_MASK_TEXT);

	g_object_unref (entity);
	g_object_unref (manager);

	item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
	image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_LOG,
					      GTK_ICON_SIZE_MENU);
	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
	gtk_widget_set_sensitive (item, have_log);
	gtk_widget_show (image);

	g_signal_connect_swapped (item, "activate",
				  G_CALLBACK (contact_log_menu_item_activate_cb),
				  contact);

	return item;
}