diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-05-20 17:22:05 +0100 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-05-20 17:22:05 +0100 |
commit | 114202d71e2a0574fbbe96e66eb9e04d0ac31753 (patch) | |
tree | d8004b7d6949ef3bdce9d5bb6790d752dec4bad7 | |
parent | 4505c5bf9fbffb4459995e344649fecdc5325dc1 (diff) | |
parent | 5773ec23f42c7b0c5e7e3e8f4800fbe2cf271f14 (diff) | |
download | empathy-114202d71e2a0574fbbe96e66eb9e04d0ac31753.tar.gz |
Merge branch 'empathy-skype' into debian
-rw-r--r-- | data/icons/hicolor_apps_16x16_im-skype.png | bin | 364 -> 744 bytes | |||
-rw-r--r-- | data/icons/hicolor_apps_22x22_im-skype.png | bin | 438 -> 1016 bytes | |||
-rw-r--r-- | data/icons/hicolor_apps_24x24_im-skype.png | bin | 403 -> 1109 bytes | |||
-rw-r--r-- | data/icons/hicolor_apps_32x32_im-skype.png | bin | 557 -> 1453 bytes | |||
-rw-r--r-- | data/icons/hicolor_apps_48x48_im-skype.png | bin | 698 -> 2184 bytes | |||
-rw-r--r-- | data/icons/hicolor_apps_scalable_im-skype.svg | 70 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat-view.c | 16 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat-view.h | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 60 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 70 | ||||
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 9 | ||||
-rw-r--r-- | libempathy/empathy-contact.c | 12 | ||||
-rw-r--r-- | src/empathy-call-factory.c | 52 | ||||
-rw-r--r-- | src/empathy-call-factory.h | 6 | ||||
-rw-r--r-- | src/empathy-call-handler.c | 63 | ||||
-rw-r--r-- | src/empathy-preferences.c | 4 |
17 files changed, 242 insertions, 131 deletions
diff --git a/data/icons/hicolor_apps_16x16_im-skype.png b/data/icons/hicolor_apps_16x16_im-skype.png Binary files differindex 186d8c2f6..e74f0b9da 100644 --- a/data/icons/hicolor_apps_16x16_im-skype.png +++ b/data/icons/hicolor_apps_16x16_im-skype.png diff --git a/data/icons/hicolor_apps_22x22_im-skype.png b/data/icons/hicolor_apps_22x22_im-skype.png Binary files differindex 239f697cd..e65f80bc3 100644 --- a/data/icons/hicolor_apps_22x22_im-skype.png +++ b/data/icons/hicolor_apps_22x22_im-skype.png diff --git a/data/icons/hicolor_apps_24x24_im-skype.png b/data/icons/hicolor_apps_24x24_im-skype.png Binary files differindex d4e78cafb..20644e1ff 100644 --- a/data/icons/hicolor_apps_24x24_im-skype.png +++ b/data/icons/hicolor_apps_24x24_im-skype.png diff --git a/data/icons/hicolor_apps_32x32_im-skype.png b/data/icons/hicolor_apps_32x32_im-skype.png Binary files differindex 80721f871..e32563c34 100644 --- a/data/icons/hicolor_apps_32x32_im-skype.png +++ b/data/icons/hicolor_apps_32x32_im-skype.png diff --git a/data/icons/hicolor_apps_48x48_im-skype.png b/data/icons/hicolor_apps_48x48_im-skype.png Binary files differindex a97b6c13d..c97119238 100644 --- a/data/icons/hicolor_apps_48x48_im-skype.png +++ b/data/icons/hicolor_apps_48x48_im-skype.png diff --git a/data/icons/hicolor_apps_scalable_im-skype.svg b/data/icons/hicolor_apps_scalable_im-skype.svg index 3b07a1cf2..2e856de2d 100644 --- a/data/icons/hicolor_apps_scalable_im-skype.svg +++ b/data/icons/hicolor_apps_scalable_im-skype.svg @@ -9,14 +9,17 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="48px" - height="48px" - id="svg2991" + width="292.99625" + height="292.29874" + id="svg3069" version="1.1" inkscape:version="0.48.1 r9760" - sodipodi:docname="hicolor_apps_scalable_im-skype.svg"> + sodipodi:docname="hicolor_apps_scalable_im-skype.svg" + inkscape:export-filename="/home/emilio/src/empathy-skype/data/icons/hicolor_apps_16x16_im-skype.png" + inkscape:export-xdpi="4.9264669" + inkscape:export-ydpi="4.9264669"> <defs - id="defs2993" /> + id="defs3071" /> <sodipodi:namedview id="base" pagecolor="#ffffff" @@ -24,20 +27,23 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="7" - inkscape:cx="-30.428571" - inkscape:cy="35.428571" - inkscape:current-layer="svg2991" - showgrid="true" - inkscape:grid-bbox="true" + inkscape:zoom="1.4" + inkscape:cx="228.64098" + inkscape:cy="118.7963" inkscape:document-units="px" - inkscape:window-width="1920" - inkscape:window-height="1143" - inkscape:window-x="1280" + inkscape:current-layer="layer1" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:window-width="1280" + inkscape:window-height="743" + inkscape:window-x="0" inkscape:window-y="26" inkscape:window-maximized="1" /> <metadata - id="metadata2996"> + id="metadata3074"> <rdf:RDF> <cc:Work rdf:about=""> @@ -45,32 +51,24 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> - <dc:creator> - <cc:Agent> - <dc:title>Emilio Pozuelo Monfort</dc:title> - </cc:Agent> - </dc:creator> - <dc:rights> - <cc:Agent> - <dc:title>Collabora Ltd.</dc:title> - </cc:Agent> - </dc:rights> </cc:Work> </rdf:RDF> </metadata> <g - id="layer1" inkscape:label="Layer 1" - inkscape:groupmode="layer"> + inkscape:groupmode="layer" + id="layer1" + transform="translate(-147.78759,-237.64143)"> + <path + inkscape:connector-curvature="0" + id="path40" + style="fill:#00adee;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 294.91884,467.84263 c -49.15375,0 -71.1425,-24.1625 -71.1425,-42.27875 0,-9.29 6.85875,-15.79875 16.31125,-15.79875 21.035,0 15.59125,30.20375 54.83125,30.20375 20.0875,0 31.18375,-10.9075 31.18375,-22.07375 0,-6.71375 -3.31125,-14.15625 -16.54,-17.415 l -43.71625,-10.9175 c -35.21125,-8.82625 -41.60375,-27.86125 -41.60375,-45.7525 0,-37.15375 34.97875,-51.09875 67.82875,-51.09875 30.2525,0 65.92625,16.72125 65.92625,39.0075 0,9.55 -8.27,15.105 -17.71625,15.105 -17.9575,0 -14.64625,-24.84875 -50.805,-24.84875 -17.94875,0 -27.8925,8.1275 -27.8925,19.75625 0,11.60125 14.17625,15.31 26.4775,18.11625 l 32.36375,7.18125 c 35.4425,7.89125 44.4325,28.58625 44.4325,48.08375 0,30.19 -23.16875,52.73 -69.93875,52.73 m 135.50375,-59.655 c -0.0962,0.51625 -0.16625,1.03625 -0.26625,1.55125 l -0.49375,-2.95125 c 0.2675,0.46 0.4975,0.93875 0.76,1.4 1.50125,-8.23 2.2975,-16.65625 2.2975,-25.07875 0,-18.67625 -3.65875,-36.79875 -10.875,-53.85125 -6.975,-16.48 -16.94375,-31.2775 -29.65375,-43.98 -12.7025,-12.705 -27.5025,-22.68 -43.97625,-29.64875 -17.05125,-7.21625 -35.1775,-10.86875 -53.85125,-10.86875 -8.80125,0 -17.61375,0.8275 -26.19375,2.46875 -0.0225,0.005 -0.0437,0.007 -0.065,0.0138 0.4775,0.25375 0.96875,0.48 1.44125,0.745 l -2.9125,-0.455 c 0.4925,-0.095 0.98,-0.19125 1.47125,-0.29 -11.775,-6.26125 -25.0075,-9.60125 -38.41375,-9.60125 -21.87625,0 -42.45,8.51875 -57.91625,23.995 -15.46625,15.465 -23.9875,36.03875 -23.9875,57.9175 0,13.92375 3.57875,27.61125 10.30125,39.71 0.0875,-0.5025 0.1525,-1.00875 0.24375,-1.50625 l 0.50375,2.89625 c -0.265,-0.45375 -0.49,-0.93 -0.7475,-1.39 -1.3625,7.835 -2.08125,15.845 -2.08125,23.845 0,18.6775 3.65875,36.7975 10.8775,53.85625 6.96125,16.48125 16.94125,31.2725 29.64125,43.97625 12.71,12.705 27.5025,22.69 43.985,29.64125 17.055,7.23125 35.17875,10.88875 53.8525,10.88875 8.135,0 16.28,-0.73875 24.23625,-2.15 -0.465,-0.2625 -0.94625,-0.4975 -1.41125,-0.7725 l 2.94875,0.52 c -0.50875,0.0975 -1.02375,0.16 -1.5375,0.2525 12.25375,6.935 26.12625,10.61875 40.2925,10.61875 21.875,0 42.43625,-8.51125 57.90375,-23.9875 15.47625,-15.4625 23.9875,-36.03375 23.9875,-57.915 0,-13.97375 -3.6,-27.7075 -10.36125,-39.85" /> <path - sodipodi:type="arc" - style="fill:#00aeef;fill-opacity:1" - id="path2999" - sodipodi:cx="23.142857" - sodipodi:cy="26.285715" - sodipodi:rx="13.857142" - sodipodi:ry="13.857142" - d="m 36.999999,26.285715 a 13.857142,13.857142 0 1 1 -27.7142849,0 13.857142,13.857142 0 1 1 27.7142849,0 z" - transform="translate(0.71428571,-1.2857143)" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.71428573" + d="m 138.64098,229.76456 c -12.98995,-0.9058 -27.86684,-4.54697 -36.78571,-9.00343 -10.316449,-5.15477 -18.59532,-12.86294 -22.642981,-21.08207 -2.13875,-4.34293 -2.357022,-5.38301 -2.357022,-11.23139 0,-5.68861 0.208887,-6.75406 1.779385,-9.07589 4.904426,-7.25074 15.490536,-9.16242 22.969158,-4.14787 1.70973,1.14641 4.71051,4.10485 6.66841,6.57431 6.44827,8.13309 12.87124,14.04188 17.74094,16.32068 11.09304,5.19106 27.12171,5.66759 37.88351,1.12628 4.43609,-1.87197 9.62574,-6.07175 11.54076,-9.33949 5.72519,-9.76928 2.88896,-19.83554 -6.93159,-24.60141 -2.9703,-1.44147 -13.37059,-4.39665 -30.49378,-8.66462 -27.12122,-6.76 -34.11918,-9.01043 -41.19539,-13.24778 C 92.175135,140.61246 85.105158,134.04867 82.842471,130.41819 74.537856,117.09345 74.874667,94.592122 83.581839,81.02317 86.4918,76.48839 94.318099,69.148428 99.563266,66.034853 115.1903,56.758511 140.46846,53.046345 161.05862,57.004092 c 22.49468,4.323823 40.0703,14.650552 46.19309,27.141199 6.26909,12.789098 0.76715,23.397649 -12.69524,24.478279 -7.09712,0.56969 -9.77981,-0.83713 -18.68746,-9.799803 -11.90226,-11.975793 -19.30499,-14.850023 -36.45019,-14.152382 -10.64227,0.433036 -15.26584,2.083021 -20.4977,7.314889 -3.03202,3.032015 -3.85174,4.403293 -4.5815,7.664232 -2.08058,9.297004 2.12342,15.089764 14.05662,19.368824 2.81181,1.00827 13.9011,3.7924 24.64286,6.18695 31.12875,6.9392 34.6412,8.09935 44.704,14.76548 12.73708,8.43772 18.88562,20.75075 18.83335,37.71562 -0.084,27.28103 -17.83391,45.2558 -50.07833,50.71282 -6.4498,1.09156 -21.32288,1.82 -27.85714,1.36436 z" + id="path2983" + inkscape:connector-curvature="0" + transform="translate(147.78759,237.64143)" /> </g> </svg> diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index ada669885..720ff2bbf 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -84,6 +84,22 @@ empathy_chat_view_append_event (EmpathyChatView *view, } void +empathy_chat_view_append_event_markup (EmpathyChatView *view, + const gchar *markup_text, + const gchar *fallback_text) +{ + g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view)); + + if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event_markup) { + EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_event_markup (view, + markup_text, + fallback_text); + } else { + empathy_chat_view_append_event (view, fallback_text); + } +} + +void empathy_chat_view_scroll (EmpathyChatView *view, gboolean allow_scrolling) { diff --git a/libempathy-gtk/empathy-chat-view.h b/libempathy-gtk/empathy-chat-view.h index 96365a618..d25797db5 100644 --- a/libempathy-gtk/empathy-chat-view.h +++ b/libempathy-gtk/empathy-chat-view.h @@ -46,6 +46,9 @@ struct _EmpathyChatViewIface { EmpathyMessage *msg); void (*append_event) (EmpathyChatView *view, const gchar *str); + void (*append_event_markup) (EmpathyChatView *view, + const gchar *markup_text, + const gchar *fallback_text); void (*scroll) (EmpathyChatView *view, gboolean allow_scrolling); void (*scroll_down) (EmpathyChatView *view); @@ -75,6 +78,9 @@ void empathy_chat_view_append_message (EmpathyChatView *view, EmpathyMessage *msg); void empathy_chat_view_append_event (EmpathyChatView *view, const gchar *str); +void empathy_chat_view_append_event_markup (EmpathyChatView *view, + const gchar *markup_text, + const gchar *fallback_text); void empathy_chat_view_scroll (EmpathyChatView *view, gboolean allow_scrolling); void empathy_chat_view_scroll_down (EmpathyChatView *view); diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index fd43473dd..1063ad196 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1200,6 +1200,57 @@ chat_message_received_cb (EmpathyTpChat *tp_chat, } static void +got_credit_uri_prop (TpProxy *proxy, + const GValue *value, + const GError *in_error, + gpointer user_data, + GObject *weak_object) +{ + EmpathyChat *chat = EMPATHY_CHAT (weak_object); + const gchar *uri = g_value_get_string (value); + const gchar *error = _("insufficient balance to send message"); + const gchar *message_body = user_data; + gchar *str, *str_markup = NULL; + + if (in_error != NULL) { + DEBUG ("Failed to get ManageCreditURI: %s", in_error->message); + /* Not fatal, just don't display a 'Top up' link */ + } + + if (message_body != NULL) { + str = g_strdup_printf (_("Error sending message '%s': %s"), message_body, error); + } else { + str = g_strdup_printf (_("Error sending message: %s"), error); + } + + if (!tp_str_empty (uri)) { + gchar *markup_error = g_strdup_printf (_("insufficient balance to send message." + " <a href='%s'>Top up</a>."), uri); + + if (message_body != NULL) { + gchar *escaped_body = g_markup_escape_text (message_body, -1); + + str_markup = g_strdup_printf (_("Error sending message '%s': %s"), + escaped_body, markup_error); + + g_free (escaped_body); + } else { + str_markup = g_strdup_printf (_("Error sending message: %s"), markup_error); + } + + g_free (markup_error); + } + + if (str_markup != NULL) + empathy_chat_view_append_event_markup (chat->view, str_markup, str); + else + empathy_chat_view_append_event (chat->view, str); + + g_free (str); + g_free (str_markup); +} + +static void chat_send_error_cb (EmpathyTpChat *tp_chat, const gchar *message_body, TpChannelTextSendError error_code, @@ -1210,7 +1261,14 @@ chat_send_error_cb (EmpathyTpChat *tp_chat, gchar *str; if (!tp_strdiff (dbus_error, TP_ERROR_STR_INSUFFICIENT_BALANCE)) { - error = _("insufficient balance to send message"); + tp_cli_dbus_properties_call_get ( + empathy_tp_chat_get_connection (tp_chat), + -1, + TP_IFACE_CONNECTION_INTERFACE_BALANCE, + "ManageCreditURI", + got_credit_uri_prop, + g_strdup (message_body), g_free, G_OBJECT (chat)); + return; } else if (!tp_strdiff (dbus_error, TP_ERROR_STR_NOT_CAPABLE)) { error = _("not capable"); } diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 93ab9d510..4efa9a0da 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -279,6 +279,23 @@ contact_info_field_spec_cmp (TpContactInfoFieldSpec *spec1, return contact_info_field_name_cmp (spec1->name, spec2->name); } +static TpContactInfoFieldSpec * +get_spec_from_list (GList *list, + const gchar *name) +{ + GList *l; + + for (l = list; l != NULL; l = g_list_next (l)) + { + TpContactInfoFieldSpec *spec = l->data; + + if (!tp_strdiff (spec->name, name)) + return spec; + } + + return NULL; +} + static guint contact_widget_details_update_edit (EmpathyContactWidget *information) { @@ -1062,13 +1079,44 @@ set_nickname_cb (GObject *source, } } +/* Update all the contact info fields having the +* Overwritten_By_Nickname flag to the new alias. This avoid accidentally +* reseting the alias when calling SetContactInfo(). See bgo #644298 for +* details. */ static void -set_alias_on_account (TpAccount *account, - const gchar *alias) +update_nickname_in_contact_info (EmpathyContactWidget *self, + TpConnection *connection, + const gchar *nickname) { - DEBUG ("Set Account.Nickname to %s", alias); + GList *specs, *l; - tp_account_set_nickname_async (account, alias, set_nickname_cb, NULL); + specs = tp_connection_get_contact_info_supported_fields (connection); + + for (l = self->details_to_set; l != NULL; l= g_list_next (l)) + { + TpContactInfoField *field = l->data; + TpContactInfoFieldSpec *spec; + + spec = get_spec_from_list (specs, field->field_name); + /* We shouldn't have added the field to details_to_set if it's not + * supported by the CM */ + g_assert (spec != NULL); + + if (spec->flags & TP_CONTACT_INFO_FIELD_FLAG_OVERWRITTEN_BY_NICKNAME) + { + const gchar *strv[] = { nickname, NULL }; + + DEBUG ("Updating field '%s' to '%s' as it has the " + "Overwritten_By_Nickname flag and Account.Nickname has " + "been updated", field->field_name, nickname); + + if (field->field_value != NULL) + g_strfreev (field->field_value); + field->field_value = g_strdupv ((GStrv) strv); + } + } + + g_list_free (specs); } static gboolean @@ -1085,9 +1133,21 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable, if (empathy_contact_is_user (information->contact)) { TpAccount * account; + const gchar *current_nickname; account = empathy_contact_get_account (information->contact); - set_alias_on_account (account, alias); + current_nickname = tp_account_get_nickname (account); + + if (tp_strdiff (current_nickname, alias)) + { + DEBUG ("Set Account.Nickname to %s", alias); + + tp_account_set_nickname_async (account, alias, set_nickname_cb, + NULL); + + update_nickname_in_contact_info (information, + empathy_contact_get_connection (information->contact), alias); + } } else { diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 9b094652d..30d8ba732 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -2020,12 +2020,17 @@ log_window_chats_set_selected (EmpathyLogWindow *window) TplEntity *this_target; const gchar *this_chat_id; gboolean this_is_chatroom; + gint this_type; gtk_tree_model_get (model, &iter, + COL_WHO_TYPE, &this_type, COL_WHO_ACCOUNT, &this_account, COL_WHO_TARGET, &this_target, -1); + if (this_type != COL_TYPE_NORMAL) + continue; + this_chat_id = tpl_entity_get_identifier (this_target); this_is_chatroom = tpl_entity_get_entity_type (this_target) == TPL_ENTITY_ROOM; diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index 88672554f..d22ef2695 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -631,6 +631,14 @@ theme_adium_append_event (EmpathyChatView *view, } static void +theme_adium_append_event_markup (EmpathyChatView *view, + const gchar *markup_text, + const gchar *fallback_text) +{ + theme_adium_append_event_escaped (view, markup_text); +} + +static void theme_adium_scroll (EmpathyChatView *view, gboolean allow_scrolling) { @@ -840,6 +848,7 @@ theme_adium_iface_init (EmpathyChatViewIface *iface) { iface->append_message = theme_adium_append_message; iface->append_event = theme_adium_append_event; + iface->append_event_markup = theme_adium_append_event_markup; iface->scroll = theme_adium_scroll; iface->scroll_down = theme_adium_scroll_down; iface->get_has_selection = theme_adium_get_has_selection; diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 42faad483..08798fc6c 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -655,10 +655,20 @@ empathy_contact_from_tpl_contact (TpAccount *account, if (existing_contact != NULL) { + EmpathyContactPriv *priv; + retval = g_object_new (EMPATHY_TYPE_CONTACT, "tp-contact", empathy_contact_get_tp_contact (existing_contact), - "alias", tpl_entity_get_alias (tpl_entity), NULL); + + priv = GET_PRIV (retval); + + /* contact_set_property() calls empathy_contact_set_alias(), which + * tries to set the alias on the FolksPersona, but we don't want to + * do that when creating an EmpathyContact from a TplEntity. So just + * set priv->alias instead of passing it to g_object_new() instead. */ + g_free (priv->alias); + priv->alias = g_strdup (tpl_entity_get_alias (tpl_entity)); } else { diff --git a/src/empathy-call-factory.c b/src/empathy-call-factory.c index 5d14ad52d..cced7648f 100644 --- a/src/empathy-call-factory.c +++ b/src/empathy-call-factory.c @@ -34,8 +34,6 @@ #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-utils.h> -#include <libempathy-gtk/empathy-call-utils.h> - #include "empathy-call-factory.h" #include "empathy-call-handler.h" #include "src-marshal.h" @@ -210,56 +208,6 @@ empathy_call_factory_get (void) } static void -create_call_channel_cb (GObject *source, - GAsyncResult *result, - gpointer user_data) -{ - GError *error = NULL; - - if (!tp_account_channel_request_create_channel_finish ( - TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) - { - DEBUG ("Failed to create call channel: %s", error->message); - g_error_free (error); - } -} - -/** - * empathy_call_factory_new_call_with_streams: - * @factory: an #EmpathyCallFactory - * @contact: an #EmpathyContact - * @initial_audio: if %TRUE the call will be started with audio - * @initial_video: if %TRUE the call will be started with video - * - * Initiate a new Call with @contact. - */ -void -empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data) -{ - GHashTable *call_request; - TpAccount *account; - TpAccountChannelRequest *call_req; - - call_request = empathy_call_create_call_request ( - empathy_contact_get_id (contact), - initial_audio, initial_video); - - account = empathy_contact_get_account (contact); - - call_req = tp_account_channel_request_new (account, call_request, timestamp); - - tp_account_channel_request_create_channel_async (call_req, NULL, NULL, - create_call_channel_cb, NULL); - - g_hash_table_unref (call_request); - g_object_unref (call_req); -} - -static void call_channel_got_contact (TpConnection *connection, EmpathyContact *contact, const GError *error, diff --git a/src/empathy-call-factory.h b/src/empathy-call-factory.h index d739b4802..4db2e35fd 100644 --- a/src/empathy-call-factory.h +++ b/src/empathy-call-factory.h @@ -63,12 +63,6 @@ EmpathyCallFactory *empathy_call_factory_initialise (void); EmpathyCallFactory *empathy_call_factory_get (void); -void empathy_call_factory_new_call_with_streams (EmpathyContact *contact, - gboolean initial_audio, - gboolean initial_video, - gint64 timestamp, - gpointer user_data); - gboolean empathy_call_factory_register (EmpathyCallFactory *self, GError **error); diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c index 56d109838..82fd68c1b 100644 --- a/src/empathy-call-handler.c +++ b/src/empathy-call-handler.c @@ -30,11 +30,13 @@ #include <telepathy-farstream/telepathy-farstream.h> +#include <libempathy/empathy-channel-factory.h> #include <libempathy/empathy-utils.h> #include <libempathy/empathy-tp-contact-factory.h> +#include <libempathy-gtk/empathy-call-utils.h> + #include "empathy-call-handler.h" -#include "empathy-call-factory.h" #include "src-marshal.h" #define DEBUG_FLAG EMPATHY_DEBUG_VOIP @@ -179,7 +181,8 @@ on_call_invalidated_cb (TpyCallChannel *call, if (priv->call == call) { /* Invalidated unexpectedly? Fake call ending */ - g_signal_emit (self, signals[STATE_CHANGED], 0, TPY_CALL_STATE_ENDED); + g_signal_emit (self, signals[STATE_CHANGED], 0, + TPY_CALL_STATE_ENDED, NULL); tp_clear_object (&priv->call); tp_clear_object (&priv->tfchannel); } @@ -888,7 +891,21 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) on_tf_channel_ready, self); } -#if 0 +static void +on_call_accepted_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + TpyCallChannel *call = TPY_CALL_CHANNEL (source_object); + GError *error = NULL; + + if (!tpy_call_channel_accept_finish (call, res, &error)) + { + g_warning ("could not accept Call: %s", error->message); + g_error_free (error); + } +} + static void empathy_call_handler_request_cb (GObject *source, GAsyncResult *result, @@ -916,26 +933,15 @@ empathy_call_handler_request_cb (GObject *source, } priv->call = TPY_CALL_CHANNEL (channel); + tp_g_signal_connect_object (priv->call, "state-changed", + G_CALLBACK (on_call_state_changed_cb), self, 0); + tp_g_signal_connect_object (priv->call, "invalidated", + G_CALLBACK (on_call_invalidated_cb), self, 0); g_object_notify (G_OBJECT (self), "call-channel"); empathy_call_handler_start_tpfs (self); -} -#endif - -static void -on_call_accepted_cb (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - TpyCallChannel *call = TPY_CALL_CHANNEL (source_object); - GError *error = NULL; - - if (!tpy_call_channel_accept_finish (call, res, &error)) - { - g_warning ("could not accept Call: %s", error->message); - g_error_free (error); - } + tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); } void @@ -943,9 +949,10 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler, gint64 timestamp) { EmpathyCallHandlerPriv *priv = GET_PRIV (handler); -/*TpAccountChannelRequest *req; + EmpathyChannelFactory *channel_factory; + TpAccountChannelRequest *req; TpAccount *account; - GHashTable *request;*/ + GHashTable *request; if (priv->call != NULL) { @@ -953,27 +960,27 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler, tpy_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); return; } - else - { - g_warning ("No Call channel!"); - } -#if 0 /* No TpyCallChannel (we are redialing). Request a new call channel */ g_assert (priv->contact != NULL); account = empathy_contact_get_account (priv->contact); - request = empathy_call_create_call_request (priv->contact, + request = empathy_call_create_call_request ( + empathy_contact_get_id (priv->contact), priv->initial_audio, priv->initial_video); req = tp_account_channel_request_new (account, request, timestamp); + channel_factory = empathy_channel_factory_dup (); + tp_account_channel_request_set_channel_factory (req, + TP_CLIENT_CHANNEL_FACTORY (channel_factory)); + g_object_unref (channel_factory); + tp_account_channel_request_create_and_handle_channel_async (req, NULL, empathy_call_handler_request_cb, handler); g_object_unref (req); g_hash_table_unref (request); -#endif } /** diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 89133edb5..c24eff4da 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -750,9 +750,7 @@ preferences_themes_setup (EmpathyPreferences *preferences) GtkCellLayout *cell_layout; GtkCellRenderer *renderer; GtkListStore *store; - const gchar **themes; GList *adium_themes; - gint i; combo = GTK_COMBO_BOX (priv->combobox_chat_theme); cell_layout = GTK_CELL_LAYOUT (combo); @@ -767,6 +765,7 @@ preferences_themes_setup (EmpathyPreferences *preferences) COL_COMBO_VISIBLE_NAME, GTK_SORT_ASCENDING); /* Fill the model */ +#if 0 themes = empathy_theme_manager_get_themes (); for (i = 0; themes[i]; i += 2) { gtk_list_store_insert_with_values (store, NULL, -1, @@ -776,6 +775,7 @@ preferences_themes_setup (EmpathyPreferences *preferences) COL_COMBO_PATH, NULL, -1); } +#endif adium_themes = empathy_theme_manager_get_adium_themes (); while (adium_themes != NULL) { |