]> git.0d.be Git - empathy.git/blobdiff - src/empathy-preferences.c
Merge commit 'jtellier/video-call-button-sensitivity'
[empathy.git] / src / empathy-preferences.c
index 4d1fd71fd4a7db075a4dc6148f48e53a4b5c824a..65c496547b153a09cc5e392b3c707fb85b0a856d 100644 (file)
@@ -14,8 +14,8 @@
  *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
  *
  * Authors: Mikael Hallendal <micke@imendio.com>
  *          Richard Hult <richard@imendio.com>
@@ -28,6 +28,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <telepathy-glib/dbus.h>
 
 #include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-contact-list-store.h>
 #include <libempathy-gtk/empathy-gtk-enum-types.h>
 
+#ifdef HAVE_WEBKIT
+#include <libempathy-gtk/empathy-theme-adium.h>
+#endif
+
 #include "empathy-preferences.h"
 
 typedef struct {
@@ -45,14 +50,11 @@ typedef struct {
 
        GtkWidget *notebook;
 
-       GtkWidget *checkbutton_show_avatars;
-       GtkWidget *checkbutton_compact_contact_list;
        GtkWidget *checkbutton_show_smileys;
+       GtkWidget *checkbutton_show_contacts_in_rooms;
        GtkWidget *combobox_chat_theme;
        GtkWidget *checkbutton_separate_chat_windows;
        GtkWidget *checkbutton_autoconnect;
-       GtkWidget *radiobutton_contact_list_sort_by_name;
-       GtkWidget *radiobutton_contact_list_sort_by_state;
 
        GtkWidget *checkbutton_sounds_enabled;
        GtkWidget *checkbutton_sounds_disabled_away;
@@ -61,9 +63,17 @@ typedef struct {
        GtkWidget *checkbutton_notifications_enabled;
        GtkWidget *checkbutton_notifications_disabled_away;
        GtkWidget *checkbutton_notifications_focus;
+       GtkWidget *checkbutton_notifications_contact_signin;
+       GtkWidget *checkbutton_notifications_contact_signout;
 
        GtkWidget *treeview_spell_checker;
 
+       GtkWidget *checkbutton_location_publish;
+       GtkWidget *checkbutton_location_reduce_accuracy;
+       GtkWidget *checkbutton_location_resource_network;
+       GtkWidget *checkbutton_location_resource_cell;
+       GtkWidget *checkbutton_location_resource_gps;
+
        GList     *notify_ids;
 } EmpathyPreferences;
 
@@ -83,19 +93,8 @@ static gboolean preferences_languages_load_foreach       (GtkTreeModel
 static void     preferences_languages_cell_toggled_cb    (GtkCellRendererToggle  *cell,
                                                          gchar                  *path_string,
                                                          EmpathyPreferences      *preferences);
-static void     preferences_themes_setup                 (EmpathyPreferences      *preferences);
 static void     preferences_widget_sync_bool             (const gchar            *key,
                                                          GtkWidget              *widget);
-static void     preferences_widget_sync_string           (const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_widget_sync_string_combo     (const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_notify_string_cb             (EmpathyConf             *conf,
-                                                         const gchar            *key,
-                                                         gpointer                user_data);
-static void     preferences_notify_string_combo_cb       (EmpathyConf             *conf,
-                                                         const gchar            *key,
-                                                         gpointer                user_data);
 static void     preferences_notify_bool_cb               (EmpathyConf             *conf,
                                                          const gchar            *key,
                                                          gpointer                user_data);
@@ -105,21 +104,11 @@ static void     preferences_notify_sensitivity_cb        (EmpathyConf
 static void     preferences_hookup_toggle_button         (EmpathyPreferences      *preferences,
                                                          const gchar            *key,
                                                          GtkWidget              *widget);
-static void     preferences_hookup_radio_button          (EmpathyPreferences      *preferences,
-                                                         const gchar            *key,
-                                                         GtkWidget              *widget);
-static void     preferences_hookup_string_combo          (EmpathyPreferences      *preferences,
-                                                         const gchar            *key,
-                                                         GtkWidget              *widget);
 static void     preferences_hookup_sensitivity           (EmpathyPreferences      *preferences,
                                                          const gchar            *key,
                                                          GtkWidget              *widget);
 static void     preferences_toggle_button_toggled_cb     (GtkWidget              *button,
                                                          gpointer                user_data);
-static void     preferences_radio_button_toggled_cb      (GtkWidget              *button,
-                                                         gpointer                user_data);
-static void     preferences_string_combo_changed_cb      (GtkWidget *button,
-                                                         gpointer                user_data);
 static void     preferences_destroy_cb                   (GtkWidget              *widget,
                                                          EmpathyPreferences      *preferences);
 static void     preferences_response_cb                  (GtkWidget              *widget,
@@ -134,8 +123,10 @@ enum {
 };
 
 enum {
+       COL_COMBO_IS_ADIUM,
        COL_COMBO_VISIBLE_NAME,
        COL_COMBO_NAME,
+       COL_COMBO_PATH,
        COL_COMBO_COUNT
 };
 
@@ -169,25 +160,9 @@ preferences_add_id (EmpathyPreferences *preferences, guint id)
                                                  GUINT_TO_POINTER (id));
 }
 
-static void
-preferences_compact_contact_list_changed_cb (EmpathyConf *conf,
-                                            const gchar *key,
-                                            gpointer     user_data)
-{
-       EmpathyPreferences *preferences = user_data;
-       gboolean            value;
-
-       if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) {
-               gtk_widget_set_sensitive (preferences->checkbutton_show_avatars,
-                                         !value);
-       }
-}
-
 static void
 preferences_setup_widgets (EmpathyPreferences *preferences)
 {
-       guint id;
-
        preferences_hookup_toggle_button (preferences,
                                          EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
                                          preferences->checkbutton_notifications_enabled);
@@ -197,6 +172,12 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
        preferences_hookup_toggle_button (preferences,
                                          EMPATHY_PREFS_NOTIFICATIONS_FOCUS,
                                          preferences->checkbutton_notifications_focus);
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNIN,
+                                         preferences->checkbutton_notifications_contact_signin);
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_NOTIFICATIONS_CONTACT_SIGNOUT,
+                                         preferences->checkbutton_notifications_contact_signout);
 
        preferences_hookup_sensitivity (preferences,
                                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
@@ -204,6 +185,12 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
        preferences_hookup_sensitivity (preferences,
                                        EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
                                        preferences->checkbutton_notifications_focus);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                                       preferences->checkbutton_notifications_contact_signin);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_NOTIFICATIONS_ENABLED,
+                                       preferences->checkbutton_notifications_contact_signout);
 
        preferences_hookup_toggle_button (preferences,
                                          EMPATHY_PREFS_SOUNDS_ENABLED,
@@ -224,39 +211,48 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
                                          preferences->checkbutton_separate_chat_windows);
 
        preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_UI_SHOW_AVATARS,
-                                         preferences->checkbutton_show_avatars);
+                                         EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
+                                         preferences->checkbutton_show_smileys);
 
        preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                                         preferences->checkbutton_compact_contact_list);
