summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-10-23 19:03:44 +0200
committerStefano Karapetsas <[email protected]>2012-10-23 19:03:44 +0200
commitb3e27b1d6a0f11c5835f5829bac3861e2147b17e (patch)
treea74502d15d303f26fb2bc87f9ab4fb741a1a727a /capplets
parent46787e474859801435542191480e2851f7fd870c (diff)
downloadmate-control-center-b3e27b1d6a0f11c5835f5829bac3861e2147b17e.tar.bz2
mate-control-center-b3e27b1d6a0f11c5835f5829bac3861e2147b17e.tar.xz
migrate appearance applet to gsettings
Diffstat (limited to 'capplets')
-rw-r--r--capplets/appearance/appearance-desktop.c159
-rw-r--r--capplets/appearance/appearance-font.c402
-rw-r--r--capplets/appearance/appearance-main.c20
-rw-r--r--capplets/appearance/appearance-style.c200
-rw-r--r--capplets/appearance/appearance-themes.c180
-rw-r--r--capplets/appearance/appearance.h64
-rw-r--r--capplets/appearance/data/appearance.ui2
-rw-r--r--capplets/appearance/mate-wp-item.c105
-rw-r--r--capplets/appearance/mate-wp-item.h7
-rw-r--r--capplets/appearance/mate-wp-xml.c13
-rw-r--r--capplets/appearance/theme-installer.c30
-rw-r--r--capplets/appearance/theme-save.c9
-rw-r--r--capplets/appearance/theme-util.h20
13 files changed, 549 insertions, 662 deletions
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c
index f0dc803e..09826e1e 100644
--- a/capplets/appearance/appearance-desktop.c
+++ b/capplets/appearance/appearance-desktop.c
@@ -27,7 +27,6 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <string.h>
-#include <mateconf/mateconf-client.h>
#include <libmateui/mate-desktop-thumbnail.h>
#include <libmateui/mate-bg.h>
@@ -267,23 +266,23 @@ wp_set_sensitivities (AppearanceData *data)
if (item != NULL)
filename = item->filename;
- if (!mateconf_client_key_is_writable (data->client, WP_OPTIONS_KEY, NULL)
+ if (!g_settings_is_writable (data->wp_settings, WP_OPTIONS_KEY)
|| (filename && !strcmp (filename, "(none)")))
gtk_widget_set_sensitive (data->wp_style_menu, FALSE);
else
gtk_widget_set_sensitive (data->wp_style_menu, TRUE);
- if (!mateconf_client_key_is_writable (data->client, WP_SHADING_KEY, NULL))
+ if (!g_settings_is_writable (data->wp_settings, WP_SHADING_KEY))
gtk_widget_set_sensitive (data->wp_color_menu, FALSE);
else
gtk_widget_set_sensitive (data->wp_color_menu, TRUE);
- if (!mateconf_client_key_is_writable (data->client, WP_PCOLOR_KEY, NULL))
+ if (!g_settings_is_writable (data->wp_settings, WP_PCOLOR_KEY))
gtk_widget_set_sensitive (data->wp_pcpicker, FALSE);
else
gtk_widget_set_sensitive (data->wp_pcpicker, TRUE);
- if (!mateconf_client_key_is_writable (data->client, WP_SCOLOR_KEY, NULL))
+ if (!g_settings_is_writable (data->wp_settings, WP_SCOLOR_KEY))
gtk_widget_set_sensitive (data->wp_scpicker, FALSE);
else
gtk_widget_set_sensitive (data->wp_scpicker, TRUE);
@@ -316,9 +315,8 @@ wp_scale_type_changed (GtkComboBox *combobox,
if (pixbuf != NULL)
g_object_unref (pixbuf);
- if (mateconf_client_key_is_writable (data->client, WP_OPTIONS_KEY, NULL))
- mateconf_client_set_string (data->client, WP_OPTIONS_KEY,
- wp_item_option_to_string (item->options), NULL);
+ if (g_settings_is_writable (data->wp_settings, WP_OPTIONS_KEY))
+ g_settings_set_enum (data->wp_settings, WP_OPTIONS_KEY, item->options);
}
static void
@@ -343,9 +341,8 @@ wp_shade_type_changed (GtkWidget *combobox,
if (pixbuf != NULL)
g_object_unref (pixbuf);
- if (mateconf_client_key_is_writable (data->client, WP_SHADING_KEY, NULL))
- mateconf_client_set_string (data->client, WP_SHADING_KEY,
- wp_item_shading_to_string (item->shade_type), NULL);
+ if (g_settings_is_writable (data->wp_settings, WP_SHADING_KEY))
+ g_settings_set_enum (data->wp_settings, WP_SHADING_KEY, item->shade_type);
}
static void
@@ -368,8 +365,8 @@ wp_color_changed (AppearanceData *data,
pcolor = gdk_color_to_string (item->pcolor);
scolor = gdk_color_to_string (item->scolor);
- mateconf_client_set_string (data->client, WP_PCOLOR_KEY, pcolor, NULL);
- mateconf_client_set_string (data->client, WP_SCOLOR_KEY, scolor, NULL);
+ g_settings_set_string (data->wp_settings, WP_PCOLOR_KEY, pcolor);
+ g_settings_set_string (data->wp_settings, WP_SCOLOR_KEY, scolor);
g_free (pcolor);
g_free (scolor);
}
@@ -429,14 +426,14 @@ wp_uri_changed (const gchar *uri,
}
static void
-wp_file_changed (MateConfClient *client, guint id,
- MateConfEntry *entry,
+wp_file_changed (GSettings *settings,
+ gchar *key,
AppearanceData *data)
{
- const gchar *uri;
+ gchar *uri;
gchar *wpfile;
- uri = mateconf_value_get_string (entry->value);
+ uri = g_settings_get_string (settings, key);
if (g_utf8_validate (uri, -1, NULL) && g_file_test (uri, G_FILE_TEST_EXISTS))
wpfile = g_strdup (uri);
@@ -446,26 +443,29 @@ wp_file_changed (MateConfClient *client, guint id,
wp_uri_changed (wpfile, data);
g_free (wpfile);
+ g_free (uri);
}
static void
-wp_options_changed (MateConfClient *client, guint id,
- MateConfEntry *entry,
+wp_options_changed (GSettings *settings,
+ gchar *key,
AppearanceData *data)
{
MateWPItem *item;
- const gchar *option;
+ gchar *option;
- option = mateconf_value_get_string (entry->value);
+ option = g_settings_get_string (settings, key);
/* "none" means we don't use a background image */
if (option == NULL || !strcmp (option, "none"))
{
/* temporarily disconnect so we don't override settings when
* updating the selection */
- data->wp_update_mateconf = FALSE;
+ data->wp_update_settings = FALSE;
wp_uri_changed ("(none)", data);
- data->wp_update_mateconf = TRUE;
+ data->wp_update_settings = TRUE;
+ if (option)
+ g_free (option);
return;
}
@@ -473,14 +473,15 @@ wp_options_changed (MateConfClient *client, guint id,
if (item != NULL)
{
- item->options = wp_item_string_to_option (option);
+ item->options = g_settings_get_enum (settings, key);
wp_option_menu_set (data, item->options, FALSE);
}
+ g_free (option);
}
static void
-wp_shading_changed (MateConfClient *client, guint id,
- MateConfEntry *entry,
+wp_shading_changed (GSettings *settings,
+ gchar *key,
AppearanceData *data)
{
MateWPItem *item;
@@ -491,59 +492,62 @@ wp_shading_changed (MateConfClient *client, guint id,
if (item != NULL)
{
- item->shade_type = wp_item_string_to_shading (mateconf_value_get_string (entry->value));
+ item->shade_type = g_settings_get_enum (settings, key);
wp_option_menu_set (data, item->shade_type, TRUE);
}
}
static void
-wp_color1_changed (MateConfClient *client, guint id,
- MateConfEntry *entry,
+wp_color1_changed (GSettings *settings,
+ gchar *key,
AppearanceData *data)
{
GdkColor color;
- const gchar *colorhex;
+ gchar *colorhex;
- colorhex = mateconf_value_get_string (entry->value);
+ colorhex = g_settings_get_string (settings, key);
gdk_color_parse (colorhex, &color);
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_pcpicker), &color);
wp_color_changed (data, FALSE);
+
+ g_free (colorhex);
}
static void
-wp_color2_changed (MateConfClient *client, guint id,
- MateConfEntry *entry,
+wp_color2_changed (GSettings *settings,
+ gchar *key,
AppearanceData *data)
{
GdkColor color;
- const gchar *colorhex;
+ gchar *colorhex;
wp_set_sensitivities (data);
- colorhex = mateconf_value_get_string (entry->value);
+ colorhex = g_settings_get_string (settings, key);
gdk_color_parse (colorhex, &color);
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker), &color);
wp_color_changed (data, FALSE);
+
+ g_free (colorhex);
}
static gboolean
wp_props_wp_set (AppearanceData *data, MateWPItem *item)
{
- MateConfChangeSet *cs;
gchar *pcolor, *scolor;
- cs = mateconf_change_set_new ();
+ g_settings_delay (data->wp_settings);
if (!strcmp (item->filename, "(none)"))
{
- mateconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
- mateconf_change_set_set_string (cs, WP_FILE_KEY, "");
+ g_settings_set_string (data->wp_settings, WP_OPTIONS_KEY, "none");
+ g_settings_set_string (data->wp_settings, WP_FILE_KEY, "");
}
else
{
@@ -557,27 +561,23 @@ wp_props_wp_set (AppearanceData *data, MateWPItem *item)
if (uri == NULL) {
g_warning ("Failed to convert filename to UTF-8: %s", item->filename);
} else {
- mateconf_change_set_set_string (cs, WP_FILE_KEY, uri);
+ g_settings_set_string (data->wp_settings, WP_FILE_KEY, uri);
g_free (uri);
}
- mateconf_change_set_set_string (cs, WP_OPTIONS_KEY,
- wp_item_option_to_string (item->options));
+ g_settings_set_enum (data->wp_settings, WP_OPTIONS_KEY, item->options);
}
- mateconf_change_set_set_string (cs, WP_SHADING_KEY,
- wp_item_shading_to_string (item->shade_type));
+ g_settings_set_enum (data->wp_settings, WP_SHADING_KEY, item->shade_type);
pcolor = gdk_color_to_string (item->pcolor);
scolor = gdk_color_to_string (item->scolor);
- mateconf_change_set_set_string (cs, WP_PCOLOR_KEY, pcolor);
- mateconf_change_set_set_string (cs, WP_SCOLOR_KEY, scolor);
+ g_settings_set_string (data->wp_settings, WP_PCOLOR_KEY, pcolor);
+ g_settings_set_string (data->wp_settings, WP_SCOLOR_KEY, scolor);
g_free (pcolor);
g_free (scolor);
- mateconf_client_commit_change_set (data->client, cs, TRUE, NULL);
-
- mateconf_change_set_unref (cs);
+ g_settings_apply (data->wp_settings);
return FALSE;
}
@@ -604,7 +604,7 @@ wp_props_wp_selected (GtkTreeSelection *selection,
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker),
item->scolor);
- if (data->wp_update_mateconf)
+ if (data->wp_update_settings)
wp_props_wp_set (data, item);
}
else
@@ -941,15 +941,13 @@ wp_load_stuffs (void *user_data)
g_hash_table_foreach (data->wp_hash, (GHFunc) wp_props_load_wallpaper,
data);
- style = mateconf_client_get_string (data->client,
- WP_OPTIONS_KEY,
- NULL);
+ style = g_settings_get_string (data->wp_settings,
+ WP_OPTIONS_KEY);
if (style == NULL)
style = g_strdup ("none");
- uri = mateconf_client_get_string (data->client,
- WP_FILE_KEY,
- NULL);
+ uri = g_settings_get_string (data->wp_settings,
+ WP_FILE_KEY);
if (uri && *uri == '\0')
{
@@ -971,7 +969,7 @@ wp_load_stuffs (void *user_data)
if (item != NULL)
{
- /* update with the current mateconf settings */
+ /* update with the current gsettings */
mate_wp_item_update (item);
if (strcmp (style, "none") != 0)
@@ -1221,7 +1219,7 @@ desktop_init (AppearanceData *data,
GtkCellRenderer *cr;
char *url;
- data->wp_update_mateconf = TRUE;
+ data->wp_update_settings = TRUE;
data->wp_uris = NULL;
if (uris != NULL) {
@@ -1232,7 +1230,7 @@ desktop_init (AppearanceData *data,
}
w = appearance_capplet_get_widget (data, "more_backgrounds_linkbutton");
- url = mateconf_client_get_string (data->client, MORE_BACKGROUNDS_URL_KEY, NULL);
+ url = g_settings_get_string (data->settings, MORE_BACKGROUNDS_URL_KEY);
if (url != NULL && url[0] != '\0') {
gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
gtk_widget_show (w);
@@ -1243,29 +1241,26 @@ desktop_init (AppearanceData *data,
data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);
- mateconf_client_add_dir (data->client, WP_PATH_KEY,
- MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- mateconf_client_notify_add (data->client,
- WP_FILE_KEY,
- (MateConfClientNotifyFunc) wp_file_changed,
- data, NULL, NULL);
- mateconf_client_notify_add (data->client,
- WP_OPTIONS_KEY,
- (MateConfClientNotifyFunc) wp_options_changed,
- data, NULL, NULL);
- mateconf_client_notify_add (data->client,
- WP_SHADING_KEY,
- (MateConfClientNotifyFunc) wp_shading_changed,
- data, NULL, NULL);
- mateconf_client_notify_add (data->client,
- WP_PCOLOR_KEY,
- (MateConfClientNotifyFunc) wp_color1_changed,
- data, NULL, NULL);
- mateconf_client_notify_add (data->client,
- WP_SCOLOR_KEY,
- (MateConfClientNotifyFunc) wp_color2_changed,
- data, NULL, NULL);
+ g_signal_connect (data->wp_settings,
+ "changed::" WP_FILE_KEY,
+ G_CALLBACK (wp_file_changed),
+ data);
+ g_signal_connect (data->wp_settings,
+ "changed::" WP_OPTIONS_KEY,
+ G_CALLBACK (wp_options_changed),
+ data);
+ g_signal_connect (data->wp_settings,
+ "changed::" WP_SHADING_KEY,
+ G_CALLBACK (wp_shading_changed),
+ data);
+ g_signal_connect (data->wp_settings,
+ "changed::" WP_PCOLOR_KEY,
+ G_CALLBACK (wp_color1_changed),
+ data);
+ g_signal_connect (data->wp_settings,
+ "changed::" WP_SCOLOR_KEY,
+ G_CALLBACK (wp_color2_changed),
+ data);
data->wp_model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF,
G_TYPE_POINTER));
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index d9f4d3c2..91546501 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -31,26 +31,11 @@
#endif /* HAVE_XFT2 */
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include "capplet-util.h"
-#include "mateconf-property-editor.h"
-
-#define GTK_FONT_KEY "/desktop/mate/interface/font_name"
-#define DESKTOP_FONT_KEY "/apps/caja/preferences/desktop_font"
-
-#define MARCO_DIR "/apps/marco/general"
-#define WINDOW_TITLE_FONT_KEY MARCO_DIR "/titlebar_font"
-#define WINDOW_TITLE_USES_SYSTEM_KEY MARCO_DIR "/titlebar_uses_system_font"
-#define MONOSPACE_FONT_KEY "/desktop/mate/interface/monospace_font_name"
-#define DOCUMENT_FONT_KEY "/desktop/mate/interface/document_font_name"
#ifdef HAVE_XFT2
-#define FONT_RENDER_DIR "/desktop/mate/font_rendering"
-#define FONT_ANTIALIASING_KEY FONT_RENDER_DIR "/antialiasing"
-#define FONT_HINTING_KEY FONT_RENDER_DIR "/hinting"
-#define FONT_RGBA_ORDER_KEY FONT_RENDER_DIR "/rgba_order"
-#define FONT_DPI_KEY FONT_RENDER_DIR "/dpi"
-
/* X servers sometimes lie about the screen's physical dimensions, so we cannot
* compute an accurate DPI value. When this happens, the user gets fonts that
* are too huge or too tiny. So, we see what the server returns: if it reports
@@ -58,7 +43,7 @@
* DPI_HIGH_REASONABLE_VALUE], then we assume that it is lying and we use
* DPI_FALLBACK instead.
*
- * See get_dpi_from_mateconf_or_server() below, and also
+ * See get_dpi_from_mate_conf_or_server() below, and also
* https://bugzilla.novell.com/show_bug.cgi?id=217790
*/
#define DPI_FALLBACK 96
@@ -67,7 +52,6 @@
#endif /* HAVE_XFT2 */
static gboolean in_change = FALSE;
-static gchar* old_font = NULL;
#define MAX_FONT_POINT_WITHOUT_WARNING 32
#define MAX_FONT_SIZE_WITHOUT_WARNING MAX_FONT_POINT_WITHOUT_WARNING * 1024
@@ -112,13 +96,6 @@ typedef enum {
ANTIALIAS_RGBA
} Antialiasing;
-static MateConfEnumStringPair antialias_enums[] = {
- {ANTIALIAS_NONE, "none"},
- {ANTIALIAS_GRAYSCALE, "grayscale"},
- {ANTIALIAS_RGBA, "rgba"},
- {-1, NULL}
-};
-
typedef enum {
HINT_NONE,
HINT_SLIGHT,
@@ -126,14 +103,6 @@ typedef enum {
HINT_FULL
} Hinting;
-static MateConfEnumStringPair hint_enums[] = {
- {HINT_NONE, "none"},
- {HINT_SLIGHT, "slight"},
- {HINT_MEDIUM, "medium"},
- {HINT_FULL, "full"},
- {-1, NULL}
-};
-
typedef enum {
RGBA_RGB,
RGBA_BGR,
@@ -141,14 +110,6 @@ typedef enum {
RGBA_VBGR
} RgbaOrder;
-static MateConfEnumStringPair rgba_order_enums[] = {
- {RGBA_RGB, "rgb" },
- {RGBA_BGR, "bgr" },
- {RGBA_VRGB, "vrgb" },
- {RGBA_VBGR, "vbgr" },
- {-1, NULL }
-};
-
static XftFont* open_pattern(FcPattern* pattern, Antialiasing antialiasing, Hinting hinting)
{
#ifdef FC_HINT_STYLE
@@ -319,32 +280,9 @@ static void setup_font_sample(GtkWidget* darea, Antialiasing antialiasing, Hinti
/*
* Code implementing a group of radio buttons with different Xft option combinations.
- * If one of the buttons is matched by the MateConf key, we pick it. Otherwise we
+ * If one of the buttons is matched by the GSettings key, we pick it. Otherwise we
* show the group as inconsistent.
*/
-static void
-font_render_get_mateconf (MateConfClient *client,
- Antialiasing *antialiasing,
- Hinting *hinting)
-{
- gchar *antialias_str = mateconf_client_get_string (client, FONT_ANTIALIASING_KEY, NULL);
- gchar *hint_str = mateconf_client_get_string (client, FONT_HINTING_KEY, NULL);
- gint val;
-
- val = ANTIALIAS_GRAYSCALE;
- if (antialias_str) {
- mateconf_string_to_enum (antialias_enums, antialias_str, &val);
- g_free (antialias_str);
- }
- *antialiasing = val;
-
- val = HINT_FULL;
- if (hint_str) {
- mateconf_string_to_enum (hint_enums, hint_str, &val);
- g_free (hint_str);
- }
- *hinting = val;
-}
typedef struct {
Antialiasing antialiasing;
@@ -355,14 +293,15 @@ typedef struct {
static GSList *font_pairs = NULL;
static void
-font_render_load (MateConfClient *client)
+font_render_load (GSettings *settings)
{
Antialiasing antialiasing;
Hinting hinting;
gboolean inconsistent = TRUE;
GSList *tmp_list;
- font_render_get_mateconf (client, &antialiasing, &hinting);
+ antialiasing = g_settings_get_enum (settings, FONT_ANTIALIASING_KEY);
+ hinting = g_settings_get_enum (settings, FONT_HINTING_KEY);
in_change = TRUE;
@@ -386,12 +325,11 @@ font_render_load (MateConfClient *client)
}
static void
-font_render_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+font_render_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
- font_render_load (client);
+ font_render_load (settings);
}
static void
@@ -399,18 +337,14 @@ font_radio_toggled (GtkToggleButton *toggle_button,
FontPair *pair)
{
if (!in_change) {
- MateConfClient *client = mateconf_client_get_default ();
+ GSettings *settings = g_settings_new (FONT_RENDER_SCHEMA);
- mateconf_client_set_string (client, FONT_ANTIALIASING_KEY,
- mateconf_enum_to_string (antialias_enums, pair->antialiasing),
- NULL);
- mateconf_client_set_string (client, FONT_HINTING_KEY,
- mateconf_enum_to_string (hint_enums, pair->hinting),
- NULL);
+ g_settings_set_enum (settings, FONT_ANTIALIASING_KEY, pair->antialiasing);
+ g_settings_set_enum (settings, FONT_HINTING_KEY, pair->hinting);
/* Restore back to the previous state until we get notification */
- font_render_load (client);
- g_object_unref (client);
+ font_render_load (settings);
+ g_object_unref (settings);
}
}
@@ -438,161 +372,28 @@ static void
marco_titlebar_load_sensitivity (AppearanceData *data)
{
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "window_title_font"),
- !mateconf_client_get_bool (data->client,
- WINDOW_TITLE_USES_SYSTEM_KEY,
- NULL));
+ !g_settings_get_boolean (data->marco_settings,
+ WINDOW_TITLE_USES_SYSTEM_KEY));
}
static void
-marco_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+marco_changed (GSettings *settings,
+ gchar *entry,
+ gpointer user_data)
{
marco_titlebar_load_sensitivity (user_data);
}
-/* returns 0 if the font is safe, otherwise returns the size in points. */
-static gint
-font_dangerous (const char *font)
-{
- PangoFontDescription *pfd;
- gboolean retval = 0;
-
- pfd = pango_font_description_from_string (font);
- if (pfd == NULL)
- /* an invalid font was passed in. This isn't our problem. */
- return 0;
-
- if ((pango_font_description_get_set_fields (pfd) & PANGO_FONT_MASK_SIZE) &&
- (pango_font_description_get_size (pfd) >= MAX_FONT_SIZE_WITHOUT_WARNING)) {
- retval = pango_font_description_get_size (pfd)/1024;
- }
- pango_font_description_free (pfd);
-
- return retval;
-}
-
-static MateConfValue *
-application_font_to_mateconf (MateConfPropertyEditor *peditor,
- MateConfValue *value)
-{
- MateConfValue *new_value;
- const char *new_font;
- GtkWidget *font_button;
- gint danger_level;
-
- font_button = GTK_WIDGET (mateconf_property_editor_get_ui_control (peditor));
- g_return_val_if_fail (font_button != NULL, NULL);
-
- new_value = mateconf_value_new (MATECONF_VALUE_STRING);
- new_font = mateconf_value_get_string (value);
- if (font_dangerous (old_font)) {
- /* If we're already too large, we don't warn again. */
- mateconf_value_set_string (new_value, new_font);
- return new_value;
- }
-
- danger_level = font_dangerous (new_font);
- if (danger_level) {
- GtkWidget *warning_dialog, *apply_button;
- const gchar *warning_label;
- gchar *warning_label2;
-
- warning_label = _("Font may be too large");
-
- if (danger_level > MAX_FONT_POINT_WITHOUT_WARNING) {
- warning_label2 = g_strdup_printf (ngettext (
- "The font selected is %d point large, "
- "and may make it difficult to effectively "
- "use the computer. It is recommended that "
- "you select a size smaller than %d.",
- "The font selected is %d points large, "
- "and may make it difficult to effectively "
- "use the computer. It is recommended that "
- "you select a size smaller than %d.",
- danger_level),
- danger_level,
- MAX_FONT_POINT_WITHOUT_WARNING);
- } else {
- warning_label2 = g_strdup_printf (ngettext (
- "The font selected is %d point large, "
- "and may make it difficult to effectively "
- "use the computer. It is recommended that "
- "you select a smaller sized font.",
- "The font selected is %d points large, "
- "and may make it difficult to effectively "
- "use the computer. It is recommended that "
- "you select a smaller sized font.",
- danger_level),
- danger_level);
- }
-
- warning_dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- "%s",
- warning_label);
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (warning_dialog),
- "%s", warning_label2);
-
- gtk_dialog_add_button (GTK_DIALOG (warning_dialog),
- _("Use previous font"), GTK_RESPONSE_CLOSE);
-
- apply_button = gtk_button_new_with_label (_("Use selected font"));
-
- gtk_button_set_image (GTK_BUTTON (apply_button), gtk_image_new_from_stock (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON));
- gtk_dialog_add_action_widget (GTK_DIALOG (warning_dialog), apply_button, GTK_RESPONSE_APPLY);
- gtk_widget_set_can_default (apply_button, TRUE);
- gtk_widget_show (apply_button);
-
- gtk_dialog_set_default_response (GTK_DIALOG (warning_dialog), GTK_RESPONSE_CLOSE);
-
- g_free (warning_label2);
-
- if (gtk_dialog_run (GTK_DIALOG (warning_dialog)) == GTK_RESPONSE_APPLY) {
- mateconf_value_set_string (new_value, new_font);
- } else {
- mateconf_value_set_string (new_value, old_font);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (font_button), old_font);
- }
-
- gtk_widget_destroy (warning_dialog);
- } else {
- mateconf_value_set_string (new_value, new_font);
- }
-
- return new_value;
-}
-
-static void
-application_font_changed (GtkWidget *font_button)
-{
- const gchar *font;
-
- font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (font_button));
- g_free (old_font);
- old_font = g_strdup (font);
-}
-
#ifdef HAVE_XFT2
/*
- * EnumGroup - a group of radio buttons tied to a string enumeration
- * value. We add this here because the mateconf peditor
- * equivalent of this is both painful to use (you have
- * to supply functions to convert from enums to indices)
- * and conceptually broken (the order of radio buttons
- * in a group when using Glade is not predictable.
+ * EnumGroup - a group of radio buttons for a gsettings enum
*/
typedef struct
{
- MateConfClient *client;
+ GSettings *settings;
GSList *items;
- gchar *mateconf_key;
- MateConfEnumStringPair *enums;
- int default_value;
+ gchar *settings_key;
+ gulong settings_signal_id;
} EnumGroup;
typedef struct
@@ -605,15 +406,9 @@ typedef struct
static void
enum_group_load (EnumGroup *group)
{
- gchar *str = mateconf_client_get_string (group->client, group->mateconf_key, NULL);
- gint val = group->default_value;
+ gint val = g_settings_get_enum (group->settings, group->settings_key);
GSList *tmp_list;
- if (str)
- mateconf_string_to_enum (group->enums, str, &val);
-
- g_free (str);
-
in_change = TRUE;
for (tmp_list = group->items; tmp_list; tmp_list = tmp_list->next) {
@@ -627,10 +422,9 @@ enum_group_load (EnumGroup *group)
}
static void
-enum_group_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+enum_group_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
enum_group_load (user_data);
}
@@ -642,9 +436,7 @@ enum_item_toggled (GtkToggleButton *toggle_button,
EnumGroup *group = item->group;
if (!in_change) {
- mateconf_client_set_string (group->client, group->mateconf_key,
- mateconf_enum_to_string (group->enums, item->value),
- NULL);
+ g_settings_set_enum (group->settings, group->settings_key, item->value);
}
/* Restore back to the previous state until we get notification */
@@ -652,9 +444,8 @@ enum_item_toggled (GtkToggleButton *toggle_button,
}
static EnumGroup *
-enum_group_create (const gchar *mateconf_key,
- MateConfEnumStringPair *enums,
- int default_value,
+enum_group_create (GSettings *settings,
+ const gchar *settings_key,
GtkWidget *first_widget,
...)
{
@@ -664,10 +455,8 @@ enum_group_create (const gchar *mateconf_key,
group = g_new (EnumGroup, 1);
- group->client = mateconf_client_get_default ();
- group->mateconf_key = g_strdup (mateconf_key);
- group->enums = enums;
- group->default_value = default_value;
+ group->settings = settings;
+ group->settings_key = g_strdup (settings_key);
group->items = NULL;
va_start (args, first_widget);
@@ -693,9 +482,10 @@ enum_group_create (const gchar *mateconf_key,
enum_group_load (group);
- mateconf_client_notify_add (group->client, mateconf_key,
- enum_group_changed,
- group, NULL, NULL);
+ gchar *signal_name = g_strdup_printf("changed::%s", settings_key);
+ group->settings_signal_id = g_signal_connect (settings, signal_name,
+ G_CALLBACK (enum_group_changed), group);
+ g_free (signal_name);
return group;
}
@@ -703,8 +493,10 @@ enum_group_create (const gchar *mateconf_key,
static void
enum_group_destroy (EnumGroup *group)
{
- g_object_unref (group->client);
- g_free (group->mateconf_key);
+ group->settings = NULL;
+ g_signal_handler_disconnect (group->settings, group->settings_signal_id);
+ group->settings_signal_id = 0;
+ g_free (group->settings_key);
g_slist_foreach (group->items, (GFunc) g_free, NULL);
g_slist_free (group->items);
@@ -757,18 +549,15 @@ get_dpi_from_x_server (void)
* The font rendering details dialog
*/
static void
-dpi_load (MateConfClient *client,
+dpi_load (GSettings *settings,
GtkSpinButton *spinner)
{
- MateConfValue *value;
+ gdouble value = g_settings_get_double (settings, FONT_DPI_KEY);
gdouble dpi;
- value = mateconf_client_get_without_default (client, FONT_DPI_KEY, NULL);
-
- if (value) {
- dpi = mateconf_value_get_float (value);
- mateconf_value_free (value);
- } else
+ if (value != 0)
+ dpi = value;
+ else
dpi = get_dpi_from_x_server ();
if (dpi < DPI_LOW_REASONABLE_VALUE)
@@ -780,32 +569,31 @@ dpi_load (MateConfClient *client,
}
static void
-dpi_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+dpi_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
- dpi_load (client, user_data);
+ dpi_load (settings, user_data);
}
static void
dpi_value_changed (GtkSpinButton *spinner,
- MateConfClient *client)
+ GSettings *settings)
{
- /* Like any time when using a spin button with MateConf, there is
+ /* Like any time when using a spin button with GSettings, there is
* a race condition here. When we change, we send the new
- * value to MateConf, then restore to the old value until
+ * value to GSettings, then restore to the old value until
* we get a response to emulate the proper model/view behavior.
*
* If the user changes the value faster than responses are
- * received from MateConf, this may cause mildly strange effects.
+ * received from GSettings, this may cause mildly strange effects.
*/
if (!in_change) {
gdouble new_dpi = gtk_spin_button_get_value (spinner);
- mateconf_client_set_float (client, FONT_DPI_KEY, new_dpi, NULL);
+ g_settings_set_double (settings, FONT_DPI_KEY, new_dpi);
- dpi_load (client, spinner);
+ dpi_load (settings, spinner);
}
}
@@ -841,19 +629,18 @@ cb_show_details (GtkWidget *button,
gtk_adjustment_set_upper (adjustment, DPI_HIGH_REASONABLE_VALUE);
gtk_adjustment_set_step_increment (adjustment, 1);
- dpi_load (data->client, GTK_SPIN_BUTTON (widget));
+ dpi_load (data->font_settings, GTK_SPIN_BUTTON (widget));
g_signal_connect (widget, "value_changed",
- G_CALLBACK (dpi_value_changed), data->client);
+ G_CALLBACK (dpi_value_changed), data->font_settings);
- mateconf_client_notify_add (data->client, FONT_DPI_KEY,
- dpi_changed, widget, NULL, NULL);
+ g_signal_connect (data->font_settings, "changed::" FONT_DPI_KEY, G_CALLBACK (dpi_changed), widget);
setup_font_sample (appearance_capplet_get_widget (data, "antialias_none_sample"), ANTIALIAS_NONE, HINT_FULL);
setup_font_sample (appearance_capplet_get_widget (data, "antialias_grayscale_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL);
setup_font_sample (appearance_capplet_get_widget (data, "antialias_subpixel_sample"), ANTIALIAS_RGBA, HINT_FULL);
group = enum_group_create (
- FONT_ANTIALIASING_KEY, antialias_enums, ANTIALIAS_GRAYSCALE,
+ data->font_settings, FONT_ANTIALIASING_KEY,
appearance_capplet_get_widget (data, "antialias_none_radio"), ANTIALIAS_NONE,
appearance_capplet_get_widget (data, "antialias_grayscale_radio"), ANTIALIAS_GRAYSCALE,
appearance_capplet_get_widget (data, "antialias_subpixel_radio"), ANTIALIAS_RGBA,
@@ -865,7 +652,7 @@ cb_show_details (GtkWidget *button,
setup_font_sample (appearance_capplet_get_widget (data, "hint_medium_sample"), ANTIALIAS_GRAYSCALE, HINT_MEDIUM);
setup_font_sample (appearance_capplet_get_widget (data, "hint_full_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL);
- group = enum_group_create (FONT_HINTING_KEY, hint_enums, HINT_FULL,
+ group = enum_group_create (data->font_settings, FONT_HINTING_KEY,
appearance_capplet_get_widget (data, "hint_none_radio"), HINT_NONE,
appearance_capplet_get_widget (data, "hint_slight_radio"), HINT_SLIGHT,
appearance_capplet_get_widget (data, "hint_medium_radio"), HINT_MEDIUM,
@@ -882,7 +669,7 @@ cb_show_details (GtkWidget *button,
gtk_image_set_from_file (GTK_IMAGE (appearance_capplet_get_widget (data, "subpixel_vbgr_image")),
MATECC_PIXMAP_DIR "/subpixel-vbgr.png");
- group = enum_group_create (FONT_RGBA_ORDER_KEY, rgba_order_enums, RGBA_RGB,
+ group = enum_group_create (data->font_settings, FONT_RGBA_ORDER_KEY,
appearance_capplet_get_widget (data, "subpixel_rgb_radio"), RGBA_RGB,
appearance_capplet_get_widget (data, "subpixel_bgr_radio"), RGBA_BGR,
appearance_capplet_get_widget (data, "subpixel_vrgb_radio"), RGBA_VRGB,
@@ -904,34 +691,50 @@ cb_show_details (GtkWidget *button,
void font_init(AppearanceData* data)
{
- GObject* peditor;
GtkWidget* widget;
data->font_details = NULL;
data->font_groups = NULL;
- mateconf_client_add_dir(data->client, "/desktop/mate/interface", MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir(data->client, "/apps/caja/preferences", MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- mateconf_client_add_dir(data->client, MARCO_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- #ifdef HAVE_XFT2
- mateconf_client_add_dir(data->client, FONT_RENDER_DIR, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- #endif /* HAVE_XFT2 */
-
widget = appearance_capplet_get_widget(data, "application_font");
- peditor = mateconf_peditor_new_font(NULL, GTK_FONT_KEY, widget, "conv-from-widget-cb", application_font_to_mateconf, NULL);
- g_signal_connect_swapped(peditor, "value-changed", G_CALLBACK (application_font_changed), widget);
- application_font_changed(widget);
-
- peditor = mateconf_peditor_new_font(NULL, DOCUMENT_FONT_KEY, appearance_capplet_get_widget (data, "document_font"), NULL);
-
- peditor = mateconf_peditor_new_font(NULL, DESKTOP_FONT_KEY, appearance_capplet_get_widget (data, "desktop_font"), NULL);
-
- peditor = mateconf_peditor_new_font(NULL, WINDOW_TITLE_FONT_KEY, appearance_capplet_get_widget (data, "window_title_font"), NULL);
-
- peditor = mateconf_peditor_new_font(NULL, MONOSPACE_FONT_KEY, appearance_capplet_get_widget (data, "monospace_font"), NULL);
-
- mateconf_client_notify_add (data->client, WINDOW_TITLE_USES_SYSTEM_KEY, marco_changed, data, NULL, NULL);
+ g_settings_bind (data->interface_settings,
+ GTK_FONT_KEY,
+ G_OBJECT (widget),
+ "font-name",
+ G_SETTINGS_BIND_DEFAULT);
+
+ widget = appearance_capplet_get_widget (data, "document_font");
+ g_settings_bind (data->interface_settings,
+ DOCUMENT_FONT_KEY,
+ G_OBJECT (widget),
+ "font-name",
+ G_SETTINGS_BIND_DEFAULT);
+
+ widget = appearance_capplet_get_widget (data, "desktop_font");
+ g_settings_bind (data->caja_settings,
+ DESKTOP_FONT_KEY,
+ G_OBJECT (widget),
+ "font-name",
+ G_SETTINGS_BIND_DEFAULT);
+
+ widget = appearance_capplet_get_widget (data, "window_title_font");
+ g_settings_bind (data->marco_settings,
+ WINDOW_TITLE_FONT_KEY,
+ G_OBJECT (widget),
+ "font-name",
+ G_SETTINGS_BIND_DEFAULT);
+
+ widget = appearance_capplet_get_widget (data, "monospace_font");
+ g_settings_bind (data->interface_settings,
+ MONOSPACE_FONT_KEY,
+ G_OBJECT (widget),
+ "font-name",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_signal_connect (data->marco_settings,
+ "changed::" WINDOW_TITLE_USES_SYSTEM_KEY,
+ G_CALLBACK (marco_changed),
+ data);
marco_titlebar_load_sensitivity(data);
@@ -941,9 +744,9 @@ void font_init(AppearanceData* data)
setup_font_pair(appearance_capplet_get_widget(data, "best_contrast_radio"), appearance_capplet_get_widget (data, "best_contrast_sample"), ANTIALIAS_GRAYSCALE, HINT_FULL);
setup_font_pair(appearance_capplet_get_widget(data, "subpixel_radio"), appearance_capplet_get_widget (data, "subpixel_sample"), ANTIALIAS_RGBA, HINT_FULL);
- font_render_load (data->client);
+ font_render_load (data->font_settings);
- mateconf_client_notify_add (data->client, FONT_RENDER_DIR, font_render_changed, data->client, NULL, NULL);
+ g_signal_connect (data->font_settings, "changed", G_CALLBACK (font_render_changed), NULL);
g_signal_connect (appearance_capplet_get_widget (data, "details_button"), "clicked", G_CALLBACK (cb_show_details), data);
#else /* !HAVE_XFT2 */
@@ -957,5 +760,4 @@ void font_shutdown(AppearanceData* data)
g_slist_free(data->font_groups);
g_slist_foreach(font_pairs, (GFunc) g_free, NULL);
g_slist_free(font_pairs);
- g_free(old_font);
}
diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
index a7995105..6ff41249 100644
--- a/capplets/appearance/appearance-main.c
+++ b/capplets/appearance/appearance-main.c
@@ -60,7 +60,15 @@ init_appearance_data (int *argc, char ***argv, GOptionContext *context)
else
{
data = g_new (AppearanceData, 1);
- data->client = mateconf_client_get_default ();
+ data->settings = g_settings_new (APPEARANCE_SCHEMA);
+ data->wp_settings = g_settings_new (WP_SCHEMA);
+ data->caja_settings = g_settings_new (CAJA_SCHEMA);
+ data->interface_settings = g_settings_new (INTERFACE_SCHEMA);
+ data->marco_settings = g_settings_new (MARCO_SCHEMA);
+ data->mouse_settings = g_settings_new (MOUSE_SCHEMA);
+#ifdef HAVE_XFT2
+ data->font_settings = g_settings_new (FONT_RENDER_SCHEMA);
+#endif /* HAVE_XFT2 */
data->ui = ui;
data->thumb_factory = mate_desktop_thumbnail_factory_new (MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL);
}
@@ -84,7 +92,15 @@ main_window_response (GtkWidget *widget,
font_shutdown (data);
g_object_unref (data->thumb_factory);
- g_object_unref (data->client);
+ g_object_unref (data->settings);
+ g_object_unref (data->wp_settings);
+ g_object_unref (data->caja_settings);
+ g_object_unref (data->interface_settings);
+ g_object_unref (data->marco_settings);
+ g_object_unref (data->mouse_settings);
+#ifdef HAVE_XFT2
+ g_object_unref (data->font_settings);
+#endif /* HAVE_XFT2 */
g_object_unref (data->ui);
}
else if (response_id == GTK_RESPONSE_HELP)
diff --git a/capplets/appearance/appearance-style.c b/capplets/appearance/appearance-style.c
index 21612248..6ae5bd24 100644
--- a/capplets/appearance/appearance-style.c
+++ b/capplets/appearance/appearance-style.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2010 The MATE Foundation
+ * Copyright (C) 2007, 2010 The GNOME Foundation
* Written by Thomas Wood <[email protected]>
* All Rights Reserved
*
@@ -22,13 +22,17 @@
#include <string.h>
#include <pango/pango.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include "theme-util.h"
#include "gtkrc-utils.h"
-#include "mateconf-property-editor.h"
#include "theme-thumbnail.h"
#include "capplet-util.h"
+#define GSETTINGS_SETTINGS "GSETTINGS_SETTINGS"
+#define GSETTINGS_KEY "GSETTINGS_KEY"
+#define THEME_DATA "THEME_DATA"
+
typedef void (* ThumbnailGenFunc) (void *type,
ThemeThumbnailFunc theme,
AppearanceData *data,
@@ -37,7 +41,7 @@ typedef void (* ThumbnailGenFunc) (void *type,
typedef struct {
AppearanceData *data;
GdkPixbuf *thumbnail;
-} PEditorConvData;
+} ThemeConvData;
static void update_message_area (AppearanceData *data);
static void create_thumbnail (const gchar *name, GdkPixbuf *default_thumb, AppearanceData *data);
@@ -80,18 +84,15 @@ find_string_in_model (GtkTreeModel *model, const gchar *value, gint column)
return path;
}
-static MateConfValue *
-conv_to_widget_cb (MateConfPropertyEditor *peditor, const MateConfValue *value)
+static void
+treeview_gsettings_changed_callback (GSettings *settings, gchar *key, GtkTreeView *list)
{
GtkTreeModel *store;
- GtkTreeView *list;
- const gchar *curr_value;
- MateConfValue *new_value;
+ gchar *curr_value;
gchar *path;
/* find value in model */
- curr_value = mateconf_value_get_string (value);
- list = GTK_TREE_VIEW (mateconf_property_editor_get_ui_control (peditor));
+ curr_value = g_settings_get_string (settings, key);
store = gtk_tree_view_get_model (list);
path = find_string_in_model (store, curr_value, COL_NAME);
@@ -103,11 +104,11 @@ conv_to_widget_cb (MateConfPropertyEditor *peditor, const MateConfValue *value)
{
GtkListStore *list_store;
GtkTreeIter iter, sort_iter;
- PEditorConvData *conv;
+ ThemeConvData *conv;
list_store = GTK_LIST_STORE (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (store)));
- g_object_get (peditor, "data", &conv, NULL);
+ conv = g_object_get_data (G_OBJECT(list), THEME_DATA);
gtk_list_store_insert_with_values (list_store, &iter, 0,
COL_LABEL, curr_value,
COL_NAME, curr_value,
@@ -120,25 +121,27 @@ conv_to_widget_cb (MateConfPropertyEditor *peditor, const MateConfValue *value)
create_thumbnail (curr_value, conv->thumbnail, conv->data);
}
-
- new_value = mateconf_value_new (MATECONF_VALUE_STRING);
- mateconf_value_set_string (new_value, path);
- g_free (path);
-
- return new_value;
+ /* select the new gsettings theme in treeview */
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (list);
+ GtkTreePath *treepath = gtk_tree_path_new_from_string (path);
+ gtk_tree_selection_select_path (selection, treepath);
+ gtk_tree_view_scroll_to_cell (list, treepath, NULL, FALSE, 0, 0);
+ gtk_tree_path_free (treepath);
}
-static MateConfValue *
-conv_from_widget_cb (MateConfPropertyEditor *peditor, const MateConfValue *value)
+static void
+treeview_selection_changed_callback (GtkTreeSelection *selection, guint data)
{
- MateConfValue *new_value = NULL;
+ GSettings *settings;
+ gchar *key;
GtkTreeIter iter;
- GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeView *list;
- list = GTK_TREE_VIEW (mateconf_property_editor_get_ui_control (peditor));
- selection = gtk_tree_view_get_selection (list);
+ list = gtk_tree_selection_get_tree_view (selection);
+
+ settings = g_object_get_data (G_OBJECT (list), GSETTINGS_SETTINGS);
+ key = g_object_get_data (G_OBJECT (list), GSETTINGS_KEY);
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
gchar *list_value;
@@ -146,13 +149,9 @@ conv_from_widget_cb (MateConfPropertyEditor *peditor, const MateConfValue *value
gtk_tree_model_get (model, &iter, COL_NAME, &list_value, -1);
if (list_value) {
- new_value = mateconf_value_new (MATECONF_VALUE_STRING);
- mateconf_value_set_string (new_value, list_value);
- g_free (list_value);
+ g_settings_set_string (settings, key, list_value);
}
}
-
- return new_value;
}
static gint
@@ -299,7 +298,7 @@ update_color_buttons_from_settings (GtkSettings *settings,
{
gchar *scheme, *setting;
- scheme = mateconf_client_get_string (data->client, COLOR_SCHEME_KEY, NULL);
+ scheme = g_settings_get_string (data->interface_settings, COLOR_SCHEME_KEY);
g_object_get (settings, "gtk-color-scheme", &setting, NULL);
if (scheme == NULL || strcmp (scheme, "") == 0)
@@ -381,7 +380,7 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
g_object_get (gtk_settings_get_default (), "gtk-color-scheme", &old_scheme, NULL);
if (!mate_theme_color_scheme_equal (old_scheme, scheme->str)) {
- mateconf_client_set_string (data->client, COLOR_SCHEME_KEY, scheme->str, NULL);
+ g_settings_set_string (data->interface_settings, COLOR_SCHEME_KEY, scheme->str);
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "color_scheme_defaults_button"), TRUE);
}
@@ -392,7 +391,7 @@ color_button_clicked_cb (GtkWidget *colorbutton, AppearanceData *data)
static void
color_scheme_defaults_button_clicked_cb (GtkWidget *button, AppearanceData *data)
{
- mateconf_client_unset (data->client, COLOR_SCHEME_KEY, NULL);
+ g_settings_reset (data->interface_settings, COLOR_SCHEME_KEY);
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "color_scheme_defaults_button"), FALSE);
}
@@ -407,16 +406,14 @@ style_response_cb (GtkDialog *dialog, gint response_id)
}
static void
-gtk_theme_changed (MateConfPropertyEditor *peditor,
- const gchar *key,
- const MateConfValue *value,
- AppearanceData *data)
+gtk_theme_changed (GSettings *settings, gchar *key, AppearanceData *data)
{
MateThemeInfo *theme = NULL;
- const gchar *name;
- GtkSettings *settings = gtk_settings_get_default ();
+ gchar *name;
+ GtkSettings *gtksettings = gtk_settings_get_default ();
- if (value && (name = mateconf_value_get_string (value))) {
+ name = g_settings_get_string (settings, key);
+ if (name) {
gchar *current;
theme = mate_theme_info_find (name);
@@ -424,17 +421,18 @@ gtk_theme_changed (MateConfPropertyEditor *peditor,
/* Manually update GtkSettings to new gtk+ theme.
* This will eventually happen anyway, but we need the
* info for the color scheme updates already. */
- g_object_get (settings, "gtk-theme-name", &current, NULL);
+ g_object_get (gtksettings, "gtk-theme-name", &current, NULL);
if (strcmp (current, name) != 0) {
- g_object_set (settings, "gtk-theme-name", name, NULL);
+ g_object_set (gtksettings, "gtk-theme-name", name, NULL);
update_message_area (data);
}
g_free (current);
- check_color_schemes_enabled (settings, data);
- update_color_buttons_from_settings (settings, data);
+ check_color_schemes_enabled (gtksettings, data);
+ update_color_buttons_from_settings (gtksettings, data);
+ g_free (name);
}
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "gtk_themes_delete"),
@@ -442,32 +440,33 @@ gtk_theme_changed (MateConfPropertyEditor *peditor,
}
static void
-window_theme_changed (MateConfPropertyEditor *peditor,
- const gchar *key,
- const MateConfValue *value,
- AppearanceData *data)
+window_theme_changed (GSettings *settings, gchar *key, AppearanceData *data)
{
MateThemeInfo *theme = NULL;
- const gchar *name;
+ gchar *name;
- if (value && (name = mateconf_value_get_string (value)))
+ name = g_settings_get_string (settings, key);
+ if (name)
+ {
theme = mate_theme_info_find (name);
+ g_free (name);
+ }
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "window_themes_delete"),
theme_is_writable (theme));
}
static void
-icon_theme_changed (MateConfPropertyEditor *peditor,
- const gchar *key,
- const MateConfValue *value,
- AppearanceData *data)
+icon_theme_changed (GSettings *settings, gchar *key, AppearanceData *data)
{
MateThemeIconInfo *theme = NULL;
- const gchar *name;
+ gchar *name;
- if (value && (name = mateconf_value_get_string (value)))
+ name = g_settings_get_string (settings, key);
+ if (name) {
theme = mate_theme_icon_info_find (name);
+ g_free (name);
+}
gtk_widget_set_sensitive (appearance_capplet_get_widget (data, "icon_themes_delete"),
theme_is_writable (theme));
@@ -477,7 +476,7 @@ icon_theme_changed (MateConfPropertyEditor *peditor,
static void
cursor_size_changed_cb (int size, AppearanceData *data)
{
- mateconf_client_set_int (data->client, CURSOR_SIZE_KEY, size, NULL);
+ g_settings_set_int (data->mouse_settings, CURSOR_SIZE_KEY, size);
}
static void
@@ -486,7 +485,7 @@ cursor_size_scale_value_changed_cb (GtkRange *range, AppearanceData *data)
MateThemeCursorInfo *theme;
gchar *name;
- name = mateconf_client_get_string (data->client, CURSOR_THEME_KEY, NULL);
+ name = g_settings_get_string (data->mouse_settings, CURSOR_THEME_KEY);
if (name == NULL)
return;
@@ -512,7 +511,7 @@ update_cursor_size_scale (MateThemeCursorInfo *theme,
GtkWidget *cursor_size_small_label;
GtkWidget *cursor_size_large_label;
gboolean sensitive;
- gint size, mateconf_size;
+ gint size, gsettings_size;
cursor_size_scale = appearance_capplet_get_widget (data, "cursor_size_scale");
cursor_size_label = appearance_capplet_get_widget (data, "cursor_size_label");
@@ -525,7 +524,7 @@ update_cursor_size_scale (MateThemeCursorInfo *theme,
gtk_widget_set_sensitive (cursor_size_small_label, sensitive);
gtk_widget_set_sensitive (cursor_size_large_label, sensitive);
- mateconf_size = mateconf_client_get_int (data->client, CURSOR_SIZE_KEY, NULL);
+ gsettings_size = g_settings_get_int (data->mouse_settings, CURSOR_SIZE_KEY);
if (sensitive) {
GtkAdjustment *adjustment;
@@ -536,25 +535,25 @@ update_cursor_size_scale (MateThemeCursorInfo *theme,
g_object_set (adjustment, "upper", (gdouble) theme->sizes->len - 1, NULL);
- /* fallback if the mateconf value is bigger than all available sizes;
+ /* fallback if the gsettings value is bigger than all available sizes;
use the largest we have */
index = theme->sizes->len - 1;
- /* set the slider to the cursor size which matches the mateconf setting best */
+ /* set the slider to the cursor size which matches the gsettings setting best */
for (i = 0; i < theme->sizes->len; i++) {
size = g_array_index (theme->sizes, gint, i);
- if (size == mateconf_size) {
+ if (size == gsettings_size) {
index = i;
break;
- } else if (size > mateconf_size) {
+ } else if (size > gsettings_size) {
if (i == 0) {
index = 0;
} else {
gint diff, diff_to_last;
- diff = size - mateconf_size;
- diff_to_last = mateconf_size - g_array_index (theme->sizes, gint, i - 1);
+ diff = size - gsettings_size;
+ diff_to_last = gsettings_size - g_array_index (theme->sizes, gint, i - 1);
index = (diff < diff_to_last) ? i : i - 1;
}
@@ -572,22 +571,22 @@ update_cursor_size_scale (MateThemeCursorInfo *theme,
size = 18;
}
- if (size != mateconf_size)
+ if (size != gsettings_size)
cursor_size_changed_cb (size, data);
#endif
}
static void
-cursor_theme_changed (MateConfPropertyEditor *peditor,
- const gchar *key,
- const MateConfValue *value,
- AppearanceData *data)
+cursor_theme_changed (GSettings *settings, gchar *key, AppearanceData *data)
{
MateThemeCursorInfo *theme = NULL;
- const gchar *name;
+ gchar *name;
- if (value && (name = mateconf_value_get_string (value)))
+ name = g_settings_get_string (settings, key);
+ if (name) {
theme = mate_theme_cursor_info_find (name);
+ g_free (name);
+ }
update_cursor_size_scale (theme, data);
@@ -872,17 +871,17 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
GtkTreeModel *sort_model;
GdkPixbuf *thumbnail;
const gchar *key;
- GObject *peditor;
- MateConfValue *value;
ThumbnailGenFunc generator;
ThemeThumbnailFunc thumb_cb;
- PEditorConvData *conv_data;
+ ThemeConvData *conv_data;
+ GSettings *settings;
switch (type)
{
case THEME_TYPE_GTK:
themes = mate_theme_info_find_by_type (MATE_THEME_GTK_2);
thumbnail = data->gtk_theme_icon;
+ settings = data->interface_settings;
key = GTK_THEME_KEY;
generator = (ThumbnailGenFunc) generate_gtk_theme_thumbnail_async;
thumb_cb = (ThemeThumbnailFunc) gtk_theme_thumbnail_cb;
@@ -891,6 +890,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
case THEME_TYPE_WINDOW:
themes = mate_theme_info_find_by_type (MATE_THEME_MARCO);
thumbnail = data->window_theme_icon;
+ settings = data->marco_settings;
key = MARCO_THEME_KEY;
generator = (ThumbnailGenFunc) generate_marco_theme_thumbnail_async;
thumb_cb = (ThemeThumbnailFunc) marco_theme_thumbnail_cb;
@@ -899,6 +899,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
case THEME_TYPE_ICON:
themes = mate_theme_icon_info_find_all ();
thumbnail = data->icon_theme_icon;
+ settings = data->interface_settings;
key = ICON_THEME_KEY;
generator = (ThumbnailGenFunc) generate_icon_theme_thumbnail_async;
thumb_cb = (ThemeThumbnailFunc) icon_theme_thumbnail_cb;
@@ -907,6 +908,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
case THEME_TYPE_CURSOR:
themes = mate_theme_cursor_info_find_all ();
thumbnail = NULL;
+ settings = data->mouse_settings;
key = CURSOR_THEME_KEY;
generator = NULL;
thumb_cb = NULL;
@@ -969,23 +971,41 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
gtk_tree_view_column_add_attribute (column, renderer, "text", COL_LABEL);
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
- conv_data = g_new (PEditorConvData, 1);
+ conv_data = g_new (ThemeConvData, 1);
conv_data->data = data;
conv_data->thumbnail = thumbnail;
- peditor = mateconf_peditor_new_tree_view (NULL, key, list,
- "conv-to-widget-cb", conv_to_widget_cb,
- "conv-from-widget-cb", conv_from_widget_cb,
- "data", conv_data,
- "data-free-cb", g_free,
- NULL);
- g_signal_connect (peditor, "value-changed", callback, data);
-
- /* init the delete buttons */
- value = mateconf_client_get (data->client, key, NULL);
- (*((void (*) (MateConfPropertyEditor *, const gchar *, const MateConfValue *, gpointer)) callback))
- (MATECONF_PROPERTY_EDITOR (peditor), key, value, data);
- if (value)
- mateconf_value_free (value);
+
+ /* set useful data for callbacks */
+ g_object_set_data (G_OBJECT (list), THEME_DATA, conv_data);
+ g_object_set_data (G_OBJECT (list), GSETTINGS_SETTINGS, settings);
+ g_object_set_data (G_OBJECT (list), GSETTINGS_KEY, g_strdup(key));
+
+ /* select in treeview the theme set in gsettings */
+ GtkTreeModel *treemodel;
+ treemodel = gtk_tree_view_get_model (list);
+ gchar *theme = g_settings_get_string (settings, key);
+ gchar *path = find_string_in_model (treemodel, theme, COL_NAME);
+ if (path)
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
+ GtkTreePath *treepath = gtk_tree_path_new_from_string (path);
+ gtk_tree_selection_select_path (selection, treepath);
+ gtk_tree_view_scroll_to_cell (list, treepath, NULL, FALSE, 0, 0);
+ gtk_tree_path_free (treepath);
+ g_free (path);
+ }
+ if (theme)
+ g_free (theme);
+
+ /* connect to gsettings change event */
+ gchar *signal_name = g_strdup_printf("changed::%s", key);
+ g_signal_connect (settings, signal_name,
+ G_CALLBACK (treeview_gsettings_changed_callback), list);
+ g_free (signal_name);
+
+ /* connect to treeview change event */
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (list)),
+ "changed", G_CALLBACK (treeview_selection_changed_callback), list);
}
void
diff --git a/capplets/appearance/appearance-themes.c b/capplets/appearance/appearance-themes.c
index 132aa4b4..57c175cd 100644
--- a/capplets/appearance/appearance-themes.c
+++ b/capplets/appearance/appearance-themes.c
@@ -185,69 +185,75 @@ static void theme_changed_on_disk_cb(MateThemeCommonInfo* theme, MateThemeChange
}
}
-static gchar* get_default_string_from_key(MateConfClient* client, const char* key)
+/* Find out if the lockdown key has been set. */
+static gboolean is_locked_down()
{
- gchar* str = NULL;
-
- MateConfValue* value = mateconf_client_get_default_from_schema(client, key, NULL);
-
- if (value)
- {
- if (value->type == MATECONF_VALUE_STRING)
- {
- str = mateconf_value_to_string (value);
- }
-
- mateconf_value_free (value);
- }
-
- return str;
-}
-
-/* Find out if the lockdown key has been set.
- * Currently returns false on error... */
-static gboolean is_locked_down(MateConfClient* client)
-{
- return mateconf_client_get_bool(client, LOCKDOWN_KEY, NULL);
+ gboolean is_locked;
+ GSettings *settings;
+ settings = g_settings_new (LOCKDOWN_SCHEMA);
+ is_locked = g_settings_get_boolean (settings, DISABLE_THEMES_SETTINGS_KEY);
+ g_object_unref (settings);
+ return is_locked;
}
static MateThemeMetaInfo *
-theme_load_from_mateconf (MateConfClient *client)
+theme_load_from_gsettings (AppearanceData *data)
{
MateThemeMetaInfo *theme;
gchar *scheme;
+ const char * const *schemas;
+ gboolean schema_exists;
+ gint i;
theme = mate_theme_meta_info_new ();
- theme->gtk_theme_name = mateconf_client_get_string (client, GTK_THEME_KEY, NULL);
+ theme->gtk_theme_name = g_settings_get_string (data->interface_settings, GTK_THEME_KEY);
if (theme->gtk_theme_name == NULL)
theme->gtk_theme_name = g_strdup ("Clearlooks");
- scheme = mateconf_client_get_string (client, COLOR_SCHEME_KEY, NULL);
+ scheme = g_settings_get_string (data->interface_settings, COLOR_SCHEME_KEY);
if (scheme == NULL || !strcmp (scheme, "")) {
g_free (scheme);
scheme = gtkrc_get_color_scheme_for_theme (theme->gtk_theme_name);
}
theme->gtk_color_scheme = scheme;
- theme->marco_theme_name = mateconf_client_get_string (client, MARCO_THEME_KEY, NULL);
+ theme->marco_theme_name = g_settings_get_string (data->marco_settings, MARCO_THEME_KEY);
if (theme->marco_theme_name == NULL)
theme->marco_theme_name = g_strdup ("Clearlooks");
- theme->icon_theme_name = mateconf_client_get_string (client, ICON_THEME_KEY, NULL);
+ theme->icon_theme_name = g_settings_get_string (data->interface_settings, ICON_THEME_KEY);
if (theme->icon_theme_name == NULL)
theme->icon_theme_name = g_strdup ("mate");
- theme->notification_theme_name = mateconf_client_get_string (client, NOTIFICATION_THEME_KEY, NULL);
+ /* We need this because mate-control-center does not depend on mate-notification-daemon,
+ * and if we try to get notification theme without schema installed, gsettings crashes
+ * see https://bugzilla.gnome.org/show_bug.cgi?id=651225 */
+ schemas = g_settings_list_schemas ();
+ schema_exists = FALSE;
+ for (i = 0; schemas[i] != NULL; i++) {
+ if (g_strcmp0 (schemas[i], NOTIFICATION_SCHEMA) == 0) {
+ schema_exists = TRUE;
+ break;
+ }
+ }
+ if (schema_exists == TRUE) {
+ GSettings *notification_settings;
+ notification_settings = g_settings_new (NOTIFICATION_SCHEMA);
+ theme->notification_theme_name = g_settings_get_string (notification_settings, NOTIFICATION_THEME_KEY);
+ g_object_unref (notification_settings);
+ }
+ else
+ theme->notification_theme_name = NULL;
- theme->cursor_theme_name = mateconf_client_get_string (client, CURSOR_THEME_KEY, NULL);
+ theme->cursor_theme_name = g_settings_get_string (data->mouse_settings, CURSOR_THEME_KEY);
#ifdef HAVE_XCURSOR
- theme->cursor_size = mateconf_client_get_int (client, CURSOR_SIZE_KEY, NULL);
+ theme->cursor_size = g_settings_get_int (data->mouse_settings, CURSOR_SIZE_KEY);
#endif
if (theme->cursor_theme_name == NULL)
theme->cursor_theme_name = g_strdup ("default");
- theme->application_font = mateconf_client_get_string (client, APPLICATION_FONT_KEY, NULL);
+ theme->application_font = g_settings_get_string (data->interface_settings, GTK_FONT_KEY);
return theme;
}
@@ -380,12 +386,12 @@ theme_set_custom_from_theme (const MateThemeMetaInfo *info, AppearanceData *data
if (info->gtk_color_scheme)
custom->gtk_color_scheme = g_strdup (info->gtk_color_scheme);
else
- custom->gtk_color_scheme = get_default_string_from_key (data->client, COLOR_SCHEME_KEY);
+ custom->gtk_color_scheme = g_strdup ("");
if (info->application_font)
custom->application_font = g_strdup (info->application_font);
else
- custom->application_font = get_default_string_from_key (data->client, APPLICATION_FONT_KEY);
+ custom->application_font = g_strdup (GTK_FONT_DEFAULT_VALUE);
}
/* select the custom theme */
@@ -443,42 +449,36 @@ theme_message_area_response_cb (GtkWidget *w,
switch (response_id)
{
case RESPONSE_APPLY_BG:
- mateconf_client_set_string (data->client, BACKGROUND_KEY,
- theme->background_image, NULL);
+ g_settings_set_string (data->wp_settings, WP_FILE_KEY, theme->background_image);
break;
case RESPONSE_REVERT_FONT:
if (data->revert_application_font != NULL) {
- mateconf_client_set_string (data->client, APPLICATION_FONT_KEY,
- data->revert_application_font, NULL);
+ g_settings_set_string (data->interface_settings, GTK_FONT_KEY, data->revert_application_font);
g_free (data->revert_application_font);
data->revert_application_font = NULL;
}
if (data->revert_documents_font != NULL) {
- mateconf_client_set_string (data->client, DOCUMENTS_FONT_KEY,
- data->revert_documents_font, NULL);
+ g_settings_set_string (data->interface_settings, DOCUMENT_FONT_KEY, data->revert_documents_font);
g_free (data->revert_documents_font);
data->revert_documents_font = NULL;
}
if (data->revert_desktop_font != NULL) {
- mateconf_client_set_string (data->client, DESKTOP_FONT_KEY,
- data->revert_desktop_font, NULL);
+ g_settings_set_string (data->caja_settings, DESKTOP_FONT_KEY, data->revert_desktop_font);
g_free (data->revert_desktop_font);
data->revert_desktop_font = NULL;
}
if (data->revert_windowtitle_font != NULL) {
- mateconf_client_set_string (data->client, WINDOWTITLE_FONT_KEY,
- data->revert_windowtitle_font, NULL);
+ g_settings_set_string (data->marco_settings, WINDOW_TITLE_FONT_KEY, data->revert_windowtitle_font);
g_free (data->revert_windowtitle_font);
data->revert_windowtitle_font = NULL;
}
if (data->revert_monospace_font != NULL) {
- mateconf_client_set_string (data->client, MONOSPACE_FONT_KEY,
- data->revert_monospace_font, NULL);
+ g_settings_set_string (data->interface_settings, MONOSPACE_FONT_KEY, data->revert_monospace_font);
g_free (data->revert_monospace_font);
data->revert_monospace_font = NULL;
}
@@ -486,7 +486,7 @@ theme_message_area_response_cb (GtkWidget *w,
case RESPONSE_APPLY_FONT:
if (theme->application_font) {
- tmpfont = mateconf_client_get_string (data->client, APPLICATION_FONT_KEY, NULL);
+ tmpfont = g_settings_get_string (data->interface_settings, GTK_FONT_KEY);
if (tmpfont != NULL) {
g_free (data->revert_application_font);
@@ -496,12 +496,11 @@ theme_message_area_response_cb (GtkWidget *w,
} else
data->revert_application_font = tmpfont;
}
- mateconf_client_set_string (data->client, APPLICATION_FONT_KEY,
- theme->application_font, NULL);
+ g_settings_set_string (data->interface_settings, GTK_FONT_KEY, theme->application_font);
}
if (theme->documents_font) {
- tmpfont = mateconf_client_get_string (data->client, DOCUMENTS_FONT_KEY, NULL);
+ tmpfont = g_settings_get_string (data->interface_settings, DOCUMENT_FONT_KEY);
if (tmpfont != NULL) {
g_free (data->revert_documents_font);
@@ -511,12 +510,11 @@ theme_message_area_response_cb (GtkWidget *w,
} else
data->revert_documents_font = tmpfont;
}
- mateconf_client_set_string (data->client, DOCUMENTS_FONT_KEY,
- theme->documents_font, NULL);
+ g_settings_set_string (data->interface_settings, DOCUMENT_FONT_KEY, theme->documents_font);
}
if (theme->desktop_font) {
- tmpfont = mateconf_client_get_string (data->client, DESKTOP_FONT_KEY, NULL);
+ tmpfont = g_settings_get_string (data->caja_settings, DESKTOP_FONT_KEY);
if (tmpfont != NULL) {
g_free (data->revert_desktop_font);
@@ -526,12 +524,11 @@ theme_message_area_response_cb (GtkWidget *w,
} else
data->revert_desktop_font = tmpfont;
}
- mateconf_client_set_string (data->client, DESKTOP_FONT_KEY,
- theme->desktop_font, NULL);
+ g_settings_set_string (data->caja_settings, DESKTOP_FONT_KEY, theme->desktop_font);
}
if (theme->windowtitle_font) {
- tmpfont = mateconf_client_get_string (data->client, WINDOWTITLE_FONT_KEY, NULL);
+ tmpfont = g_settings_get_string (data->marco_settings, WINDOW_TITLE_FONT_KEY);
if (tmpfont != NULL) {
g_free (data->revert_windowtitle_font);
@@ -541,12 +538,11 @@ theme_message_area_response_cb (GtkWidget *w,
} else
data->revert_windowtitle_font = tmpfont;
}
- mateconf_client_set_string (data->client, WINDOWTITLE_FONT_KEY,
- theme->windowtitle_font, NULL);
+ g_settings_set_string (data->marco_settings, WINDOW_TITLE_FONT_KEY, theme->windowtitle_font);
}
if (theme->monospace_font) {
- tmpfont = mateconf_client_get_string (data->client, MONOSPACE_FONT_KEY, NULL);
+ tmpfont = g_settings_get_string (data->interface_settings, MONOSPACE_FONT_KEY);
if (tmpfont != NULL) {
g_free (data->revert_monospace_font);
@@ -556,8 +552,7 @@ theme_message_area_response_cb (GtkWidget *w,
} else
data->revert_monospace_font = tmpfont;
}
- mateconf_client_set_string (data->client, MONOSPACE_FONT_KEY,
- theme->monospace_font, NULL);
+ g_settings_set_string (data->interface_settings, MONOSPACE_FONT_KEY, theme->monospace_font);
}
break;
@@ -602,42 +597,42 @@ theme_message_area_update (AppearanceData *data)
if (theme->background_image != NULL) {
gchar *background;
- background = mateconf_client_get_string (data->client, BACKGROUND_KEY, NULL);
+ background = g_settings_get_string (data->wp_settings, WP_FILE_KEY);
show_apply_background =
(!background || strcmp (theme->background_image, background) != 0);
g_free (background);
}
if (theme->application_font) {
- font = mateconf_client_get_string (data->client, APPLICATION_FONT_KEY, NULL);
+ font = g_settings_get_string (data->interface_settings, GTK_FONT_KEY);
show_apply_font =
(!font || strcmp (theme->application_font, font) != 0);
g_free (font);
}
if (!show_apply_font && theme->documents_font) {
- font = mateconf_client_get_string (data->client, DOCUMENTS_FONT_KEY, NULL);
+ font = g_settings_get_string (data->interface_settings, DOCUMENT_FONT_KEY);
show_apply_font =
(!font || strcmp (theme->application_font, font) != 0);
g_free (font);
}
if (!show_apply_font && theme->desktop_font) {
- font = mateconf_client_get_string (data->client, DESKTOP_FONT_KEY, NULL);
+ font = g_settings_get_string (data->caja_settings, DESKTOP_FONT_KEY);
show_apply_font =
(!font || strcmp (theme->application_font, font) != 0);
g_free (font);
}
if (!show_apply_font && theme->windowtitle_font) {
- font = mateconf_client_get_string (data->client, WINDOWTITLE_FONT_KEY, NULL);
+ font = g_settings_get_string (data->marco_settings, WINDOW_TITLE_FONT_KEY);
show_apply_font =
(!font || strcmp (theme->application_font, font) != 0);
g_free (font);
}
if (!show_apply_font && theme->monospace_font) {
- font = mateconf_client_get_string (data->client, MONOSPACE_FONT_KEY, NULL);
+ font = g_settings_get_string (data->interface_settings, MONOSPACE_FONT_KEY);
show_apply_font =
(!font || strcmp (theme->application_font, font) != 0);
g_free (font);
@@ -864,19 +859,19 @@ theme_delete_cb (GtkWidget *button, AppearanceData *data)
static void
theme_details_changed_cb (AppearanceData *data)
{
- MateThemeMetaInfo *mateconf_theme;
+ MateThemeMetaInfo *gsettings_theme;
const MateThemeMetaInfo *selected;
GtkIconView *icon_view;
gboolean done = FALSE;
- /* load new state from mateconf */
- mateconf_theme = theme_load_from_mateconf (data->client);
+ /* load new state from gsettings */
+ gsettings_theme = theme_load_from_gsettings (data);
/* check if it's our currently selected theme */
icon_view = GTK_ICON_VIEW (appearance_capplet_get_widget (data, "theme_list"));
selected = theme_get_selected (icon_view, data);
- if (!selected || !(done = theme_is_equal (selected, mateconf_theme))) {
+ if (!selected || !(done = theme_is_equal (selected, gsettings_theme))) {
/* look for a matching metatheme */
GList *theme_list, *l;
@@ -885,7 +880,7 @@ theme_details_changed_cb (AppearanceData *data)
for (l = theme_list; l; l = l->next) {
MateThemeMetaInfo *info = l->data;
- if (theme_is_equal (mateconf_theme, info)) {
+ if (theme_is_equal (gsettings_theme, info)) {
theme_select_name (icon_view, info->name);
done = TRUE;
break;
@@ -896,9 +891,9 @@ theme_details_changed_cb (AppearanceData *data)
if (!done)
/* didn't find a match, set or update custom */
- theme_set_custom_from_theme (mateconf_theme, data);
+ theme_set_custom_from_theme (gsettings_theme, data);
- mate_theme_meta_info_free (mateconf_theme);
+ mate_theme_meta_info_free (gsettings_theme);
}
static void
@@ -910,10 +905,9 @@ theme_setting_changed_cb (GObject *settings,
}
static void
-theme_mateconf_changed (MateConfClient *client,
- guint conn_id,
- MateConfEntry *entry,
- AppearanceData *data)
+theme_gsettings_changed (GSettings *settings,
+ gchar *key,
+ AppearanceData *data)
{
theme_details_changed_cb (data);
}
@@ -991,7 +985,7 @@ theme_drag_data_received_cb (GtkWidget *widget,
g_strfreev (uris);
}
-static void background_or_font_changed(MateConfEngine* conf, guint cnxn_id, MateConfEntry* entry, AppearanceData* data)
+static void background_or_font_changed(GSettings *settings, gchar *key, AppearanceData* data)
{
theme_message_area_update(data);
}
@@ -1030,7 +1024,7 @@ void themes_init(AppearanceData* data)
theme_list = mate_theme_meta_info_find_all ();
mate_theme_info_register_theme_change ((ThemeChangedCallback) theme_changed_on_disk_cb, data);
- data->theme_custom = theme_load_from_mateconf (data->client);
+ data->theme_custom = theme_load_from_gsettings (data);
data->theme_custom->name = g_strdup (CUSTOM_THEME_NAME);
data->theme_custom->readable_name = g_strdup_printf ("<i>%s</i>", _("Custom"));
@@ -1115,11 +1109,11 @@ void themes_init(AppearanceData* data)
drop_types, G_N_ELEMENTS (drop_types),
GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE);
g_signal_connect (w, "drag-data-received", (GCallback) theme_drag_data_received_cb, data);
- if (is_locked_down (data->client))
+ if (is_locked_down ())
gtk_widget_set_sensitive (w, FALSE);
w = appearance_capplet_get_widget (data, "more_themes_linkbutton");
- url = mateconf_client_get_string (data->client, MORE_THEMES_URL_KEY, NULL);
+ url = g_settings_get_string (data->settings, MORE_THEMES_URL_KEY);
if (url != NULL && url[0] != '\0') {
gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
gtk_widget_show (w);
@@ -1128,20 +1122,18 @@ void themes_init(AppearanceData* data)
}
g_free (url);
- /* listen to mateconf changes, too */
- mateconf_client_add_dir (data->client, "/apps/marco/general", MATECONF_CLIENT_PRELOAD_NONE, NULL);
- mateconf_client_add_dir (data->client, "/desktop/mate/interface", MATECONF_CLIENT_PRELOAD_NONE, NULL);
- mateconf_client_notify_add (data->client, MARCO_THEME_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, CURSOR_THEME_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
+ /* listen to gsettings changes, too */
+ g_signal_connect (data->marco_settings, "changed::" MARCO_THEME_KEY, G_CALLBACK (theme_gsettings_changed), data);
+ g_signal_connect (data->mouse_settings, "changed::" CURSOR_THEME_KEY, G_CALLBACK (theme_gsettings_changed), data);
#ifdef HAVE_XCURSOR
- mateconf_client_notify_add (data->client, CURSOR_SIZE_KEY, (MateConfClientNotifyFunc) theme_mateconf_changed, data, NULL, NULL);
+ g_signal_connect (data->mouse_settings, "changed::" CURSOR_SIZE_KEY, G_CALLBACK (theme_gsettings_changed), data);
#endif
- mateconf_client_notify_add (data->client, BACKGROUND_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, APPLICATION_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, DOCUMENTS_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, DESKTOP_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, WINDOWTITLE_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
- mateconf_client_notify_add (data->client, MONOSPACE_FONT_KEY, (MateConfClientNotifyFunc) background_or_font_changed, data, NULL, NULL);
+ g_signal_connect (data->wp_settings, "changed::" WP_FILE_KEY, G_CALLBACK (background_or_font_changed), data);
+ g_signal_connect (data->interface_settings, "changed::" GTK_FONT_KEY, G_CALLBACK (background_or_font_changed), data);
+ g_signal_connect (data->interface_settings, "changed::" DOCUMENT_FONT_KEY, G_CALLBACK (background_or_font_changed), data);
+ g_signal_connect (data->caja_settings, "changed::" DESKTOP_FONT_KEY, G_CALLBACK (background_or_font_changed), data);
+ g_signal_connect (data->marco_settings, "changed::" WINDOW_TITLE_FONT_KEY, G_CALLBACK (background_or_font_changed), data);
+ g_signal_connect (data->interface_settings, "changed::" MONOSPACE_FONT_KEY, G_CALLBACK (background_or_font_changed), data);
settings = gtk_settings_get_default ();
g_signal_connect (settings, "notify::gtk-color-scheme", (GCallback) theme_setting_changed_cb, data);
diff --git a/capplets/appearance/appearance.h b/capplets/appearance/appearance.h
index 3658ea0f..b2e34d30 100644
--- a/capplets/appearance/appearance.h
+++ b/capplets/appearance/appearance.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 The MATE Foundation
+ * Copyright (C) 2007 The GNOME Foundation
* Written by Thomas Wood <[email protected]>
* All Rights Reserved
*
@@ -22,17 +22,67 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libmateui/mate-desktop-thumbnail.h>
#include "mate-theme-info.h"
-#define APPEARANCE_KEY_DIR "/apps/control-center/appearance"
-#define MORE_THEMES_URL_KEY APPEARANCE_KEY_DIR "/more_themes_url"
-#define MORE_BACKGROUNDS_URL_KEY APPEARANCE_KEY_DIR "/more_backgrounds_url"
+#define APPEARANCE_SCHEMA "org.mate.control-center.appearance"
+#define MORE_THEMES_URL_KEY "more-themes-url"
+#define MORE_BACKGROUNDS_URL_KEY "more-backgrounds-url"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+#define WP_OPTIONS_KEY "picture-options"
+#define WP_SHADING_KEY "color-shading-type"
+#define WP_PCOLOR_KEY "primary-color"
+#define WP_SCOLOR_KEY "secondary-color"
+
+#define INTERFACE_SCHEMA "org.mate.interface"
+#define GTK_FONT_KEY "font-name"
+#define MONOSPACE_FONT_KEY "monospace-font-name"
+#define DOCUMENT_FONT_KEY "document-font-name"
+#define GTK_THEME_KEY "gtk-theme"
+#define ICON_THEME_KEY "icon-theme"
+#define COLOR_SCHEME_KEY "gtk-color-scheme"
+#define GTK_FONT_DEFAULT_VALUE "Sans 10"
+
+#define LOCKDOWN_SCHEMA "org.mate.lockdown"
+#define DISABLE_THEMES_SETTINGS_KEY "disable-theme-settings"
+
+#define CAJA_SCHEMA "org.mate.caja.desktop"
+#define DESKTOP_FONT_KEY "font"
+
+#define MARCO_SCHEMA "org.mate.Marco.general"
+#define MARCO_THEME_KEY "theme"
+#define WINDOW_TITLE_FONT_KEY "titlebar-font"
+#define WINDOW_TITLE_USES_SYSTEM_KEY "titlebar-uses-system-font"
+
+#define NOTIFICATION_SCHEMA "org.mate.NotificationDaemon"
+#define NOTIFICATION_THEME_KEY "theme"
+
+#define MOUSE_SCHEMA "org.mate.peripherals-mouse"
+#define CURSOR_THEME_KEY "cursor-theme"
+#define CURSOR_SIZE_KEY "cursor-size"
+
+#ifdef HAVE_XFT2
+#define FONT_RENDER_SCHEMA "org.mate.font-rendering"
+#define FONT_ANTIALIASING_KEY "antialiasing"
+#define FONT_HINTING_KEY "hinting"
+#define FONT_RGBA_ORDER_KEY "rgba-order"
+#define FONT_DPI_KEY "dpi"
+#endif /* HAVE_XFT2 */
typedef struct {
- MateConfClient* client;
+ GSettings* settings;
+ GSettings* wp_settings;
+ GSettings* caja_settings;
+ GSettings* interface_settings;
+ GSettings* marco_settings;
+ GSettings* mouse_settings;
+#ifdef HAVE_XFT2
+ GSettings* font_settings;
+#endif /* HAVE_XFT2 */
GtkBuilder* ui;
MateDesktopThumbnailFactory* thumb_factory;
gulong screen_size_handler;
@@ -40,7 +90,7 @@ typedef struct {
/* desktop */
GHashTable* wp_hash;
- gboolean wp_update_mateconf;
+ gboolean wp_update_settings;
GtkIconView* wp_view;
GtkTreeModel* wp_model;
GtkWidget* wp_scpicker;
diff --git a/capplets/appearance/data/appearance.ui b/capplets/appearance/data/appearance.ui
index d97b2371..33fc0048 100644
--- a/capplets/appearance/data/appearance.ui
+++ b/capplets/appearance/data/appearance.ui
@@ -676,6 +676,8 @@
<property name="title" translatable="yes">Appearance Preferences</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
+ <property name="default_width">790</property>
+ <property name="default_height">560</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
diff --git a/capplets/appearance/mate-wp-item.c b/capplets/appearance/mate-wp-item.c
index 6f48a4de..abc1b334 100644
--- a/capplets/appearance/mate-wp-item.c
+++ b/capplets/appearance/mate-wp-item.c
@@ -21,49 +21,86 @@
#include <config.h>
#include <glib/gi18n.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <string.h>
#include "mate-wp-item.h"
-static MateConfEnumStringPair options_lookup[] = {
- { MATE_BG_PLACEMENT_CENTERED, "centered" },
- { MATE_BG_PLACEMENT_FILL_SCREEN, "stretched" },
- { MATE_BG_PLACEMENT_SCALED, "scaled" },
- { MATE_BG_PLACEMENT_ZOOMED, "zoom" },
- { MATE_BG_PLACEMENT_TILED, "wallpaper" },
- { MATE_BG_PLACEMENT_SPANNED, "spanned" },
- { 0, NULL }
-};
-
-static MateConfEnumStringPair shade_lookup[] = {
- { MATE_BG_COLOR_SOLID, "solid" },
- { MATE_BG_COLOR_H_GRADIENT, "horizontal-gradient" },
- { MATE_BG_COLOR_V_GRADIENT, "vertical-gradient" },
- { 0, NULL }
-};
+#define WP_SCHEMA "org.mate.background"
+#define WP_OPTIONS_KEY "picture-options"
+#define WP_SHADING_KEY "color-shading-type"
+#define WP_PCOLOR_KEY "primary-color"
+#define WP_SCOLOR_KEY "secondary-color"
const gchar *wp_item_option_to_string (MateBGPlacement type)
{
- return mateconf_enum_to_string (options_lookup, type);
+ switch (type)
+ {
+ case MATE_BG_PLACEMENT_CENTERED:
+ return "centered";
+ break;
+ case MATE_BG_PLACEMENT_FILL_SCREEN:
+ return "stretched";
+ break;
+ case MATE_BG_PLACEMENT_SCALED:
+ return "scaled";
+ break;
+ case MATE_BG_PLACEMENT_ZOOMED:
+ return "zoom";
+ break;
+ case MATE_BG_PLACEMENT_TILED:
+ return "wallpaper";
+ break;
+ case MATE_BG_PLACEMENT_SPANNED:
+ return "spanned";
+ break;
+ }
+ return "";
}
const gchar *wp_item_shading_to_string (MateBGColorType type)
{
- return mateconf_enum_to_string (shade_lookup, type);
+ switch (type) {
+ case MATE_BG_COLOR_SOLID:
+ return "solid";
+ break;
+ case MATE_BG_COLOR_H_GRADIENT:
+ return "horizontal-gradient";
+ break;
+ case MATE_BG_COLOR_V_GRADIENT:
+ return "vertical-gradient";
+ break;
+ }
+ return "";
}
MateBGPlacement wp_item_string_to_option (const gchar *option)
{
- int i = MATE_BG_PLACEMENT_SCALED;
- mateconf_string_to_enum (options_lookup, option, &i);
- return i;
+ if (!g_strcmp0(option, "centered"))
+ return MATE_BG_PLACEMENT_CENTERED;
+ else if (!g_strcmp0(option, "stretched"))
+ return MATE_BG_PLACEMENT_FILL_SCREEN;
+ else if (!g_strcmp0(option, "scaled"))
+ return MATE_BG_PLACEMENT_SCALED;
+ else if (!g_strcmp0(option, "zoom"))
+ return MATE_BG_PLACEMENT_ZOOMED;
+ else if (!g_strcmp0(option, "wallpaper"))
+ return MATE_BG_PLACEMENT_TILED;
+ else if (!g_strcmp0(option, "spanned"))
+ return MATE_BG_PLACEMENT_SPANNED;
+ else
+ return MATE_BG_PLACEMENT_SCALED;
}
MateBGColorType wp_item_string_to_shading (const gchar *shade_type)
{
- int i = MATE_BG_COLOR_SOLID;
- mateconf_string_to_enum (shade_lookup, shade_type, &i);
- return i;
+ if (!g_strcmp0(shade_type, "solid"))
+ return MATE_BG_COLOR_SOLID;
+ else if (!g_strcmp0(shade_type, "horizontal-gradient"))
+ return MATE_BG_COLOR_H_GRADIENT;
+ else if (!g_strcmp0(shade_type, "vertical-gradient"))
+ return MATE_BG_COLOR_V_GRADIENT;
+ else
+ return MATE_BG_COLOR_SOLID;
}
static void set_bg_properties (MateWPItem *item)
@@ -85,33 +122,29 @@ void mate_wp_item_ensure_mate_bg (MateWPItem *item)
}
void mate_wp_item_update (MateWPItem *item) {
- MateConfClient *client;
+ GSettings *settings;
GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
gchar *s;
- client = mateconf_client_get_default ();
+ settings = g_settings_new (WP_SCHEMA);
- s = mateconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
- item->options = wp_item_string_to_option (s);
- g_free (s);
+ item->options = g_settings_get_enum (settings, WP_OPTIONS_KEY);
- s = mateconf_client_get_string (client, WP_SHADING_KEY, NULL);
- item->shade_type = wp_item_string_to_shading (s);
- g_free (s);
+ item->shade_type = g_settings_get_enum (settings, WP_SHADING_KEY);
- s = mateconf_client_get_string (client, WP_PCOLOR_KEY, NULL);
+ s = g_settings_get_string (settings, WP_PCOLOR_KEY);
if (s != NULL) {
gdk_color_parse (s, &color1);
g_free (s);
}
- s = mateconf_client_get_string (client, WP_SCOLOR_KEY, NULL);
+ s = g_settings_get_string (settings, WP_SCOLOR_KEY);
if (s != NULL) {
gdk_color_parse (s, &color2);
g_free (s);
}
- g_object_unref (client);
+ g_object_unref (settings);
if (item->pcolor != NULL)
gdk_color_free (item->pcolor);
diff --git a/capplets/appearance/mate-wp-item.h b/capplets/appearance/mate-wp-item.h
index 346a8805..0bfaab0b 100644
--- a/capplets/appearance/mate-wp-item.h
+++ b/capplets/appearance/mate-wp-item.h
@@ -30,13 +30,6 @@
#ifndef _MATE_WP_ITEM_H_
#define _MATE_WP_ITEM_H_
-#define WP_PATH_KEY "/desktop/mate/background"
-#define WP_FILE_KEY WP_PATH_KEY "/picture_filename"
-#define WP_OPTIONS_KEY WP_PATH_KEY "/picture_options"
-#define WP_SHADING_KEY WP_PATH_KEY "/color_shading_type"
-#define WP_PCOLOR_KEY WP_PATH_KEY "/primary_color"
-#define WP_SCOLOR_KEY WP_PATH_KEY "/secondary_color"
-
typedef struct _MateWPItem MateWPItem;
struct _MateWPItem {
diff --git a/capplets/appearance/mate-wp-xml.c b/capplets/appearance/mate-wp-xml.c
index 62b30de0..d6b0c71d 100644
--- a/capplets/appearance/mate-wp-xml.c
+++ b/capplets/appearance/mate-wp-xml.c
@@ -145,7 +145,6 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
{
MateWPItem * wp;
char *pcolor = NULL, *scolor = NULL;
- char *s;
gboolean have_scale = FALSE, have_shade = FALSE;
wp = g_new0(MateWPItem, 1);
@@ -266,26 +265,22 @@ static void mate_wp_xml_load_xml(AppearanceData* data, const char* filename)
/* Verify the colors and alloc some GdkColors here */
if (!have_scale)
{
- s = mateconf_client_get_string(data->client, WP_OPTIONS_KEY, NULL);
- wp->options = wp_item_string_to_option (s);
- g_free (s);
+ wp->options = g_settings_get_enum(data->wp_settings, WP_OPTIONS_KEY);
}
if (!have_shade)
{
- s = mateconf_client_get_string(data->client, WP_SHADING_KEY, NULL);
- wp->shade_type = wp_item_string_to_shading (s);
- g_free (s);
+ wp->shade_type = g_settings_get_enum(data->wp_settings, WP_SHADING_KEY);
}
if (pcolor == NULL)
{
- pcolor = mateconf_client_get_string(data->client, WP_PCOLOR_KEY, NULL);
+ pcolor = g_settings_get_string(data->wp_settings, WP_PCOLOR_KEY);
}
if (scolor == NULL)
{
- scolor = mateconf_client_get_string (data->client, WP_SCOLOR_KEY, NULL);
+ scolor = g_settings_get_string (data->wp_settings, WP_SCOLOR_KEY);
}
gdk_color_parse(pcolor, &color1);
diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c
index fec1f001..98de2605 100644
--- a/capplets/appearance/theme-installer.c
+++ b/capplets/appearance/theme-installer.c
@@ -436,32 +436,40 @@ mate_theme_install_real (GtkWindow *parent,
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_APPLY) {
/* apply theme here! */
- MateConfClient *mateconf_client;
-
- mateconf_client = mateconf_client_get_default ();
+ GSettings *settings;
switch (theme_type) {
case THEME_GTK:
- mateconf_client_set_string (mateconf_client, GTK_THEME_KEY, theme_name, NULL);
+ settings = g_settings_new (INTERFACE_SCHEMA);
+ g_settings_set_string (settings, GTK_THEME_KEY, theme_name);
+ g_object_unref (settings);
break;
case THEME_MARCO:
- mateconf_client_set_string (mateconf_client, MARCO_THEME_KEY, theme_name, NULL);
+ settings = g_settings_new (MARCO_SCHEMA);
+ g_settings_set_string (settings, MARCO_THEME_KEY, theme_name);
+ g_object_unref (settings);
break;
case THEME_ICON:
- mateconf_client_set_string (mateconf_client, ICON_THEME_KEY, theme_name, NULL);
+ settings = g_settings_new (INTERFACE_SCHEMA);
+ g_settings_set_string (settings, ICON_THEME_KEY, theme_name);
+ g_object_unref (settings);
break;
case THEME_CURSOR:
- mateconf_client_set_string (mateconf_client, CURSOR_THEME_KEY, theme_name, NULL);
+ settings = g_settings_new (MOUSE_SCHEMA);
+ g_settings_set_string (settings, CURSOR_THEME_KEY, theme_name);
+ g_object_unref (settings);
break;
case THEME_ICON_CURSOR:
- mateconf_client_set_string (mateconf_client, ICON_THEME_KEY, theme_name, NULL);
- mateconf_client_set_string (mateconf_client, CURSOR_THEME_KEY, theme_name, NULL);
+ settings = g_settings_new (INTERFACE_SCHEMA);
+ g_settings_set_string (settings, ICON_THEME_KEY, theme_name);
+ g_object_unref (settings);
+ settings = g_settings_new (MOUSE_SCHEMA);
+ g_settings_set_string (settings, CURSOR_THEME_KEY, theme_name);
+ g_object_unref (settings);
break;
default:
break;
}
-
- g_object_unref (mateconf_client);
}
} else {
dialog = gtk_message_dialog_new (parent,
diff --git a/capplets/appearance/theme-save.c b/capplets/appearance/theme-save.c
index f4981468..fa90a2b0 100644
--- a/capplets/appearance/theme-save.c
+++ b/capplets/appearance/theme-save.c
@@ -23,6 +23,7 @@
#include <glib/gstdio.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <string.h>
#include "theme-save.h"
@@ -182,7 +183,7 @@ write_theme_to_disk (MateThemeMetaInfo *theme_info,
gchar* str;
gchar* current_background;
- MateConfClient* client;
+ GSettings* settings;
const gchar* theme_header = ""
"[Desktop Entry]\n"
"Name=%s\n"
@@ -243,8 +244,8 @@ write_theme_to_disk (MateThemeMetaInfo *theme_info,
}
if (save_background) {
- client = mateconf_client_get_default ();
- current_background = mateconf_client_get_string (client, BACKGROUND_KEY, NULL);
+ settings = g_settings_new (WP_SCHEMA);
+ current_background = g_settings_get_string (settings, WP_FILE_KEY);
if (current_background != NULL) {
str = g_strdup_printf ("BackgroundImage=%s\n", current_background);
@@ -254,7 +255,7 @@ write_theme_to_disk (MateThemeMetaInfo *theme_info,
g_free (current_background);
g_free (str);
}
- g_object_unref (client);
+ g_object_unref (settings);
}
g_file_move (tmp_file, target_file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);
diff --git a/capplets/appearance/theme-util.h b/capplets/appearance/theme-util.h
index 8bf91302..404a4b1d 100644
--- a/capplets/appearance/theme-util.h
+++ b/capplets/appearance/theme-util.h
@@ -18,26 +18,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define GTK_THEME_KEY "/desktop/mate/interface/gtk_theme"
-#define MARCO_THEME_KEY "/apps/marco/general/theme"
-#define ICON_THEME_KEY "/desktop/mate/interface/icon_theme"
-#define NOTIFICATION_THEME_KEY "/apps/notification-daemon/theme"
-#define COLOR_SCHEME_KEY "/desktop/mate/interface/gtk_color_scheme"
-#define LOCKDOWN_KEY "/desktop/mate/lockdown/disable_theme_settings"
-#define BACKGROUND_KEY "/desktop/mate/background/picture_filename"
-#define APPLICATION_FONT_KEY "/desktop/mate/interface/font_name"
-#define DOCUMENTS_FONT_KEY "/desktop/mate/interface/document_font_name"
-#define DESKTOP_FONT_KEY "/apps/caja/preferences/desktop_font"
-#define WINDOWTITLE_FONT_KEY "/apps/marco/general/titlebar_font"
-#define MONOSPACE_FONT_KEY "/desktop/mate/interface/monospace_font_name"
-
-#ifdef HAVE_XCURSOR
- #define CURSOR_THEME_KEY "/desktop/mate/peripherals/mouse/cursor_theme"
- #define CURSOR_SIZE_KEY "/desktop/mate/peripherals/mouse/cursor_size"
-#else
- #define CURSOR_THEME_KEY "/desktop/mate/peripherals/mouse/cursor_font"
-#endif
-
enum {
COL_THUMBNAIL,
COL_LABEL,