diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 00:37:48 +0800 |
commit | 84e30dab1428affe335ef904377d07f8b5fdeb66 (patch) | |
tree | fee9c8ec124a2b5804f6bb4ee31772db56a6e374 /src | |
parent | fd8e9c5dc2584055177c7a79021cdd53ca431c22 (diff) | |
parent | 3803736b4326d4bc00d58ccd25f910907f0b4521 (diff) | |
download | gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.gz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.bz2 gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.lz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.xz gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.tar.zst gsoc2013-empathy-84e30dab1428affe335ef904377d07f8b5fdeb66.zip |
Merge back from master
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window-fullscreen.ui | 2 | ||||
-rw-r--r-- | src/empathy-call-window.c | 100 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 31 | ||||
-rw-r--r-- | src/empathy-map-view.c | 25 | ||||
-rw-r--r-- | src/empathy-preferences.c | 15 | ||||
-rw-r--r-- | src/empathy-preferences.ui | 2 | ||||
-rw-r--r-- | src/empathy-status-icon.c | 35 | ||||
-rw-r--r-- | src/empathy.c | 41 |
8 files changed, 174 insertions, 77 deletions
diff --git a/src/empathy-call-window-fullscreen.ui b/src/empathy-call-window-fullscreen.ui index 5bf5e509b..4e864bce6 100644 --- a/src/empathy-call-window-fullscreen.ui +++ b/src/empathy-call-window-fullscreen.ui @@ -12,7 +12,7 @@ <signal name="motion_notify_event" handler="empathy_call_window_fullscreen_motion_notify_cb"/> <child> <object class="GtkButton" id="leave_fullscreen_button"> - <property name="label" translatable="yes">gtk-leave-fullscreen</property> + <property name="label">gtk-leave-fullscreen</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index bd958aada..f7ba24232 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -31,6 +31,8 @@ #include <telepathy-farsight/channel.h> +#include <gst/farsight/fs-element-added-notifier.h> + #include <libempathy/empathy-tp-contact-factory.h> #include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-utils.h> @@ -137,8 +139,10 @@ struct _EmpathyCallWindowPriv GtkWidget *vbox; gulong video_output_motion_handler_id; + guint bus_message_source_id; gdouble volume; + GtkWidget *volume_scale; GtkWidget *volume_progress_bar; GtkAdjustment *audio_input_adj; @@ -153,6 +157,8 @@ struct _EmpathyCallWindowPriv GstElement *funnel; GstElement *liveadder; + FsElementAddedNotifier *fsnotifier; + guint context_id; GTimer *timer; @@ -485,7 +491,10 @@ empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj, EmpathyCallWindowPriv *priv = GET_PRIV (self); gdouble volume; - volume = gtk_adjustment_get_value (adj)/100.0; + if (priv->audio_input == NULL) + return; + + volume = gtk_adjustment_get_value (adj)/100.0; /* Don't store the volume because of muting */ if (volume > 0 || gtk_toggle_tool_button_get_active ( @@ -518,27 +527,27 @@ static GtkWidget * empathy_call_window_create_audio_input (EmpathyCallWindow *self) { EmpathyCallWindowPriv *priv = GET_PRIV (self); - GtkWidget *hbox, *vbox, *scale, *label; - GtkAdjustment *adj; + GtkWidget *hbox, *vbox, *label; hbox = gtk_hbox_new (TRUE, 3); vbox = gtk_vbox_new (FALSE, 3); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 3); - scale = gtk_vscale_new_with_range (0, 150, 100); - gtk_range_set_inverted (GTK_RANGE (scale), TRUE); + priv->volume_scale = gtk_vscale_new_with_range (0, 150, 100); + gtk_range_set_inverted (GTK_RANGE (priv->volume_scale), TRUE); label = gtk_label_new (_("Volume")); - priv->audio_input_adj = adj = gtk_range_get_adjustment (GTK_RANGE (scale)); + priv->audio_input_adj = gtk_range_get_adjustment ( + GTK_RANGE (priv->volume_scale)); priv->volume = empathy_audio_src_get_volume (EMPATHY_GST_AUDIO_SRC (priv->audio_input)); - gtk_adjustment_set_value (adj, priv->volume * 100); + gtk_adjustment_set_value (priv->audio_input_adj, priv->volume * 100); - g_signal_connect (G_OBJECT (adj), "value-changed", + g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self); - gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 3); + gtk_box_pack_start (GTK_BOX (vbox), priv->volume_scale, TRUE, TRUE, 3); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3); priv->volume_progress_bar = gtk_progress_bar_new (); @@ -678,6 +687,8 @@ empathy_call_window_init (EmpathyCallWindow *self) GtkWidget *page; GstBus *bus; gchar *filename; + GKeyFile *keyfile; + GError *error = NULL; filename = empathy_file_lookup ("empathy-call-window.ui", "src"); gui = empathy_builder_get_file (filename, @@ -694,6 +705,7 @@ empathy_call_window_init (EmpathyCallWindow *self) "ui_manager", &priv->ui_manager, "menufullscreen", &priv->menu_fullscreen, NULL); + g_free (filename); empathy_builder_connect (gui, self, "menuhangup", "activate", empathy_call_window_hangup_cb, @@ -720,7 +732,27 @@ empathy_call_window_init (EmpathyCallWindow *self) priv->pipeline = gst_pipeline_new (NULL); bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline)); - gst_bus_add_watch (bus, empathy_call_window_bus_message, self); + priv->bus_message_source_id = gst_bus_add_watch (bus, + empathy_call_window_bus_message, self); + + priv->fsnotifier = fs_element_added_notifier_new (); + fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (priv->pipeline)); + + keyfile = g_key_file_new (); + filename = empathy_file_lookup ("element-properties", "data"); + if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error)) + { + fs_element_added_notifier_set_properties_from_keyfile (priv->fsnotifier, + keyfile); + } + else + { + g_warning ("Could not load element-properties file: %s", error->message); + g_key_file_free (keyfile); + g_clear_error (&error); + } + g_free (filename); + priv->remote_user_output_frame = gtk_frame_new (NULL); gtk_widget_set_size_request (priv->remote_user_output_frame, @@ -800,7 +832,6 @@ empathy_call_window_init (EmpathyCallWindow *self) g_object_ref (priv->ui_manager); g_object_unref (gui); - g_free (filename); } /* Instead of specifying a width and a height, we specify only one size. That's @@ -832,6 +863,8 @@ set_window_title (EmpathyCallWindow *self) EmpathyCallWindowPriv *priv = GET_PRIV (self); gchar *tmp; + /* translators: Call is a noun and %s is the contact name. This string is used + * in the window title */ tmp = g_strdup_printf (_("Call with %s"), empathy_contact_get_name (priv->contact)); gtk_window_set_title (GTK_WINDOW (self), tmp); @@ -901,6 +934,7 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self, else { g_warning ("call handler doesn't have a contact"); + /* translators: Call is a noun. This string is used in the window title */ gtk_window_set_title (GTK_WINDOW (self), _("Call")); /* Since we can't access the remote contact, we can't get a connection @@ -1041,7 +1075,6 @@ empathy_call_window_dispose (GObject *object) if (priv->handler != NULL) g_object_unref (priv->handler); - priv->handler = NULL; if (priv->pipeline != NULL) @@ -1064,6 +1097,10 @@ empathy_call_window_dispose (GObject *object) g_object_unref (priv->video_tee); priv->video_tee = NULL; + if (priv->fsnotifier != NULL) + g_object_unref (priv->fsnotifier); + priv->fsnotifier = NULL; + if (priv->timer_id != 0) g_source_remove (priv->timer_id); priv->timer_id = 0; @@ -1098,6 +1135,12 @@ empathy_call_window_finalize (GObject *object) priv->video_output_motion_handler_id = 0; } + if (priv->bus_message_source_id != 0) + { + g_source_remove (priv->bus_message_source_id); + priv->bus_message_source_id = 0; + } + /* free any data held directly by the object here */ g_mutex_free (priv->lock); @@ -1152,6 +1195,12 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) if (priv->pipeline == NULL) return TRUE; + if (priv->bus_message_source_id != 0) + { + g_source_remove (priv->bus_message_source_id); + priv->bus_message_source_id = 0; + } + state_change_return = gst_element_set_state (priv->pipeline, GST_STATE_NULL); if (state_change_return == GST_STATE_CHANGE_SUCCESS || @@ -1169,6 +1218,9 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) g_object_unref (priv->audio_input); priv->audio_input = NULL; + g_signal_handlers_disconnect_by_func (priv->audio_input_adj, + empathy_call_window_mic_volume_changed_cb, self); + if (priv->audio_output != NULL) g_object_unref (priv->audio_output); priv->audio_output = NULL; @@ -1243,6 +1295,9 @@ empathy_call_window_disconnected (EmpathyCallWindow *self) FALSE); gtk_action_set_sensitive (priv->show_preview, FALSE); + gtk_progress_bar_set_fraction ( + GTK_PROGRESS_BAR (priv->volume_progress_bar), 0); + gtk_widget_hide (priv->video_output); gtk_widget_show (priv->remote_user_avatar_widget); @@ -1656,7 +1711,15 @@ empathy_call_window_delete_cb (GtkWidget *widget, GdkEvent*event, EmpathyCallWindowPriv *priv = GET_PRIV (window); if (priv->pipeline != NULL) - gst_element_set_state (priv->pipeline, GST_STATE_NULL); + { + if (priv->bus_message_source_id != 0) + { + g_source_remove (priv->bus_message_source_id); + priv->bus_message_source_id = 0; + } + + gst_element_set_state (priv->pipeline, GST_STATE_NULL); + } if (priv->call_state == CONNECTING) empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING); @@ -1951,11 +2014,20 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) priv->pipeline = gst_pipeline_new (NULL); bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline)); - gst_bus_add_watch (bus, empathy_call_window_bus_message, window); + priv->bus_message_source_id = gst_bus_add_watch (bus, + empathy_call_window_bus_message, window); empathy_call_window_setup_remote_frame (bus, window); empathy_call_window_setup_self_frame (bus, window); + g_signal_connect (G_OBJECT (priv->audio_input_adj), "value-changed", + G_CALLBACK (empathy_call_window_mic_volume_changed_cb), window); + + /* While the call was disconnected, the input volume might have changed. + * However, since the audio_input source was destroyed, its volume has not + * been updated during that time. That's why we manually update it here */ + empathy_call_window_mic_volume_changed_cb (priv->audio_input_adj, window); + g_object_unref (bus); gtk_widget_show_all (priv->content_hbox); diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 822f22826..5f81ac167 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -850,7 +850,7 @@ chat_window_help_contents_activate_cb (GtkAction *action, { EmpathyChatWindowPriv *priv = GET_PRIV (window); - empathy_url_show (priv->dialog, "ghelp:empathy?chat"); + empathy_url_show (priv->dialog, "ghelp:empathy"); } static void @@ -945,7 +945,6 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, char *escaped; const char *body; GdkPixbuf *pixbuf; - NotificationData *cb_data; EmpathyChatWindowPriv *priv = GET_PRIV (window); gboolean res; @@ -959,37 +958,36 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, } } - cb_data = g_slice_new0 (NotificationData); - cb_data->chat = g_object_ref (chat); - cb_data->window = window; - sender = empathy_message_get_sender (message); header = empathy_contact_get_name (sender); body = empathy_message_get_body (message); escaped = g_markup_escape_text (body, -1); - pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); - if (priv->notification != NULL) { notify_notification_update (priv->notification, header, escaped, NULL); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); } else { + NotificationData *cb_data = cb_data = g_slice_new0 (NotificationData); + + cb_data->chat = g_object_ref (chat); + cb_data->window = window; + priv->notification = notify_notification_new (header, escaped, NULL, NULL); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); g_signal_connect (priv->notification, "closed", G_CALLBACK (chat_window_notification_closed_cb), cb_data); } + pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); + + if (pixbuf != NULL) { + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + g_object_unref (pixbuf); + } + notify_notification_show (priv->notification, NULL); - g_object_unref (pixbuf); g_free (escaped); } @@ -1002,7 +1000,8 @@ chat_window_set_highlight_room_tab_label (EmpathyChat *chat) if (!empathy_chat_is_room (chat)) return; - markup = g_markup_printf_escaped ("<span color=\"red\">%s</span>", + markup = g_markup_printf_escaped ( + "<span color=\"red\" weight=\"bold\">%s</span>", empathy_chat_get_name (chat)); widget = g_object_get_data (G_OBJECT (chat), "chat-window-tab-label"); diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 86e15bdff..8df13922a 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -26,7 +26,7 @@ #include <champlain/champlain.h> #include <champlain-gtk/champlain-gtk.h> -#include <clutter-gtk/gtk-clutter-embed.h> +#include <clutter-gtk/clutter-gtk.h> #include <telepathy-glib/util.h> #include <libempathy/empathy-contact.h> @@ -83,7 +83,7 @@ map_view_marker_update_position (ChamplainMarker *marker, if (location == NULL || g_hash_table_size (location) == 0) { - clutter_actor_hide (CLUTTER_ACTOR (marker)); + champlain_base_marker_animate_out (CHAMPLAIN_BASE_MARKER (marker)); return; } @@ -103,8 +103,8 @@ map_view_marker_update_position (ChamplainMarker *marker, } lon = g_value_get_double (value); - clutter_actor_show (CLUTTER_ACTOR (marker)); champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), lat, lon); + champlain_base_marker_animate_in (CHAMPLAIN_BASE_MARKER (marker)); } static void @@ -171,7 +171,7 @@ map_view_contacts_foreach (GtkTreeModel *model, gchar *date; gchar *label; GValue *gtime; - time_t time; + time_t loctime; gtk_tree_model_get (model, iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact, -1); @@ -181,7 +181,7 @@ map_view_contacts_foreach (GtkTreeModel *model, location = empathy_contact_get_location (contact); - if (location == NULL) + if (location == NULL || g_hash_table_size (location) == 0) return FALSE; marker = champlain_marker_new (); @@ -190,7 +190,8 @@ map_view_contacts_foreach (GtkTreeModel *model, if (avatar != NULL) { texture = clutter_texture_new (); - gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (texture), avatar); + gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (texture), avatar, + NULL); champlain_marker_set_image (CHAMPLAIN_MARKER (marker), texture); g_object_unref (avatar); } @@ -201,10 +202,18 @@ map_view_contacts_foreach (GtkTreeModel *model, gtime = g_hash_table_lookup (location, EMPATHY_LOCATION_TIMESTAMP); if (gtime != NULL) { - time = g_value_get_int64 (gtime); - date = empathy_time_to_string_relative (time); + time_t now; + + loctime = g_value_get_int64 (gtime); + date = empathy_time_to_string_relative (loctime); label = g_strconcat ("<b>", name, "</b>\n<small>", date, "</small>", NULL); g_free (date); + + now = time (NULL); + + /* if location is older than a week */ + if (now - loctime > (60 * 60 * 24 * 7)) + clutter_actor_set_opacity (CLUTTER_ACTOR (marker), 0.75 * 255); } else { diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c index 65c496547..d277273e9 100644 --- a/src/empathy-preferences.c +++ b/src/empathy-preferences.c @@ -29,6 +29,7 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <telepathy-glib/dbus.h> +#include <telepathy-glib/util.h> #include <libempathy/empathy-utils.h> @@ -557,7 +558,7 @@ preferences_languages_load_foreach (GtkTreeModel *model, } for (i = 0, lang = languages[i]; lang; lang = languages[++i]) { - if (strcmp (lang, code) == 0) { + if (!tp_strdiff (lang, code)) { found = TRUE; } } @@ -616,7 +617,7 @@ preferences_widget_sync_string (const gchar *key, GtkWidget *widget) if (GTK_IS_ENTRY (widget)) { gtk_entry_set_text (GTK_ENTRY (widget), value); } else if (GTK_IS_RADIO_BUTTON (widget)) { - if (strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) { + if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) { GType type; GEnumClass *enum_class; GEnumValue *enum_value; @@ -877,7 +878,7 @@ preferences_radio_button_toggled_cb (GtkWidget *button, key = g_object_get_data (G_OBJECT (button), "key"); - if (key && strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) { + if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) { GSList *group; GType type; GEnumClass *enum_class; @@ -897,7 +898,7 @@ preferences_radio_button_toggled_cb (GtkWidget *button, } value = enum_value->value_nick; - } else if (key && strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) { + } else if (!tp_strdiff (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM)) { return; } @@ -941,9 +942,9 @@ preferences_theme_notify_cb (EmpathyConf *conf, COL_COMBO_PATH, &path, -1); - if (strcmp (name, conf_name) == 0) { - if (strcmp (name, "adium") != 0 || - strcmp (path, conf_path) == 0) { + if (!tp_strdiff (name, conf_name)) { + if (tp_strdiff (name, "adium") || + !tp_strdiff (path, conf_path)) { found = TRUE; gtk_combo_box_set_active_iter (combo, &iter); g_free (name); diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui index a383607aa..1e3a42580 100644 --- a/src/empathy-preferences.ui +++ b/src/empathy-preferences.ui @@ -434,7 +434,7 @@ <property name="visible">True</property> <property name="xalign">0</property> <property name="wrap">True</property> - <property name="label" translatable="yes">Reduced location accuracy means that nothing more precise than your city, state and country will be published. GPS coordinates will have a random value added (±0.25°).</property> + <property name="label" translatable="yes">Reduced location accuracy means that nothing more precise than your city, state and country will be published. GPS coordinates will be accurate to 1 decimal place.</property> <attributes> <attribute name="scale" value="0.8"/> </attributes> diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index aca2d85c2..430c93343 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -23,6 +23,8 @@ #include <string.h> +#include <glib.h> + #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> @@ -136,30 +138,37 @@ status_icon_update_notification (EmpathyStatusIcon *icon) } if (priv->event) { - pixbuf = empathy_misc_get_pixbuf_for_notification (priv->event->contact, - priv->event->icon_name); + gchar *message_esc = NULL; + + if (priv->event->message != NULL) + message_esc = g_markup_escape_text (priv->event->message, -1); if (priv->notification) { notify_notification_update (priv->notification, - priv->event->header, priv->event->message, + priv->event->header, message_esc, NULL); } else { priv->notification = notify_notification_new_with_status_icon - (priv->event->header, priv->event->message, NULL, priv->icon); + (priv->event->header, message_esc, NULL, priv->icon); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); g_signal_connect (priv->notification, "closed", G_CALLBACK (status_icon_notification_closed_cb), icon); + } - } - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) + pixbuf = empathy_misc_get_pixbuf_for_notification (priv->event->contact, + priv->event->icon_name); + + if (pixbuf != NULL) { notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + g_object_unref (pixbuf); + } + notify_notification_show (priv->notification, NULL); - g_object_unref (pixbuf); + g_free (message_esc); } else { notification_close_helper (priv); } @@ -173,12 +182,12 @@ status_icon_update_tooltip (EmpathyStatusIcon *icon) if (priv->event) { if (priv->event->message != NULL) - tooltip = g_strdup_printf ("<i>%s</i>\n%s", - priv->event->header, - priv->event->message); + tooltip = g_markup_printf_escaped ("<i>%s</i>\n%s", + priv->event->header, + priv->event->message); else - tooltip = g_strdup_printf ("<i>%s</i>", - priv->event->header); + tooltip = g_markup_printf_escaped ("<i>%s</i>", + priv->event->header); gtk_status_icon_set_tooltip_markup (priv->icon, tooltip); } else { tooltip = g_strdup (empathy_idle_get_status (priv->idle)); diff --git a/src/empathy.c b/src/empathy.c index 3cc494a94..718fe70bf 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -33,7 +33,7 @@ #include <unique/unique.h> #if HAVE_LIBCHAMPLAIN -#include <clutter-gtk/gtk-clutter-embed.h> +#include <clutter-gtk/clutter-gtk.h> #endif #include <libebook/e-book.h> @@ -49,6 +49,7 @@ #include <libempathy/empathy-call-factory.h> #include <libempathy/empathy-chatroom-manager.h> #include <libempathy/empathy-account-settings.h> +#include <libempathy/empathy-connectivity.h> #include <libempathy/empathy-account-manager.h> #include <libempathy/empathy-connection-managers.h> #include <libempathy/empathy-debugger.h> @@ -148,19 +149,6 @@ dispatch_cb (EmpathyDispatcher *dispatcher, } } -static void -use_nm_notify_cb (EmpathyConf *conf, - const gchar *key, - gpointer user_data) -{ - EmpathyIdle *idle = user_data; - gboolean use_nm; - - if (empathy_conf_get_bool (conf, key, &use_nm)) { - empathy_idle_set_use_nm (idle, use_nm); - } -} - /* Salut account creation */ static gboolean should_create_salut_account (void) @@ -229,6 +217,19 @@ salut_account_created (GObject *source, } static void +use_conn_notify_cb (EmpathyConf *conf, + const gchar *key, + gpointer user_data) +{ + EmpathyConnectivity *connectivity = user_data; + gboolean use_conn; + + if (empathy_conf_get_bool (conf, key, &use_conn)) { + empathy_connectivity_set_use_conn (connectivity, use_conn); + } +} + +static void create_salut_account_if_needed (EmpathyConnectionManagers *managers) { EmpathyAccountSettings *settings; @@ -535,6 +536,7 @@ main (int argc, char *argv[]) EmpathyFTFactory *ft_factory; GtkWidget *window; EmpathyIdle *idle; + EmpathyConnectivity *connectivity; gboolean autoconnect = TRUE; gboolean no_connect = FALSE; gboolean hide_contact_list = FALSE; @@ -637,9 +639,13 @@ main (int argc, char *argv[]) /* Setting up Idle */ idle = empathy_idle_dup_singleton (); empathy_idle_set_auto_away (idle, TRUE); - use_nm_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_NM, idle); - empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_NM, - use_nm_notify_cb, idle); + + /* Setting up Connectivity */ + connectivity = empathy_connectivity_dup_singleton (); + use_conn_notify_cb (empathy_conf_get (), EMPATHY_PREFS_USE_CONN, + connectivity); + empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_USE_CONN, + use_conn_notify_cb, connectivity); /* Autoconnect */ empathy_conf_get_bool (empathy_conf_get (), @@ -699,6 +705,7 @@ main (int argc, char *argv[]) empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE); g_object_unref (idle); + g_object_unref (connectivity); g_object_unref (icon); g_object_unref (account_manager); g_object_unref (log_manager); |