+                                         EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
+                                         preferences->checkbutton_show_contacts_in_rooms);
 
        preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
-                                         preferences->checkbutton_show_smileys);
+                                         EMPATHY_PREFS_AUTOCONNECT,
+                                         preferences->checkbutton_autoconnect);
 
-       preferences_hookup_string_combo (preferences,
-                                        EMPATHY_PREFS_CHAT_THEME,
-                                        preferences->combobox_chat_theme);
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_LOCATION_PUBLISH,
+                                         preferences->checkbutton_location_publish);
 
-       preferences_hookup_radio_button (preferences,
-                                        EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
-                                        preferences->radiobutton_contact_list_sort_by_name);
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+                                         preferences->checkbutton_location_resource_network);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_LOCATION_PUBLISH,
+                                       preferences->checkbutton_location_resource_network);
 
        preferences_hookup_toggle_button (preferences,
-                                         EMPATHY_PREFS_AUTOCONNECT,
-                                         preferences->checkbutton_autoconnect);
+                                         EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
+                                         preferences->checkbutton_location_resource_cell);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_LOCATION_PUBLISH,
+                                       preferences->checkbutton_location_resource_cell);
 
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                                     preferences_compact_contact_list_changed_cb,
-                                     preferences);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-       preferences_compact_contact_list_changed_cb (empathy_conf_get (),
-                                                    EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST,
-                                                    preferences);
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
+                                         preferences->checkbutton_location_resource_gps);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_LOCATION_PUBLISH,
+                                       preferences->checkbutton_location_resource_gps);
+
+       preferences_hookup_toggle_button (preferences,
+                                         EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
+                                         preferences->checkbutton_location_reduce_accuracy);
+       preferences_hookup_sensitivity (preferences,
+                                       EMPATHY_PREFS_LOCATION_PUBLISH,
+                                       preferences->checkbutton_location_reduce_accuracy);
 }
 
 static void
