From: Xavier Claessens Date: Fri, 8 Feb 2008 21:09:59 +0000 (+0000) Subject: Change new message dialog to new conversation and make possible to do voip call. X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=675deab25d7076195e356c84e55de5207b8c3c6f Change new message dialog to new conversation and make possible to do voip call. svn path=/trunk/; revision=608 --- diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c index 44461603..a30265ed 100644 --- a/libempathy-gtk/empathy-chat-window.c +++ b/libempathy-gtk/empathy-chat-window.c @@ -873,7 +873,7 @@ chat_window_call_activate_cb (GtkWidget *menuitem, chat = EMPATHY_PRIVATE_CHAT (priv->current_chat); contact = empathy_private_chat_get_contact (chat); - empathy_call_contact (contact); + empathy_call_with_contact (contact); } } diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 78ac3980..1aea4dce 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -1497,6 +1497,6 @@ static void contact_list_view_voip_activated (EmpathyContactListView *view, EmpathyContact *contact) { - empathy_call_contact (contact); + empathy_call_with_contact (contact); } diff --git a/libempathy-gtk/empathy-main-window.glade b/libempathy-gtk/empathy-main-window.glade index c997f38c..02f69a38 100644 --- a/libempathy-gtk/empathy-main-window.glade +++ b/libempathy-gtk/empathy-main-window.glade @@ -1,427 +1,310 @@ - - - + + + - - - Contact List - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 225 - 325 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - - - True - GTK_PACK_DIRECTION_LTR - GTK_PACK_DIRECTION_LTR - - - - True - _Chat - True - - - - - - - True - _New Message... - True - - - - - True - 1 - im-message-new - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _View Previous Conversations - True - - - - - True - document-open-recent - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - _Add Contact... - True - - - - True - gtk-add - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - Show _Offline Contacts - True - False - - - - - - - True - - - - - - True - _Quit - True - - - - - True - gtk-quit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Edit - True - - - - - - - True - Context - True - - - - - - True - - - - - - True - _Accounts - True - - - - - - - True - _Personal Information - True - - - - True - user-info - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - _Preferences - True - - - - True - gtk-preferences - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Room - True - - - - - - - True - Join _New... - True - - - - - - True - Join _Favorites - True - - - - - - - True - - - - - - True - - - - - - True - Manage Favorites - True - - - - True - 1 - system-users - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - - True - _Help - True - - - - - - - True - _Contents - True - - - - - True - gtk-help - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _About - True - - - - True - gtk-about - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - 0 - False - False - - - - - - True - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_BOTH - True - True - - - - - - - - - - - 0 - False - False - - - - - - False - 0 - - - - - - - 0 - False - False - - - - - - True - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - - - - 0 - True - True - - - - - - + + Contact List + 225 + 325 + + + True + + + True + + + True + _Chat + True + + + + + True + _New Conversation... + True + + + + True + 1 + im-message-new + + + + + + + True + _View Previous Conversations + True + + + + True + 1 + document-open-recent + + + + + + + True + + + + + True + _Add Contact... + True + + + True + gtk-add + 1 + + + + + + + True + + + + + True + Show _Offline Contacts + True + + + + + + True + + + + + True + _Quit + True + + + + True + gtk-quit + 1 + + + + + + + + + + + True + _Edit + True + + + + + True + Context + True + + + + + True + + + + + True + _Accounts + True + + + + + + True + _Personal Information + True + + + True + 1 + user-info + + + + + + + True + + + + + True + _Preferences + True + + + True + gtk-preferences + 1 + + + + + + + + + + + True + _Room + True + + + + + True + Join _New... + True + + + + + True + Join _Favorites + True + + + + + + True + + + + + True + + + + + True + Manage Favorites + True + + + True + 1 + system-users + + + + + + + + + + + True + _Help + True + + + + + True + _Contents + True + + + + True + gtk-help + 1 + + + + + + + True + _About + True + + + True + gtk-about + 1 + + + + + + + + + + + False + False + + + + + True + GTK_TOOLBAR_BOTH + + + False + False + 1 + + + + + + + + + + False + False + 2 + + + + + True + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + + + + 3 + + + + + diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c index 80e3b611..0213b067 100644 --- a/libempathy-gtk/empathy-new-message-dialog.c +++ b/libempathy-gtk/empathy-new-message-dialog.c @@ -47,8 +47,8 @@ typedef struct { GtkWidget *table_contact; GtkWidget *account_chooser; GtkWidget *entry_id; - GtkWidget *button_validate; - GtkWidget *button_voip; + GtkWidget *button_chat; + GtkWidget *button_call; } EmpathyNewMessageDialog; static void @@ -69,27 +69,11 @@ new_message_dialog_response_cb (GtkWidget *widget, return; } - if (response == GTK_RESPONSE_OK) { - empathy_chat_with_contact_id (account, id); + if (response == 1) { + empathy_call_with_contact_id (account, id); } - else if (response == 3) { - EmpathyContactFactory *factory; - EmpathyContact *contact = NULL; - - factory = empathy_contact_factory_new (); - contact = empathy_contact_factory_get_from_id (factory, - account, - id); - if (contact) { - empathy_call_contact (contact); - } else { - empathy_debug (DEBUG_DOMAIN, - "Contact ID %s does not exists", - id); - } - - g_object_unref (contact); - g_object_unref (factory); + else if (response == 2) { + empathy_chat_with_contact_id (account, id); } g_object_unref (account); @@ -106,8 +90,8 @@ new_message_change_state_button_cb (GtkEditable *editable, id = gtk_entry_get_text (GTK_ENTRY (editable)); sensitive = !G_STR_EMPTY (id); - gtk_widget_set_sensitive(dialog->button_validate, sensitive); - gtk_widget_set_sensitive(dialog->button_voip, sensitive); + gtk_widget_set_sensitive (dialog->button_chat, sensitive); + gtk_widget_set_sensitive (dialog->button_call, sensitive); } static void @@ -131,21 +115,21 @@ empathy_new_message_dialog_show (GtkWindow *parent) dialog = g_new0 (EmpathyNewMessageDialog, 1); glade = empathy_glade_get_file ("empathy-new-message-dialog.glade", - "new_message_dialog", - NULL, - "new_message_dialog", &dialog->dialog, - "table_contact", &dialog->table_contact, - "entry_id", &dialog->entry_id, - "button_validate", &dialog->button_validate, - "button_voip",&dialog->button_voip, - NULL); + "new_message_dialog", + NULL, + "new_message_dialog", &dialog->dialog, + "table_contact", &dialog->table_contact, + "entry_id", &dialog->entry_id, + "button_chat", &dialog->button_chat, + "button_call",&dialog->button_call, + NULL); empathy_glade_connect (glade, - dialog, - "new_message_dialog", "destroy", new_message_dialog_destroy_cb, - "new_message_dialog", "response", new_message_dialog_response_cb, - "entry_id", "changed", new_message_change_state_button_cb, - NULL); + dialog, + "new_message_dialog", "destroy", new_message_dialog_destroy_cb, + "new_message_dialog", "response", new_message_dialog_response_cb, + "entry_id", "changed", new_message_change_state_button_cb, + NULL); g_object_add_weak_pointer (G_OBJECT (dialog->dialog), (gpointer) &dialog); @@ -166,8 +150,12 @@ empathy_new_message_dialog_show (GtkWindow *parent) GTK_WINDOW (parent)); } - gtk_widget_set_sensitive(dialog->button_validate, FALSE); - gtk_widget_set_sensitive(dialog->button_voip, FALSE); + gtk_widget_set_sensitive (dialog->button_chat, FALSE); + gtk_widget_set_sensitive (dialog->button_call, FALSE); + +#ifndef HAVE_VOIP + gtk_widget_hide (dialog->button_call); +#endif gtk_widget_show (dialog->dialog); diff --git a/libempathy-gtk/empathy-new-message-dialog.glade b/libempathy-gtk/empathy-new-message-dialog.glade index 4fb18bd8..25f4b225 100644 --- a/libempathy-gtk/empathy-new-message-dialog.glade +++ b/libempathy-gtk/empathy-new-message-dialog.glade @@ -1,11 +1,11 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 - New message + New Conversation False GTK_WIN_POS_CENTER_ON_PARENT GDK_WINDOW_TYPE_HINT_DIALOG @@ -13,16 +13,17 @@ True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 2 True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 2 2 6 6 + + + True @@ -39,30 +40,25 @@ True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 Contact ID: 1 2 - GTK_FILL + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 Account: - GTK_FILL + - - - 1 @@ -71,33 +67,108 @@ True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GTK_BUTTONBOX_END True True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK gtk-cancel True -6 - + True True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-ok - True - -5 + True + 1 + + + True + 0 + 0 + + + True + 2 + + + True + gnome-stock-mic + + + False + False + + + + + True + Call + True + + + False + False + 1 + + + + + + 1 + + + True + True + True + 2 + + + True + 0 + 0 + + + True + 2 + + + True + im-message-new + + + False + False + + + + + True + Chat + True + + + False + False + 1 + + + + + + + + + 2 + + False diff --git a/libempathy-gtk/empathy-status-icon.glade b/libempathy-gtk/empathy-status-icon.glade index eb7d02a3..ab0f09f8 100644 --- a/libempathy-gtk/empathy-status-icon.glade +++ b/libempathy-gtk/empathy-status-icon.glade @@ -1,78 +1,59 @@ - - - + + + - - - - - - True - _Show Contact List - True - False - - - - - - True - - - - - - True - _New Message... - True - - - - True - 1 - im-message-new - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Status - True - - - - - - True - - - - - - True - _Quit - True - - - - True - gtk-quit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - + + + + True + _Show Contact List + True + + + + + True + + + + + True + _New Conversation... + True + + + True + 1 + im-message-new + + + + + + + True + Status + True + + + + + True + + + + + True + _Quit + True + + + True + gtk-quit + 1 + + + + + diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index c810f9cc..796d23dd 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -397,61 +397,36 @@ empathy_inspect_handle (McAccount *account, } void -empathy_call_contact (EmpathyContact *contact) +empathy_call_with_contact (EmpathyContact *contact) { #ifdef HAVE_VOIP MissionControl *mc; - McAccount *account; - TpConn *tp_conn; - gchar *object_path; - const gchar *bus_name; - TpChan *new_chan; - EmpathyTpGroup *group; - GError *error = NULL; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - /* StreamedMedia channels must have handle=0 and handle_type=none. - * To call a contact we have to add him in the group interface of the - * channel. MissionControl will detect the channel creation and - * dispatch it to the VoIP chandler automatically. */ mc = empathy_mission_control_new (); - account = empathy_contact_get_account (contact); - tp_conn = mission_control_get_connection (mc, account, NULL); - /* FIXME: Should be async */ - if (!tp_conn_request_channel (DBUS_G_PROXY (tp_conn), - TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, - TP_HANDLE_TYPE_NONE, - 0, - FALSE, - &object_path, - &error)) { - empathy_debug (DEBUG_DOMAIN, - "Couldn't request channel: %s", - error ? error->message : "No error given"); - g_clear_error (&error); - g_object_unref (mc); - g_object_unref (tp_conn); - return; - } - - bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn)); - new_chan = tp_chan_new (tp_get_bus (), - bus_name, - object_path, - TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, - TP_HANDLE_TYPE_NONE, - 0); + mission_control_request_channel (mc, + empathy_contact_get_account (contact), + TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, + empathy_contact_get_handle (contact), + TP_HANDLE_TYPE_CONTACT, + NULL, NULL); + g_object_unref (mc); +#endif +} - group = empathy_tp_group_new (account, new_chan); - empathy_tp_group_add_member (group, contact, ""); +void +empathy_call_with_contact_id (McAccount *account, const gchar *contact_id) +{ +#ifdef HAVE_VOIP + MissionControl *mc; - g_object_unref (group); + mc = empathy_mission_control_new (); + mission_control_request_channel_with_string_handle (mc, + account, + TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, + contact_id, + TP_HANDLE_TYPE_CONTACT, + NULL, NULL); g_object_unref (mc); - g_object_unref (tp_conn); - g_object_unref (new_chan); - g_free (object_path); #endif } @@ -485,7 +460,6 @@ empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id) g_object_unref (mc); } - const gchar * empathy_presence_get_default_message (McPresence presence) { diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 875128c1..cafc3db1 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -88,7 +88,9 @@ gchar * empathy_inspect_handle (McAccount *account, guint handle_type); gchar * empathy_inspect_channel (McAccount *account, TpChan *tp_chan); -void empathy_call_contact (EmpathyContact *contact); +void empathy_call_with_contact (EmpathyContact *contact); +void empathy_call_with_contact_id (McAccount *account, + const gchar *contact_id); void empathy_chat_with_contact (EmpathyContact *contact); void empathy_chat_with_contact_id (McAccount *account, const gchar *contact_id); diff --git a/python/pyempathy/pyempathy.defs b/python/pyempathy/pyempathy.defs index 7f7381fa..0c22ab6c 100644 --- a/python/pyempathy/pyempathy.defs +++ b/python/pyempathy/pyempathy.defs @@ -1954,8 +1954,8 @@ ) ) -(define-function empathy_call_contact - (c-name "empathy_call_contact") +(define-function empathy_call_with_contact + (c-name "empathy_call_with_contact") (return-type "none") (parameters '("EmpathyContact*" "contact")