aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-02 05:29:21 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-02 05:29:21 +0800
commit6fd6f3b1081a5b72054ef135346da0d5eb979590 (patch)
tree99644087c07e90132cd3c07df505a64e2c3edc24 /libempathy-gtk
parentf4d9313a82b4ce88b87bba1427fdbece4f1d00ad (diff)
downloadgsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar.gz
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar.bz2
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar.lz
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar.xz
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.tar.zst
gsoc2013-empathy-6fd6f3b1081a5b72054ef135346da0d5eb979590.zip
Add convinience functions empathy_chat_with_contact() and empathy_chat_with_contact_id() to start a chat with a contact. Make use of it when appropriate.
svn path=/trunk/; revision=527
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat-window.c11
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c22
-rw-r--r--libempathy-gtk/empathy-new-message-dialog.c15
-rw-r--r--libempathy-gtk/empathy-private-chat.c11
4 files changed, 7 insertions, 52 deletions
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index d1fb7906f..b6409f6a8 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -1626,16 +1626,7 @@ chat_window_drag_data_received (GtkWidget *widget,
chat = empathy_chat_window_find_chat (account, id);
if (!chat) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact_id (account, id);
return;
}
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 9b6a98a6a..498d88721 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -183,8 +183,6 @@ static void contact_list_view_row_expand_or_collapse_cb (EmpathyContactLi
gpointer user_data);
static void contact_list_view_action_cb (GtkAction *action,
EmpathyContactListView *view);
-static void contact_list_view_action_activated (EmpathyContactListView *view,
- EmpathyContact *contact);
static void contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact);
@@ -1314,7 +1312,7 @@ contact_list_view_row_activated_cb (EmpathyContactListView *view,
-1);
if (contact) {
- contact_list_view_action_activated (view, contact);
+ empathy_chat_with_contact (contact);
g_object_unref (contact);
}
}
@@ -1397,7 +1395,7 @@ contact_list_view_action_cb (GtkAction *action,
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
if (contact && strcmp (name, "Chat") == 0) {
- contact_list_view_action_activated (view, contact);
+ empathy_chat_with_contact (contact);
}
else if (contact && strcmp (name, "Call") == 0) {
contact_list_view_voip_activated (view, contact);
@@ -1436,22 +1434,6 @@ contact_list_view_action_cb (GtkAction *action,
}
static void
-contact_list_view_action_activated (EmpathyContactListView *view,
- EmpathyContact *contact)
-{
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
-}
-
-static void
contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact)
{
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c
index 7a3fd9731..80e3b611c 100644
--- a/libempathy-gtk/empathy-new-message-dialog.c
+++ b/libempathy-gtk/empathy-new-message-dialog.c
@@ -56,8 +56,8 @@ new_message_dialog_response_cb (GtkWidget *widget,
gint response,
EmpathyNewMessageDialog *dialog)
{
- McAccount *account;
- const gchar *id;
+ McAccount *account;
+ const gchar *id;
account = empathy_account_chooser_get_account (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser));
id = gtk_entry_get_text (GTK_ENTRY (dialog->entry_id));
@@ -70,16 +70,7 @@ new_message_dialog_response_cb (GtkWidget *widget,
}
if (response == GTK_RESPONSE_OK) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel_with_string_handle (mc,
- account,
- TP_IFACE_CHANNEL_TYPE_TEXT,
- id,
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact_id (account, id);
}
else if (response == 3) {
EmpathyContactFactory *factory;
diff --git a/libempathy-gtk/empathy-private-chat.c b/libempathy-gtk/empathy-private-chat.c
index 9af944174..2dd1ba755 100644
--- a/libempathy-gtk/empathy-private-chat.c
+++ b/libempathy-gtk/empathy-private-chat.c
@@ -251,16 +251,7 @@ private_chat_contact_presence_updated_cb (EmpathyContact *contact,
/* If offline message is not supported by CM we need to
* request a new Text Channel. */
if (!empathy_chat_is_connected (EMPATHY_CHAT (chat))) {
- MissionControl *mc;
-
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_TEXT,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ empathy_chat_with_contact (contact);
}
}