@@ -288,6 +284,7 @@ preferences_sound_cell_toggled_cb (GtkCellRendererToggle *toggle,
 
        empathy_conf_set_bool (empathy_conf_get (), key, instore);
 
+       g_free (key);
        gtk_tree_path_free (path);
 }
 
@@ -421,12 +418,12 @@ preferences_languages_add (EmpathyPreferences *preferences)
 
        codes = empathy_spell_get_language_codes ();
 
-       empathy_conf_set_bool (empathy_conf_get(),
+       empathy_conf_set_bool (empathy_conf_get (),
                               EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
                               codes != NULL);
        if (!codes) {
                gtk_widget_set_sensitive (preferences->treeview_spell_checker, FALSE);
-       }               
+       }
 
        for (l = codes; l; l = l->next) {
                GtkTreeIter  iter;
@@ -565,6 +562,7 @@ preferences_languages_load_foreach (GtkTreeModel  *model,
                }
        }
 
+       g_free (code);
        gtk_list_store_set (GTK_LIST_STORE (model), iter, COL_LANG_ENABLED, found, -1);
        return FALSE;
 }
@@ -598,34 +596,6 @@ preferences_languages_cell_toggled_cb (GtkCellRendererToggle *cell,
        preferences_languages_save (preferences);
 }
 
-static void
-preferences_themes_setup (EmpathyPreferences *preferences)
-{
-       GtkComboBox   *combo;
-       GtkListStore  *model;
-       GtkTreeIter    iter;
-       const gchar  **themes;
-       gint           i;
-
-       combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
-
-       model = gtk_list_store_new (COL_COMBO_COUNT,
-                                   G_TYPE_STRING,
-                                   G_TYPE_STRING);
-
-       themes = empathy_theme_manager_get_themes ();
-       for (i = 0; themes[i]; i += 2) {
-               gtk_list_store_append (model, &iter);
-               gtk_list_store_set (model, &iter,
-                                   COL_COMBO_VISIBLE_NAME, _(themes[i + 1]),
-                                   COL_COMBO_NAME, themes[i],
-                                   -1);
-       }
-
-       gtk_combo_box_set_model (combo, GTK_TREE_MODEL (model));
-       g_object_unref (model);
-}
-
 static void
 preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
 {
@@ -636,6 +606,7 @@ preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
        }
 }
 
+#if 0
 static void
 preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
 {
@@ -651,13 +622,13 @@ preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
                                GEnumValue  *enum_value;
                                GSList      *list;
                                GtkWidget   *toggle_widget;
-                               
+
                                /* Get index from new string */
                                type = empathy_contact_list_store_sort_get_type ();
                                enum_class = G_ENUM_CLASS (g_type_class_peek (type));
                                enum_value = g_enum_get_value_by_nick (enum_class, value);
-                               
-                               if (enum_value) { 
+
+                               if (enum_value) {
                                        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
                                        toggle_widget = g_slist_nth_data (list, enum_value->value);
                                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_widget), TRUE);
@@ -671,51 +642,6 @@ preferences_widget_sync_string (const gchar *key, GtkWidget *widget)
        }
 }
 
