aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-14 18:25:34 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-14 18:25:34 +0800
commit3dc5ac02b4acf762c22a2f1980facdd0d01d678e (patch)
tree6b6dac0ff4818cd05f75920320a3d0e507bf2302
parent3e2efde8299cda56382dfc8f3457f302048a89a6 (diff)
downloadgsoc2013-evolution-3dc5ac02b4acf762c22a2f1980facdd0d01d678e.tar.gz
gsoc2013-evolution-3dc5ac02b4acf762c22a2f1980facdd0d01d678e.tar.zst
gsoc2013-evolution-3dc5ac02b4acf762c22a2f1980facdd0d01d678e.zip
Migrate prefer-plain plugin to GSettings
-rw-r--r--data/Makefile.am1
-rw-r--r--data/evolution.convert4
-rw-r--r--data/org.gnome.evolution.eplugin.prefer-plain.gschema.xml.in14
-rw-r--r--plugins/prefer-plain/prefer-plain.c27
4 files changed, 29 insertions, 17 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index fb4c041c23..2a8b72a680 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -23,6 +23,7 @@ gsettings_SCHEMAS = \
org.gnome.evolution.eplugin.external-editor.gschema.xml \
org.gnome.evolution.eplugin.face-picture.gschema.xml \
org.gnome.evolution.eplugin.mail-notification.gschema.xml \
+ org.gnome.evolution.eplugin.prefer-plain.gschema.xml.in \
org.gnome.evolution.eplugin.templates.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
diff --git a/data/evolution.convert b/data/evolution.convert
index 075a24a579..cb4308d0a6 100644
--- a/data/evolution.convert
+++ b/data/evolution.convert
@@ -214,5 +214,9 @@ notify-sound-beep = /apps/evolution/eplugin/mail-notification/sound-beep
notify-sound-file = /apps/evolution/eplugin/mail-notification/sound-file
notify-sound-use-theme = /apps/evolution/eplugin/mail-notification/sound-use-theme
+[org.gnome.evolution.eplugin.prefer-plain]
+mode = /apps/evolution/eplugin/prefer_plain/mode"
+show-suppressed = /apps/evolution/eplugin/prefer_plain/show_suppressed
+
[org.gnome.evolution.eplugin.templates]
template-placeholders = /apps/evolution/mail/template_placeholders
diff --git a/data/org.gnome.evolution.eplugin.prefer-plain.gschema.xml.in b/data/org.gnome.evolution.eplugin.prefer-plain.gschema.xml.in
new file mode 100644
index 0000000000..9d9b652be7
--- /dev/null
+++ b/data/org.gnome.evolution.eplugin.prefer-plain.gschema.xml.in
@@ -0,0 +1,14 @@
+<schemalist>
+ <schema gettext-domain="evolution" id="org.gnome.evolution.eplugin.prefer-plain" path="/orf/gnome/evolution/eplugin/prefer-plain/">
+ <key name="mode" type="s">
+ <default>'normal'</default>
+ <_summary>Mode to use when displaying mails</_summary>
+ <_description>The mode to use for displaying mails. "normal" makes Evolution choose the best part to show, "prefer_plain" makes it use the text part, if present, and "only_plain" forces Evolution to only show plain text</_description>
+ </key>
+ <key name="show-suppressed" type="b">
+ <default>true</default>
+ <_summary>Whether to show suppressed HTML output</_summary>
+ <_description>Whether to show suppressed HTML output</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index 55f62f8e3d..907e562c29 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -26,7 +26,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
#include <string.h>
#include <stdio.h>
@@ -44,7 +43,7 @@ enum {
EPP_TEXT
};
-static GConfClient *epp_gconf = NULL;
+static GSettings *epp_settings = NULL;
static gint epp_mode = -1;
static gboolean epp_show_suppressed = TRUE;
@@ -281,7 +280,7 @@ epp_mode_changed (GtkComboBox *dropdown,
if (epp_mode > 2)
epp_mode = 0;
- gconf_client_set_string(epp_gconf, "/apps/evolution/eplugin/prefer_plain/mode", epp_options[epp_mode].key, NULL);
+ g_settings_set_string (epp_settings, "mode", epp_options[epp_mode].key);
update_info_label (info_label, epp_mode);
}
@@ -292,7 +291,7 @@ epp_show_suppressed_toggled (GtkToggleButton *check,
g_return_if_fail (check != NULL);
epp_show_suppressed = gtk_toggle_button_get_active (check);
- gconf_client_set_bool (epp_gconf, "/apps/evolution/eplugin/prefer_plain/show_suppressed", epp_show_suppressed, NULL);
+ g_settings_set_boolean (epp_settings, "show-suppressed", epp_show_suppressed);
}
GtkWidget *
@@ -363,14 +362,13 @@ e_plugin_lib_enable (EPlugin *ep,
gchar *key;
gint i;
- if (epp_gconf || epp_mode != -1)
+ if (epp_settings || epp_mode != -1)
return 0;
if (enable) {
- GConfValue *val;
- epp_gconf = gconf_client_get_default ();
- key = gconf_client_get_string(epp_gconf, "/apps/evolution/eplugin/prefer_plain/mode", NULL);
+ epp_settings = g_settings_new ("org.gnome.evolution.eplugin.prefer-plain");
+ key = g_settings_get_string (epp_settings, "mode");
if (key) {
for (i = 0; i < G_N_ELEMENTS (epp_options); i++) {
if (!strcmp (epp_options[i].key, key)) {
@@ -383,16 +381,11 @@ e_plugin_lib_enable (EPlugin *ep,
epp_mode = 0;
}
- val = gconf_client_get (epp_gconf, "/apps/evolution/eplugin/prefer_plain/show_suppressed", NULL);
- if (val) {
- epp_show_suppressed = gconf_value_get_bool (val);
- gconf_value_free (val);
- } else
- epp_show_suppressed = TRUE;
+ epp_show_suppressed = g_settings_get_boolean (epp_settings, "show-suppressed");
} else {
- if (epp_gconf) {
- g_object_unref (epp_gconf);
- epp_gconf = NULL;
+ if (epp_settings) {
+ g_object_unref (epp_settings);
+ epp_settings = NULL;
}
}