]> git.0d.be Git - empathy.git/blobdiff - src/empathy-preferences.c
Merge branch 'gnome-3-8'
[empathy.git] / src / empathy-preferences.c
index 0c996863192f591a79d0c8ea1a0b941c955bea50..c05058b8d7ab5e04669c8246ce77d8220fcb006f 100644 (file)
  *          Danielle Madeley <danielle.madeley@collabora.co.uk>
  */
 
-#include <config.h>
-
-#include <string.h>
-#include <stdio.h>
+#include "config.h"
+#include "empathy-preferences.h"
 
-#include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/util.h>
-
-#include <libempathy/empathy-gsettings.h>
-#include <libempathy/empathy-utils.h>
+#include <tp-account-widgets/tpaw-builder.h>
 
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-theme-manager.h>
-#include <libempathy-gtk/empathy-spell.h>
-#include <libempathy-gtk/empathy-gtk-enum-types.h>
-#include <libempathy-gtk/empathy-theme-adium.h>
-
-#include "empathy-preferences.h"
+#include "empathy-client-factory.h"
+#include "empathy-gsettings.h"
+#include "empathy-spell.h"
+#include "empathy-theme-manager.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 G_DEFINE_TYPE (EmpathyPreferences, empathy_preferences, GTK_TYPE_DIALOG);
 
@@ -65,7 +57,9 @@ static const gchar * empathy_preferences_tabs[] =
 struct _EmpathyPreferencesPriv {
        GtkWidget *notebook;
 
+       GtkWidget *label_general_behavior;
        GtkWidget *checkbutton_events_notif_area;
+       GtkWidget *checkbutton_autoconnect;
 
        GtkWidget *treeview_sounds;
        GtkWidget *treeview_spell_checker;
@@ -196,12 +190,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences,
 
        BIND_ACTIVE (loc, LOCATION_PUBLISH,
                     "checkbutton_location_publish");
-       BIND_ACTIVE (loc, LOCATION_RESOURCE_NETWORK,
-                    "checkbutton_location_resource_network");
-       BIND_ACTIVE (loc, LOCATION_RESOURCE_CELL,
-                    "checkbutton_location_resource_cell");
-       BIND_ACTIVE (loc, LOCATION_RESOURCE_GPS,
-                    "checkbutton_location_resource_gps");
        BIND_ACTIVE (loc, LOCATION_REDUCE_ACCURACY,
                     "checkbutton_location_reduce_accuracy");
 
@@ -607,7 +595,7 @@ preferences_preview_theme_changed_cb (EmpathyThemeManager *manager,
                                      EmpathyPreferences  *preferences)
 {
        EmpathyPreferencesPriv *priv = GET_PRIV (preferences);
-       TpDBusDaemon *dbus;
+       EmpathyClientFactory *factory;
        TpAccount *account;
        EmpathyContact *juliet;
        EmpathyContact *romeo;
@@ -625,9 +613,11 @@ preferences_preview_theme_changed_cb (EmpathyThemeManager *manager,
        /* FIXME: It is ugly to add a fake conversation like that.
         * Would be cool if we could request a TplLogManager for a fake
         * conversation */
-       dbus = tp_dbus_daemon_dup (NULL);
-       account = tp_account_new (dbus,
-               TP_ACCOUNT_OBJECT_PATH_BASE "cm/jabber/account", NULL);
+       factory = empathy_client_factory_dup ();
+
+       account = tp_simple_client_factory_ensure_account (
+               TP_SIMPLE_CLIENT_FACTORY (factory),
+               TP_ACCOUNT_OBJECT_PATH_BASE "cm/jabber/account", NULL, NULL);
        juliet = g_object_new (EMPATHY_TYPE_CONTACT,
                "account", account,
                "id", "juliet",
@@ -666,7 +656,7 @@ preferences_preview_theme_changed_cb (EmpathyThemeManager *manager,
        g_object_unref (juliet);
        g_object_unref (romeo);
        g_object_unref (account);
-       g_object_unref (dbus);
+       g_object_unref (factory);
 }
 
 static void
@@ -1031,19 +1021,21 @@ empathy_preferences_init (EmpathyPreferences *preferences)
        gtk_window_set_role (GTK_WINDOW (preferences), "preferences");
        gtk_window_set_position (GTK_WINDOW (preferences),
                                 GTK_WIN_POS_CENTER_ON_PARENT);
-       gtk_window_set_icon_name (GTK_WINDOW (preferences), "gtk-preferences");
+       gtk_window_set_icon_name (GTK_WINDOW (preferences), "preferences-desktop");
 
        filename = empathy_file_lookup ("empathy-preferences.ui", "src");
-       gui = empathy_builder_get_file (filename,
+       gui = tpaw_builder_get_file (filename,
                "notebook", &priv->notebook,
                "vbox_chat_theme", &priv->vbox_chat_theme,
                "combobox_chat_theme", &priv->combobox_chat_theme,
                "combobox_chat_theme_variant", &priv->combobox_chat_theme_variant,
                "hbox_chat_theme_variant", &priv->hbox_chat_theme_variant,
                "sw_chat_theme_preview", &priv->sw_chat_theme_preview,
-               "checkbutton_events_notif_area", &priv->checkbutton_events_notif_area,
                "treeview_sounds", &priv->treeview_sounds,
                "treeview_spell_checker", &priv->treeview_spell_checker,
+               "label_general_behavior", &priv->label_general_behavior,
+               "checkbutton_events_notif_area", &priv->checkbutton_events_notif_area,
+               "checkbutton_autoconnect", &priv->checkbutton_autoconnect,
                NULL);
        g_free (filename);
 
@@ -1134,12 +1126,19 @@ empathy_preferences_new (GtkWindow *parent,
 
        /* when running in Gnome Shell we must hide these options since they
         * are meaningless in that context:
+        * - General->Behavior label
         * - 'Display incoming events in the notification area' (General->Behavior)
+        * - 'Automatically connect at startup' (General->Behavior)
         * - 'Notifications' tab
         */
        priv = GET_PRIV (self);
        if (shell_running) {
+               /* Behavior */
+               gtk_widget_hide (priv->label_general_behavior);
                gtk_widget_hide (priv->checkbutton_events_notif_area);
+               gtk_widget_hide (priv->checkbutton_autoconnect);
+
+               /* Notifications tab */
                notif_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->notebook),
                                                        EMPATHY_PREFERENCES_TAB_NOTIFICATIONS);
                gtk_widget_hide (notif_page);