aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/empathy.schemas.in14
-rw-r--r--libempathy-gtk/empathy-conf.h1
-rw-r--r--libempathy-gtk/empathy-theme-adium.c6
-rw-r--r--libempathy-gtk/empathy-theme-adium.h1
-rw-r--r--src/Makefile.am4
-rw-r--r--src/empathy-preferences.c328
-rw-r--r--src/empathy-preferences.ui43
7 files changed, 261 insertions, 136 deletions
diff --git a/data/empathy.schemas.in b/data/empathy.schemas.in
index 572eb8871..81ea5e864 100644
--- a/data/empathy.schemas.in
+++ b/data/empathy.schemas.in
@@ -304,6 +304,20 @@
</schema>
<schema>
+ <key>/schemas/apps/empathy/conversation/adium_path</key>
+ <applyto>/apps/empathy/conversation/adium_path</applyto>
+ <owner>empathy</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>Path of the adium theme to use</short>
+ <long>
+ Path of the adium theme to use if the theme used for chat is adium.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/empathy/conversation/theme_chat_room</key>
<applyto>/apps/empathy/conversation/theme_chat_room</applyto>
<owner>empathy</owner>
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
index 07026df5c..47949139e 100644
--- a/libempathy-gtk/empathy-conf.h
+++ b/libempathy-gtk/empathy-conf.h
@@ -60,6 +60,7 @@ struct _EmpathyConfClass {
#define EMPATHY_PREFS_POPUPS_WHEN_AVAILABLE EMPATHY_PREFS_PATH "/notifications/popups_when_available"
#define EMPATHY_PREFS_CHAT_SHOW_SMILEYS EMPATHY_PREFS_PATH "/conversation/graphical_smileys"
#define EMPATHY_PREFS_CHAT_THEME EMPATHY_PREFS_PATH "/conversation/theme"
+#define EMPATHY_PREFS_CHAT_ADIUM_PATH EMPATHY_PREFS_PATH "/conversation/adium_path"
#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_LANGUAGES EMPATHY_PREFS_PATH "/conversation/spell_checker_languages"
#define EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED EMPATHY_PREFS_PATH "/conversation/spell_checker_enabled"
#define EMPATHY_PREFS_CHAT_NICK_COMPLETION_CHAR EMPATHY_PREFS_PATH "/conversation/nick_completion_char"
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 876744018..a878715b6 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -580,3 +580,9 @@ empathy_theme_adium_new (void)
return g_object_new (EMPATHY_TYPE_THEME_ADIUM, NULL);
}
+gboolean
+empathy_theme_adium_is_valid (const gchar *path)
+{
+ return TRUE;
+}
+
diff --git a/libempathy-gtk/empathy-theme-adium.h b/libempathy-gtk/empathy-theme-adium.h
index c31105a1b..24fe986f6 100644
--- a/libempathy-gtk/empathy-theme-adium.h
+++ b/libempathy-gtk/empathy-theme-adium.h
@@ -49,6 +49,7 @@ struct _EmpathyThemeAdiumClass {
GType empathy_theme_adium_get_type (void) G_GNUC_CONST;
EmpathyThemeAdium *empathy_theme_adium_new (void);
+gboolean empathy_theme_adium_is_valid (const gchar *path);
G_END_DECLS
diff --git a/src/Makefile.am b/src/Makefile.am
index 60f9ada34..dbcd6d43d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
$(LIBNOTIFY_CFLAGS) \
$(LIBCHAMPLAIN_CFLAGS) \
$(DISABLE_DEPRECATED) \
+ $(WEBKIT_CFLAGS) \
$(WARN_CFLAGS)
LDADD = \
@@ -15,7 +16,8 @@ LDADD = \
$(top_builddir)/extensions/libemp-extensions.la \
$(LIBNOTIFY_LIBS) \
$(EMPATHY_LIBS) \
- $(LIBCHAMPLAIN_LIBS)
+ $(LIBCHAMPLAIN_LIBS) \
+ $(WEBKIT_LIBS)
bin_PROGRAMS = \
empathy \
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index 406db4c9f..211ad5c07 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -34,6 +34,7 @@
#include <libempathy-gtk/empathy-conf.h>
#include <libempathy-gtk/empathy-ui-utils.h>
#include <libempathy-gtk/empathy-theme-manager.h>
+#include <libempathy-gtk/empathy-theme-adium.h>
#include <libempathy-gtk/empathy-spell.h>
#include <libempathy-gtk/empathy-contact-list-store.h>
#include <libempathy-gtk/empathy-gtk-enum-types.h>
@@ -49,6 +50,9 @@ typedef struct {
GtkWidget *checkbutton_compact_contact_list;
GtkWidget *checkbutton_show_smileys;
GtkWidget *combobox_chat_theme;
+ GtkWidget *hbox_adium_theme;
+ GtkWidget *filechooserbutton_adium_theme;
+ GtkWidget *label_invalid_adium_theme;
GtkWidget *checkbutton_separate_chat_windows;
GtkWidget *checkbutton_autoconnect;
GtkWidget *radiobutton_contact_list_sort_by_name;
@@ -89,19 +93,13 @@ 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);
@@ -114,9 +112,6 @@ static void preferences_hookup_toggle_button (EmpathyPreferences
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);
@@ -124,8 +119,6 @@ static void preferences_toggle_button_toggled_cb (GtkWidget
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,
@@ -241,10 +234,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences)
EMPATHY_PREFS_CHAT_SHOW_SMILEYS,
preferences->checkbutton_show_smileys);
- preferences_hookup_string_combo (preferences,
- EMPATHY_PREFS_CHAT_THEME,
- preferences->combobox_chat_theme);
-
preferences_hookup_radio_button (preferences,
EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM,
preferences->radiobutton_contact_list_sort_by_name);
@@ -639,43 +628,6 @@ preferences_languages_cell_toggled_cb (GtkCellRendererToggle *cell,
}
static void
-preferences_themes_setup (EmpathyPreferences *preferences)
-{
- GtkComboBox *combo;
- GtkCellLayout *cell_layout;
- GtkCellRenderer *renderer;
- GtkListStore *store;
- const gchar **themes;
- gint i;
-
- 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_STRING, /* Display name */
- G_TYPE_STRING); /* Theme name */
-
- /* 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_VISIBLE_NAME, _(themes[i + 1]),
- COL_COMBO_NAME, themes[i],
- -1);
- }
-
- /* 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);
-}
-
-static void
preferences_widget_sync_bool (const gchar *key, GtkWidget *widget)
{
gboolean value;
@@ -721,48 +673,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)) {
-
- do {
- gchar *name;
- 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);
- }
-
- g_free (name);
- } while (!found && 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,
gpointer user_data)
@@ -770,13 +680,6 @@ 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);
-}
static void
preferences_notify_bool_cb (EmpathyConf *conf,
@@ -955,32 +858,6 @@ preferences_hookup_radio_button (EmpathyPreferences *preferences,
}
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);
- }
-}
-
-static void
preferences_hookup_sensitivity (EmpathyPreferences *preferences,
const gchar *key,
GtkWidget *widget)
@@ -1054,29 +931,207 @@ preferences_radio_button_toggled_cb (GtkWidget *button,
empathy_conf_set_string (empathy_conf_get (), key, value);
}
+
static void
-preferences_string_combo_changed_cb (GtkWidget *combo,
- gpointer user_data)
+preferences_theme_adium_update_visibility (EmpathyPreferences *preferences,
+ const gchar *name)
+{
+ if (name && strcmp (name, "adium") == 0) {
+ gtk_widget_show (preferences->hbox_adium_theme);
+ } else {
+ gtk_widget_hide (preferences->hbox_adium_theme);
+ gtk_widget_hide (preferences->label_invalid_adium_theme);
+ }
+}
+
+static void
+preferences_theme_adium_update_validity (EmpathyPreferences *preferences,
+ const gchar *path)
+{
+ if (empathy_theme_adium_is_valid (path)) {
+ gtk_widget_hide (preferences->label_invalid_adium_theme);
+ } else {
+ gtk_widget_show (preferences->label_invalid_adium_theme);
+ }
+}
+
+static void
+preferences_theme_adium_path_notify_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyPreferences *preferences = user_data;
+ GtkFileChooser *chooser;
+ gchar *value;
+
+ if (!empathy_conf_get_string (conf, key, &value)) {
+ return;
+ }
+
+ chooser = GTK_FILE_CHOOSER (preferences->filechooserbutton_adium_theme);
+ gtk_file_chooser_set_current_folder (chooser, value);
+ preferences_theme_adium_update_validity (preferences, value);
+ g_free (value);
+}
+
+static void
+preferences_theme_adium_file_set_cb (GtkFileChooser *chooser,
+ EmpathyPreferences *preferences)
+{
+ gchar *path;
+
+ path = gtk_file_chooser_get_current_folder (chooser);
+ empathy_conf_set_string (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ path);
+ preferences_theme_adium_update_validity (preferences, path);
+
+ g_free (path);
+}
+
+static void
+preferences_theme_notify_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyPreferences *preferences = user_data;
+ GtkComboBox *combo;
+ gchar *value;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean found = FALSE;
+
+ if (!empathy_conf_get_string (conf, key, &value)) {
+ return;
+ }
+
+ preferences_theme_adium_update_visibility (preferences, value);
+
+ combo = GTK_COMBO_BOX (preferences->combobox_chat_theme);
+ model = gtk_combo_box_get_model (combo);
+ 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 (combo, &iter);
+ break;
+ }
+
+ 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 (combo, &iter);
+ }
+ }
+
+ g_free (value);
+}
+
+static void
+preferences_theme_changed_cb (GtkComboBox *combo,
+ EmpathyPreferences *preferences)
{
- const gchar *key;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *name;
- 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_NAME, &name,
-1);
- empathy_conf_set_string (empathy_conf_get (), key, name);
+
+ preferences_theme_adium_update_visibility (preferences, name);
+
+ empathy_conf_set_string (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_THEME,
+ name);
g_free (name);
}
}
static void
+preferences_themes_setup (EmpathyPreferences *preferences)
+{
+ GtkComboBox *combo;
+ GtkCellLayout *cell_layout;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ const gchar **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_STRING, /* Display name */
+ G_TYPE_STRING); /* Theme name */
+
+ /* 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_VISIBLE_NAME, _(themes[i + 1]),
+ COL_COMBO_NAME, themes[i],
+ -1);
+ }
+
+ /* 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);
+ }
+
+ g_signal_connect (preferences->filechooserbutton_adium_theme,
+ "file-set",
+ G_CALLBACK (preferences_theme_adium_file_set_cb),
+ preferences);
+ /* Select the adium path from the gconf key and track changes */
+ preferences_theme_adium_path_notify_cb (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ preferences);
+ id = empathy_conf_notify_add (empathy_conf_get (),
+ EMPATHY_PREFS_CHAT_ADIUM_PATH,
+ preferences_theme_adium_path_notify_cb,
+ preferences);
+ if (id) {
+ preferences_add_id (preferences, id);
+ }
+}
+
+static void
preferences_response_cb (GtkWidget *widget,
gint response,
EmpathyPreferences *preferences)
@@ -1124,6 +1179,9 @@ empathy_preferences_show (GtkWindow *parent)
"checkbutton_compact_contact_list", &preferences->checkbutton_compact_contact_list,
"checkbutton_show_smileys", &preferences->checkbutton_show_smileys,
"combobox_chat_theme", &preferences->combobox_chat_theme,
+ "hbox_adium_theme", &preferences->hbox_adium_theme,
+ "filechooserbutton_adium_theme", &preferences->filechooserbutton_adium_theme,
+ "label_invalid_adium_theme", &preferences->label_invalid_adium_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,
diff --git a/src/empathy-preferences.ui b/src/empathy-preferences.ui
index d92fc8f88..eaec717ea 100644
--- a/src/empathy-preferences.ui
+++ b/src/empathy-preferences.ui
@@ -792,6 +792,49 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox_adium_theme">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Adium theme to use:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="filechooserbutton_adium_theme">
+ <property name="visible">True</property>
+ <property name="preview_widget_active">False</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+ <property name="title" translatable="yes">Sélectionner un dossier</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_invalid_adium_theme">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span foreground="red"&gt;Not a valid adium theme&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
</object>