summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-03 15:46:10 +0200
committerStefano Karapetsas <[email protected]>2012-09-03 15:46:10 +0200
commit060faa2203f81c7fd1ce719d4a5dcaff7813dadf (patch)
tree9efe3501ce41cb0699d853a98ccaf2ca6cdff6d1
parentf2ce79172dea2db12a1d85f441990e8b56cae225 (diff)
downloadmate-desktop-060faa2203f81c7fd1ce719d4a5dcaff7813dadf.tar.bz2
mate-desktop-060faa2203f81c7fd1ce719d4a5dcaff7813dadf.tar.xz
migrate to gsettings
-rw-r--r--Makefile.am11
-rw-r--r--NEWS3
-rw-r--r--configure.in16
-rw-r--r--libmate-desktop/libmateui/mate-bg.h10
-rw-r--r--libmate-desktop/mate-bg.c149
-rw-r--r--libmate-desktop/mate-desktop-utils.c12
6 files changed, 73 insertions, 128 deletions
diff --git a/Makefile.am b/Makefile.am
index 7395e0e..217eb8a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,9 @@
-SUBDIRS = \
- po \
- libmate-desktop \
- docs \
- man
+SUBDIRS = \
+ po \
+ libmate-desktop \
+ docs \
+ man \
+ schemas
if MATE_ABOUT_ENABLED
SUBDIRS += mate-about
diff --git a/NEWS b/NEWS
index 8b13789..5b7082f 100644
--- a/NEWS
+++ b/NEWS
@@ -1 +1,4 @@
+mate-desktop 1.5.0
+ * port to new thumbnail spec (code from gnome-desktop 3.x)
+ * added gsettings schemas from now deprecated libmate
diff --git a/configure.in b/configure.in
index 0baa013..8dfb4dd 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
m4_define([mate_platform], [1])
-m4_define([mate_minor], [4])
-m4_define([mate_micro], [1])
+m4_define([mate_minor], [5])
+m4_define([mate_micro], [0])
m4_define(mate_version, [mate_platform.mate_minor.mate_micro]),
@@ -128,13 +128,13 @@ esac
GDK_PIXBUF_REQUIRED=2.4.0
GLIB_REQUIRED=2.19.1
-MATECONF_REQUIRED=1.1.0
+GIO_REQUIRED=2.25.0
XRANDR_REQUIRED=1.2
#AC_SUBST(GTK_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
AC_SUBST(GDK_PIXBUF_REQUIRED)
-AC_SUBST(MATECONF_REQUIRED)
+AC_SUBST(GIO_REQUIRED)
AC_SUBST(XRANDR_REQUIRED)
dnl ----------------------------------------------------------------------------
@@ -211,10 +211,7 @@ AC_SUBST(RANDR_PACKAGE)
dnl pkg-config dependency checks
-PKG_CHECK_MODULES(MATE_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED mateconf-2.0 >= $MATECONF_REQUIRED $STARTUP_NOTIFICATION_PACKAGE $RANDR_PACKAGE)
-
-dnl for mate-about
-AM_PATH_PYTHON
+PKG_CHECK_MODULES(MATE_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GIO_REQUIRED $STARTUP_NOTIFICATION_PACKAGE $RANDR_PACKAGE)
PKG_CHECK_MODULES(MATE_ABOUT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
AC_SUBST(MATE_ABOUT_CFLAGS)
@@ -261,6 +258,7 @@ if test "x$enable_libunique" = "xyes"; then
fi
fi
+GLIB_GSETTINGS
dnl Do not use AC_PROG_AWK since we need the full pathname.
AC_PATH_PROGS(AWK, mawk gawk nawk awk, )
@@ -299,6 +297,8 @@ desktop-docs/Makefile
desktop-docs/fdl/Makefile
desktop-docs/gpl/Makefile
desktop-docs/lgpl/Makefile
+schemas/Makefile
+schemas/org.mate.interface.gschema.xml
man/Makefile
])
diff --git a/libmate-desktop/libmateui/mate-bg.h b/libmate-desktop/libmateui/mate-bg.h
index 42b0997..6b7539e 100644
--- a/libmate-desktop/libmateui/mate-bg.h
+++ b/libmate-desktop/libmateui/mate-bg.h
@@ -30,7 +30,7 @@
#endif
#include <gdk/gdk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libmateui/mate-desktop-thumbnail.h>
#include <libmateui/mate-bg-crossfade.h>
@@ -45,7 +45,7 @@ extern "C" {
#define MATE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG))
#define MATE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG, MateBGClass))
-#define MATE_BG_KEY_DIR "/desktop/mate/background"
+#define MATE_BG_SCHEMA "org.mate.background"
typedef struct _MateBG MateBG;
typedef struct _MateBGClass MateBGClass;
@@ -67,10 +67,8 @@ typedef enum {
GType mate_bg_get_type (void);
MateBG * mate_bg_new (void);
-void mate_bg_load_from_preferences (MateBG *bg,
- MateConfClient *client);
-void mate_bg_save_to_preferences (MateBG *bg,
- MateConfClient *client);
+void mate_bg_load_from_preferences (MateBG *bg);
+void mate_bg_save_to_preferences (MateBG *bg);
/* Setters */
void mate_bg_set_filename (MateBG *bg,
const char *filename);
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index a46fc27..d2a373b 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -41,19 +41,19 @@ Author: Soren Sandmann <[email protected]>
#include <cairo.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmateui/mate-bg.h>
#include <libmateui/mate-bg-crossfade.h>
-#define BG_KEY_DRAW_BACKGROUND MATE_BG_KEY_DIR "/draw_background"
-#define BG_KEY_PRIMARY_COLOR MATE_BG_KEY_DIR "/primary_color"
-#define BG_KEY_SECONDARY_COLOR MATE_BG_KEY_DIR "/secondary_color"
-#define BG_KEY_COLOR_TYPE MATE_BG_KEY_DIR "/color_shading_type"
-#define BG_KEY_PICTURE_PLACEMENT MATE_BG_KEY_DIR "/picture_options"
-#define BG_KEY_PICTURE_OPACITY MATE_BG_KEY_DIR "/picture_opacity"
-#define BG_KEY_PICTURE_FILENAME MATE_BG_KEY_DIR "/picture_filename"
+#define BG_KEY_DRAW_BACKGROUND "draw-background"
+#define BG_KEY_PRIMARY_COLOR "primary-color"
+#define BG_KEY_SECONDARY_COLOR "secondary-color"
+#define BG_KEY_COLOR_TYPE "color-shading-type"
+#define BG_KEY_PICTURE_PLACEMENT "picture-options"
+#define BG_KEY_PICTURE_OPACITY "picture-opacity"
+#define BG_KEY_PICTURE_FILENAME "picture-filename"
/* We keep the large pixbufs around if the next update
in the slideshow is less than 60 seconds away */
@@ -221,59 +221,6 @@ color_to_string (const GdkColor *color)
color->blue >> 8);
}
-static MateConfEnumStringPair placement_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 color_type_lookup[] = {
- { MATE_BG_COLOR_SOLID, "solid" },
- { MATE_BG_COLOR_H_GRADIENT, "horizontal-gradient" },
- { MATE_BG_COLOR_V_GRADIENT, "vertical-gradient" },
- { 0, NULL }
-};
-
-static void
-color_type_from_string (const char *string,
- MateBGColorType *color_type)
-{
- *color_type = MATE_BG_COLOR_SOLID;
-
- if (string) {
- mateconf_string_to_enum (color_type_lookup,
- string, (int *)color_type);
- }
-}
-
-static const char *
-color_type_to_string (MateBGColorType color_type)
-{
- return mateconf_enum_to_string (color_type_lookup, color_type);
-}
-
-static void
-placement_from_string (const char *string,
- MateBGPlacement *placement)
-{
- *placement = MATE_BG_PLACEMENT_ZOOMED;
-
- if (string) {
- mateconf_string_to_enum (placement_lookup,
- string, (int *)placement);
- }
-}
-
-static const char *
-placement_to_string (MateBGPlacement placement)
-{
- return mateconf_enum_to_string (placement_lookup, placement);
-}
-
static gboolean
do_changed (MateBG *bg)
{
@@ -343,21 +290,22 @@ queue_transitioned (MateBG *bg)
}
void
-mate_bg_load_from_preferences (MateBG *bg,
- MateConfClient *client)
+mate_bg_load_from_preferences (MateBG *bg)
{
char *tmp;
char *filename;
MateBGColorType ctype;
GdkColor c1, c2;
MateBGPlacement placement;
+ GSettings *settings;
g_return_if_fail (MATE_IS_BG (bg));
- g_return_if_fail (client != NULL);
+
+ settings = g_settings_new (MATE_BG_SCHEMA);
/* Filename */
filename = NULL;
- tmp = mateconf_client_get_string (client, BG_KEY_PICTURE_FILENAME, NULL);
+ tmp = g_settings_get_string(settings, BG_KEY_PICTURE_FILENAME);
if (tmp != NULL && *tmp != '\0') {
if (g_utf8_validate (tmp, -1, NULL) &&
g_file_test (tmp, G_FILE_TEST_EXISTS)) {
@@ -369,41 +317,32 @@ mate_bg_load_from_preferences (MateBG *bg,
/* Fall back to default background if filename was set
but no longer exists */
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
- MateConfValue *default_value;
g_free (filename);
filename = NULL;
+
+ /* FIXME: default value? */
- default_value =
- mateconf_client_get_default_from_schema (client,
- BG_KEY_PICTURE_FILENAME,
- NULL);
- if (default_value != NULL) {
- filename = g_strdup (mateconf_value_get_string (default_value));
- mateconf_value_free (default_value);
- }
}
}
g_free (tmp);
/* Colors */
- tmp = mateconf_client_get_string (client, BG_KEY_PRIMARY_COLOR, NULL);
+ tmp = g_settings_get_string (settings, BG_KEY_PRIMARY_COLOR);
color_from_string (tmp, &c1);
g_free (tmp);
- tmp = mateconf_client_get_string (client, BG_KEY_SECONDARY_COLOR, NULL);
+ tmp = g_settings_get_string (settings, BG_KEY_SECONDARY_COLOR);
color_from_string (tmp, &c2);
g_free (tmp);
/* Color type */
- tmp = mateconf_client_get_string (client, BG_KEY_COLOR_TYPE, NULL);
- color_type_from_string (tmp, &ctype);
- g_free (tmp);
+ ctype = g_settings_get_enum (settings, BG_KEY_COLOR_TYPE);
/* Placement */
- tmp = mateconf_client_get_string (client, BG_KEY_PICTURE_PLACEMENT, NULL);
- placement_from_string (tmp, &placement);
- g_free (tmp);
+ placement = g_settings_get_enum (settings, BG_KEY_PICTURE_PLACEMENT);
+
+ g_object_unref (settings);
mate_bg_set_color (bg, ctype, &c1, &c2);
mate_bg_set_placement (bg, placement);
@@ -413,34 +352,38 @@ mate_bg_load_from_preferences (MateBG *bg,
}
void
-mate_bg_save_to_preferences (MateBG *bg,
- MateConfClient *client)
+mate_bg_save_to_preferences (MateBG *bg)
{
- const char *color_type;
- const char *placement;
- const gchar *filename;
- gchar *primary;
- gchar *secondary;
+ MateBGColorType color_type;
+ MateBGPlacement placement;
+ const gchar *filename;
+ gchar *primary;
+ gchar *secondary;
+ GSettings *settings;
+
+ settings = g_settings_new (MATE_BG_SCHEMA);
primary = color_to_string (&bg->primary);
secondary = color_to_string (&bg->secondary);
- color_type = color_type_to_string (bg->color_type);
+ color_type = bg->color_type;
- if (bg->filename) {
+ if (bg->filename) {
filename = bg->filename;
- placement = placement_to_string (bg->placement);
- }
- else {
- filename = "(none)";
- placement = "none";
- }
-
- mateconf_client_set_string (client, BG_KEY_PICTURE_FILENAME, filename, NULL);
- mateconf_client_set_string (client, BG_KEY_PRIMARY_COLOR, primary, NULL);
- mateconf_client_set_string (client, BG_KEY_SECONDARY_COLOR, secondary, NULL);
- mateconf_client_set_string (client, BG_KEY_COLOR_TYPE, color_type, NULL);
- mateconf_client_set_string (client, BG_KEY_PICTURE_PLACEMENT, placement, NULL);
+ placement = bg->placement;
+ }
+ else {
+ filename = "(none)";
+ placement = MATE_BG_PLACEMENT_ZOOMED;
+ }
+
+ g_settings_set_string (settings, BG_KEY_PICTURE_FILENAME, filename);
+ g_settings_set_string (settings, BG_KEY_PRIMARY_COLOR, primary);
+ g_settings_set_string (settings, BG_KEY_SECONDARY_COLOR, secondary);
+ g_settings_set_enum (settings, BG_KEY_COLOR_TYPE, color_type);
+ g_settings_set_enum (settings, BG_KEY_PICTURE_PLACEMENT, placement);
+
+ g_object_unref (settings);
g_free (primary);
g_free (secondary);
diff --git a/libmate-desktop/mate-desktop-utils.c b/libmate-desktop/mate-desktop-utils.c
index 003a37f..a0a6877 100644
--- a/libmate-desktop/mate-desktop-utils.c
+++ b/libmate-desktop/mate-desktop-utils.c
@@ -26,7 +26,7 @@
#include <config.h>
#include <glib.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
@@ -57,7 +57,7 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
int i, j;
char **term_argv = NULL;
int term_argc = 0;
- MateConfClient *client;
+ GSettings *settings;
gchar *terminal = NULL;
@@ -81,14 +81,13 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
*argc = i;
}
- client = mateconf_client_get_default ();
- terminal = mateconf_client_get_string (client, "/desktop/mate/applications/terminal/exec", NULL);
- g_object_unref (client);
+ settings = g_settings_new ("org.mate.applications-terminal");
+ terminal = g_settings_get_string (settings, "exec");
if (terminal) {
gchar *command_line;
gchar *exec_flag;
- exec_flag = mateconf_client_get_string (client, "/desktop/mate/applications/terminal/exec_arg", NULL);
+ exec_flag = g_settings_get_string (settings, "exec-arg");
if (exec_flag == NULL)
command_line = g_strdup (terminal);
@@ -105,6 +104,7 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
g_free (exec_flag);
g_free (terminal);
}
+ g_object_unref (settings);
if (term_argv == NULL) {
char *check;