-static void
-preferences_widget_sync_string_combo (const gchar *key, GtkWidget *widget)
-{
-       gchar        *value;
-       GtkTreeModel *model;
-       GtkTreeIter   iter;
-       gboolean      found;
-
-       if (!empathy_conf_get_string (empathy_conf_get (), key, &value)) {
-               return;
-       }
-
-       model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-
-       found = FALSE;
-       if (value && gtk_tree_model_get_iter_first (model, &iter)) {
-               gchar *name;
-
-               do {
-                       gtk_tree_model_get (model, &iter,
-                                           COL_COMBO_NAME, &name,
-                                           -1);
-
-                       if (strcmp (name, value) == 0) {
-                               found = TRUE;
-                               gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
-                               break;
-                       } else {
-                               found = FALSE;
-                       }
-
-                       g_free (name);
-               } while (gtk_tree_model_iter_next (model, &iter));
-       }
-
-       /* Fallback to the first one. */
-       if (!found) {
-               if (gtk_tree_model_get_iter_first (model, &iter)) {
-                       gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
-               }
-       }
-
-       g_free (value);
-}
-
 static void
 preferences_notify_string_cb (EmpathyConf  *conf,
                              const gchar *key,
@@ -723,14 +649,7 @@ preferences_notify_string_cb (EmpathyConf  *conf,
 {
        preferences_widget_sync_string (key, user_data);
 }
-
-static void
-preferences_notify_string_combo_cb (EmpathyConf  *conf,
-                                   const gchar *key,
-                                   gpointer     user_data)
-{
-       preferences_widget_sync_string_combo (key, user_data);
-}
+#endif
 
 static void
 preferences_notify_bool_cb (EmpathyConf  *conf,
@@ -770,7 +689,7 @@ preferences_notify_int_cb (EmpathyConf  *conf,
                           const gchar *key,
                           gpointer     user_data)
 {
-       preferences_widget_sync_int (key, user_data);   
+       preferences_widget_sync_int (key, user_data);
 }
 
 static void
@@ -878,6 +797,7 @@ preferences_hookup_toggle_button (EmpathyPreferences *preferences,
        }
 }
 
+#if 0
 static void
 preferences_hookup_radio_button (EmpathyPreferences *preferences,
                                 const gchar       *key,
@@ -907,32 +827,7 @@ preferences_hookup_radio_button (EmpathyPreferences *preferences,
                preferences_add_id (preferences, id);
        }
 }
-
-static void
-preferences_hookup_string_combo (EmpathyPreferences *preferences,
-                                const gchar       *key,
-                                GtkWidget         *widget)
-{
-       guint id;
-
-       preferences_widget_sync_string_combo (key, widget);
-
-       g_object_set_data_full (G_OBJECT (widget), "key",
-                               g_strdup (key), g_free);
-
-       g_signal_connect (widget,
-                         "changed",
-                         G_CALLBACK (preferences_string_combo_changed_cb),
-                         NULL);
-
-       id = empathy_conf_notify_add (empathy_conf_get (),
-                                     key,
-                                     preferences_notify_string_combo_cb,
-                                     widget);
-       if (id) {
-               preferences_add_id (preferences, id);
-       }
-}
+#endif
 
 static void
 preferences_hookup_sensitivity (EmpathyPreferences *preferences,
@@ -968,6 +863,7 @@ preferences_toggle_button_toggled_cb (GtkWidget *button,
                               gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
 }
 
+#if 0
 static void
 preferences_radio_button_toggled_cb (GtkWidget *button,
                                     gpointer   user_data)
@@ -986,45 +882,211 @@ preferences_radio_button_toggled_cb (GtkWidget *button,
                GType        type;
                GEnumClass  *enum_class;
                GEnumValue  *enum_value;
-               
+
                group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
-               
+
                /* Get string from index */
                type = empathy_contact_list_store_sort_get_type ();
                enum_class = G_ENUM_CLASS (g_type_class_peek (type));
                enum_value = g_enum_get_value (enum_class, g_slist_index (group, button));
-               
+
                if (!enum_value) {
-                       g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d", 
+                       g_warning ("No GEnumValue for EmpathyContactListSort with GtkRadioButton index:%d",
                                   g_slist_index (group, button));
                        return;
                }
 
                value = enum_value->value_nick;
+       } else if (key && strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) {
+           return;
        }
 
        empathy_conf_set_string (empathy_conf_get (), key, value);
 }
+#endif
 
 static void
-preferences_string_combo_changed_cb (GtkWidget *combo,
-                                    gpointer   user_data)
+preferences_theme_notify_cb (EmpathyConf *conf,
+                            const gchar *key,
+                            gpointer     user_data)
+{
+       EmpathyPreferences *preferences = user_data;
+       GtkComboBox        *combo;
+       gchar              *conf_name;
+       gchar              *conf_path;
+       GtkTreeModel       *model;
+       GtkTreeIter         iter;
+       gboolean            found = FALSE;
+
+       if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_THEME, &conf_name)) {
+               return;
+       }
+
+       if (!empathy_conf_get_string (conf, EMPATHY_PREFS_CHAT_ADIUM_PATH, &conf_path)) {
+               g_free (conf_name);
+               return;
+       }
+
+       combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
+       model = gtk_combo_box_get_model (combo);
+       if (gtk_tree_model_get_iter_first (model, &iter)) {
+               gboolean is_adium;
+               gchar *name;
+               gchar *path;
+
+               do {
+                       gtk_tree_model_get (model, &iter,
+                                           COL_COMBO_IS_ADIUM, &is_adium,
+                                           COL_COMBO_NAME, &name,
+                                           COL_COMBO_PATH, &path,
+                                           -1);
+
+                       if (strcmp (name, conf_name) == 0) {
+                               if (strcmp (name, "adium") != 0 ||
+                                   strcmp (path, conf_path) == 0) {
+                                       found = TRUE;
+                                       gtk_combo_box_set_active_iter (combo, &iter);
+                                       g_free (name);
+                                       g_free (path);
+                                       break;
+                               }
+                       }
+
+                       g_free (name);
+                       g_free (path);
+               } while (gtk_tree_model_iter_next (model, &iter));
+       }
+
+       /* Fallback to the first one. */
+       if (!found) {
+               if (gtk_tree_model_get_iter_first (model, &iter)) {
+                       gtk_combo_box_set_active_iter (combo, &iter);
+               }
+       }
+
+       g_free (conf_name);
+       g_free (conf_path);
+}
+
+static void
+preferences_theme_changed_cb (GtkComboBox        *combo,
+                             EmpathyPreferences *preferences)
 {
-       const gchar  *key;
        GtkTreeModel *model;
        GtkTreeIter   iter;
+       gboolean      is_adium;
        gchar        *name;
+       gchar        *path;
 
-       key = g_object_get_data (G_OBJECT (combo), "key");
-
-       if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter)) {
-               model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+       if (gtk_combo_box_get_active_iter (combo, &iter)) {
+               model = gtk_combo_box_get_model (combo);
 
                gtk_tree_model_get (model, &iter,
+                                   COL_COMBO_IS_ADIUM, &is_adium,
                                    COL_COMBO_NAME, &name,
+                                   COL_COMBO_PATH, &path,
                                    -1);
-               empathy_conf_set_string (empathy_conf_get (), key, name);
+
+               empathy_conf_set_string (empathy_conf_get (),
+                                        EMPATHY_PREFS_CHAT_THEME,
+                                        name);
+               if (is_adium == TRUE)
+                       empathy_conf_set_string (empathy_conf_get (),
+                                                EMPATHY_PREFS_CHAT_ADIUM_PATH,
+                                                path);
                g_free (name);
+               g_free (path);
+       }
+}
+
+static void
+preferences_themes_setup (EmpathyPreferences *preferences)
+{
+       GtkComboBox   *combo;
+       GtkCellLayout *cell_layout;
+       GtkCellRenderer *renderer;
+       GtkListStore  *store;
+       const gchar  **themes;
+       GList         *adium_themes;
+       gint           i;
+       guint          id;
+
+       combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
+       cell_layout = GTK_CELL_LAYOUT (combo);
+
+       /* Create the model */
+       store = gtk_list_store_new (COL_COMBO_COUNT,
+                                   G_TYPE_BOOLEAN, /* Is an Adium theme */
+                                   G_TYPE_STRING,  /* Display name */
+                                   G_TYPE_STRING,  /* Theme name */
+                                   G_TYPE_STRING); /* Theme path */
+       gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+               COL_COMBO_VISIBLE_NAME, GTK_SORT_ASCENDING);
+
+       /* Fill the model */
+       themes = empathy_theme_manager_get_themes ();
+       for (i = 0; themes[i]; i += 2) {
+               gtk_list_store_insert_with_values (store, NULL, -1,
+                       COL_COMBO_IS_ADIUM, FALSE,
+                       COL_COMBO_VISIBLE_NAME, _(themes[i + 1]),
+                       COL_COMBO_NAME, themes[i],
+                       COL_COMBO_PATH, NULL,
+                       -1);
+       }
+
+       adium_themes = empathy_theme_manager_get_adium_themes ();
+       while (adium_themes != NULL) {
+               GHashTable *info;
+               const gchar *name;
+               const gchar *path;
+
+               info = adium_themes->data;
+               name = tp_asv_get_string (info, "CFBundleName");
+               path = tp_asv_get_string (info, "path");
+
+               if (name != NULL && path != NULL) {
+                       gtk_list_store_insert_with_values (store, NULL, -1,
+                               COL_COMBO_IS_ADIUM, TRUE,
+                               COL_COMBO_VISIBLE_NAME, name,
+                               COL_COMBO_NAME, "adium",
+                               COL_COMBO_PATH, path,
+                               -1);
+               }
+               g_hash_table_unref (info);
+               adium_themes = g_list_delete_link (adium_themes, adium_themes);
+       }
+
+       /* Add cell renderer */
+       renderer = gtk_cell_renderer_text_new ();
+       gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
+       gtk_cell_layout_set_attributes (cell_layout, renderer,
+               "text", COL_COMBO_VISIBLE_NAME, NULL);
+
+       gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
+       g_object_unref (store);
+
+       g_signal_connect (combo, "changed",
+                         G_CALLBACK (preferences_theme_changed_cb),
+                         preferences);
+
+       /* Select the theme from the gconf key and track changes */
+       preferences_theme_notify_cb (empathy_conf_get (),
+                                    EMPATHY_PREFS_CHAT_THEME,
+                                    preferences);
+       id = empathy_conf_notify_add (empathy_conf_get (),
+                                     EMPATHY_PREFS_CHAT_THEME,
+                                     preferences_theme_notify_cb,
+                                     preferences);
+       if (id) {
+               preferences_add_id (preferences, id);
+       }
+
+       id = empathy_conf_notify_add (empathy_conf_get (),
+                                     EMPATHY_PREFS_CHAT_ADIUM_PATH,
+                                     preferences_theme_notify_cb,
+                                     preferences);
+       if (id) {
+               preferences_add_id (preferences, id);
        }
 }
 
@@ -1059,6 +1121,7 @@ empathy_preferences_show (GtkWindow *parent)
        static EmpathyPreferences *preferences;
        GtkBuilder                *gui;
        gchar                     *filename;
+       GtkWidget                 *page;
 
        if (preferences) {
                gtk_window_present (GTK_WINDOW (preferences->dialog));
@@ -1071,21 +1134,25 @@ empathy_preferences_show (GtkWindow *parent)
        gui = empathy_builder_get_file (filename,
                "preferences_dialog", &preferences->dialog,
                "notebook", &preferences->notebook,
-               "checkbutton_show_avatars", &preferences->checkbutton_show_avatars,
-               "checkbutton_compact_contact_list", &preferences->checkbutton_compact_contact_list,
                "checkbutton_show_smileys", &preferences->checkbutton_show_smileys,
+               "checkbutton_show_contacts_in_rooms", &preferences->checkbutton_show_contacts_in_rooms,
                "combobox_chat_theme", &preferences->combobox_chat_theme,
                "checkbutton_separate_chat_windows", &preferences->checkbutton_separate_chat_windows,
                "checkbutton_autoconnect", &preferences->checkbutton_autoconnect,
-               "radiobutton_contact_list_sort_by_name", &preferences->radiobutton_contact_list_sort_by_name,
-               "radiobutton_contact_list_sort_by_state", &preferences->radiobutton_contact_list_sort_by_state,
                "checkbutton_notifications_enabled", &preferences->checkbutton_notifications_enabled,
                "checkbutton_notifications_disabled_away", &preferences->checkbutton_notifications_disabled_away,
                "checkbutton_notifications_focus", &preferences->checkbutton_notifications_focus,
+               "checkbutton_notifications_contact_signin", &preferences->checkbutton_notifications_contact_signin,
+               "checkbutton_notifications_contact_signout", &preferences->checkbutton_notifications_contact_signout,
                "checkbutton_sounds_enabled", &preferences->checkbutton_sounds_enabled,
                "checkbutton_sounds_disabled_away", &preferences->checkbutton_sounds_disabled_away,
                "treeview_sounds", &preferences->treeview_sounds,
                "treeview_spell_checker", &preferences->treeview_spell_checker,
+               "checkbutton_location_publish", &preferences->checkbutton_location_publish,
+               "checkbutton_location_reduce_accuracy", &preferences->checkbutton_location_reduce_accuracy,
+               "checkbutton_location_resource_network", &preferences->checkbutton_location_resource_network,
+               "checkbutton_location_resource_cell", &preferences->checkbutton_location_resource_cell,
+               "checkbutton_location_resource_gps", &preferences->checkbutton_location_resource_gps,
                NULL);
        g_free (filename);
 
@@ -1116,6 +1183,14 @@ empathy_preferences_show (GtkWindow *parent)
                gtk_widget_show (page);
        }
 
+       page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (preferences->notebook), 3);
+#if HAVE_GEOCLUE
+       gtk_widget_show (page);
+#else
+       gtk_widget_hide (page);
+#endif
+
+
        if (parent) {
                gtk_window_set_transient_for (GTK_WINDOW (preferences->dialog),
                                              GTK_WINDOW (parent));