Permalink
Browse files

migrate to gsettings

  • Loading branch information...
stefano-k committed Oct 2, 2012
1 parent d564dd5 commit b34dc27b7b191e56cbf640a963435d6e68982608
View
2 NEWS
@@ -1 +1,3 @@
1.5.0
* Migrate to gsettings (dropped mateconf)
@@ -27,7 +27,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <mateconf/mateconf-client.h>
#include <gio/gio.h>
#include "gsm-properties-dialog.h"
#include "gsm-app-dialog.h"
@@ -54,8 +54,8 @@
#define STARTUP_APP_ICON "system-run"
#define SPC_MATECONF_CONFIG_PREFIX "/apps/mate-session/options"
#define SPC_MATECONF_AUTOSAVE_KEY SPC_MATECONF_CONFIG_PREFIX "/auto_save_session"
#define SPC_CONFIG_SCHEMA "org.mate.session"
#define SPC_AUTOSAVE_KEY "auto-save-session"
struct GsmPropertiesDialogPrivate
{
@@ -71,6 +71,8 @@ struct GsmPropertiesDialogPrivate
GtkWidget *remember_toggle;
GspAppManager *manager;
GSettings *settings;
};
enum {
@@ -458,15 +460,14 @@ on_row_activated (GtkTreeView *tree_view,
}
static void
on_autosave_value_notify (MateConfClient *client,
guint id,
MateConfEntry *entry,
on_autosave_value_notify (GSettings *settings,
gchar *key,
GsmPropertiesDialog *dialog)
{
gboolean gval;
gboolean bval;
gval = mateconf_value_get_bool (entry->value);
gval = g_settings_get_boolean (settings, key);
bval = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->remember_toggle));
if (bval != gval) {
@@ -478,18 +479,15 @@ static void
on_autosave_value_toggled (GtkToggleButton *button,
GsmPropertiesDialog *dialog)
{
MateConfClient *client;
gboolean gval;
gboolean bval;
client = mateconf_client_get_default ();
gval = mateconf_client_get_bool (client, SPC_MATECONF_AUTOSAVE_KEY, NULL);
gval = g_settings_get_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY);
bval = gtk_toggle_button_get_active (button);
if (gval != bval) {
mateconf_client_set_bool (client, SPC_MATECONF_AUTOSAVE_KEY, bval, NULL);
g_settings_set_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY, bval);
}
g_object_unref (client);
}
static void
@@ -508,7 +506,6 @@ setup_dialog (GsmPropertiesDialog *dialog)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
MateConfClient *client;
GtkTargetList *targetlist;
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
@@ -655,19 +652,18 @@ setup_dialog (GsmPropertiesDialog *dialog)
G_CALLBACK (on_edit_app_clicked),
dialog);
client = mateconf_client_get_default ();
dialog->priv->settings = g_settings_new (SPC_CONFIG_SCHEMA);
button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
CAPPLET_REMEMBER_WIDGET_NAME));
dialog->priv->remember_toggle = button;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
mateconf_client_get_bool (client, SPC_MATECONF_AUTOSAVE_KEY, NULL));
mateconf_client_notify_add (client,
SPC_MATECONF_AUTOSAVE_KEY,
(MateConfClientNotifyFunc)on_autosave_value_notify,
dialog,
NULL,
NULL);
g_object_unref (client);
g_settings_get_boolean (dialog->priv->settings, SPC_AUTOSAVE_KEY));
g_signal_connect (dialog->priv->settings,
"changed::" SPC_AUTOSAVE_KEY,
G_CALLBACK (on_autosave_value_notify),
dialog);
g_signal_connect (button,
"toggled",
@@ -752,17 +748,10 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
{
GtkWidget *content_area;
GtkWidget *widget;
MateConfClient *client;
GError *error;
dialog->priv = GSM_PROPERTIES_DIALOG_GET_PRIVATE (dialog);
client = mateconf_client_get_default ();
mateconf_client_add_dir (client,
SPC_MATECONF_CONFIG_PREFIX,
MATECONF_CLIENT_PRELOAD_ONELEVEL,
NULL);
dialog->priv->xml = gtk_builder_new ();
gtk_builder_set_translation_domain (dialog->priv->xml, GETTEXT_PACKAGE);
View
@@ -27,8 +27,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <mateconf/mateconf-client.h>
#include "gsm-properties-dialog.h"
static gboolean show_version = FALSE;
View
@@ -1,4 +1,4 @@
AC_INIT([mate-session], [1.4.0], [http://www.mate-desktop.org/])
AC_INIT([mate-session], [1.5.0], [http://www.mate-desktop.org/])
AC_CONFIG_SRCDIR([mate-session])
AC_CONFIG_HEADERS([config.h])
@@ -47,6 +47,7 @@ AC_ARG_WITH([gtk],
AC_MSG_RESULT([$with_gtk])
GLIB_REQUIRED=2.16.0
GIO_REQUIRED=2.25.0
DBUS_GLIB_REQUIRED=0.76
UPOWER_REQUIRED=0.9.0
@@ -66,7 +67,7 @@ PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(MATE_SESSION,
glib-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GIO_REQUIRED
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
upower-glib >= $UPOWER_REQUIRED
@@ -82,7 +83,6 @@ PKG_CHECK_MODULES(ICE, ice)
PKG_CHECK_MODULES(XEXT, xext xau)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
PKG_CHECK_MODULES(MATECONF, mateconf-2.0)
PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-$GTK_API_VERSION)
@@ -100,28 +100,9 @@ AC_SUBST(DEFAULT_WM)
AM_CONDITIONAL(USE_MATE_WM, test x$with_default_wm = xmate-wm)
dnl ====================================================================
dnl MateConf Checks
dnl GSettings
dnl ====================================================================
AC_PATH_PROG(MATECONFTOOL, mateconftool-2, no)
if test x"$MATECONFTOOL" = xno; then
AC_MSG_ERROR([mateconftool-2 executable not found in your path - should be installed with MateConf])
fi
AM_MATECONF_SOURCE_2
MATECONF_SERVERDIR=`$PKG_CONFIG --variable=mateconf_serverdir mateconf-2.0`
old_path=$PATH
if test x"$MATECONF_SERVERDIR" != x; then
PATH=$MATECONF_SERVERDIR:$PATH
fi
AC_PATH_PROG(MATECONF_SANITY_CHECK, mateconf-sanity-check-2, no)
if test x"$MATECONF_SANITY_CHECK" = xno; then
AC_MSG_ERROR([mateconf-sanity-check-2 executable not found in your path - should be installed with MateConf])
fi
AC_SUBST(MATECONF_SANITY_CHECK)
PATH=$old_path
GLIB_GSETTINGS
dnl ====================================================================
dnl X development libraries check
View
@@ -21,41 +21,23 @@ endif
@INTLTOOL_DESKTOP_RULE@
schemas_in_in_files = mate-session.schemas.in.in
schemas_in_files = $(schemas_in_in_files:.schemas.in.in=.schemas.in)
schemasdir = $(MATECONF_SCHEMA_FILE_DIR)
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
$(schemas_in_files): $(schemas_in_files).in Makefile
org.mate.session.gschema.xml.in: org.mate.session.gschema.xml.in.in Makefile
$(AM_V_GEN)sed \
-e "s|\@DEFAULT_WM\@|$(DEFAULT_WM)|" \
$< > $@
@INTLTOOL_SCHEMAS_RULE@
if MATECONF_SCHEMAS_INSTALL
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schemas_DATA) ; do \
MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p ; \
done \
fi
uninstall-local:
for p in $(schema_DATA) ; do \
MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-uninstall-rule $(top_builddir)/data/$$p ; \
done
endif
gsettings_SCHEMAS = org.mate.session.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
EXTRA_DIST = \
mate-wm \
$(xsession_in_files) \
$(schemas_in_in_files) \
$(gsettings_SCHEMAS) \
$(ui_DATA) \
$(pixmap_DATA_dist)
CLEANFILES = \
$(schemas_in_files) \
$(schemas_DATA) \
$(xsession_DATA) \
$(desktop_DATA) \
mate-wm.desktop

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,47 @@
<schemalist>
<schema id="org.mate.session" path="/desktop/mate/session/">
<key name="auto-save-session" type="b">
<default>false</default>
<_summary>Save sessions</_summary>
<_description>If enabled, mate-session will save the session automatically.</_description>
</key>
<key name="logout-prompt" type="b">
<default>true</default>
<_summary>Logout prompt</_summary>
<_description>If enabled, mate-session will prompt the user before ending a session.</_description>
</key>
<key name="idle-delay" type="i">
<default>5</default>
<_summary>Time before session is considered idle</_summary>
<_description>The number of minutes of inactivity before the session is considered idle.</_description>
</key>
<key name="default-session" type="as">
<default>[ 'mate-settings-daemon' ]</default>
<_summary>Default session</_summary>
<_description>List of applications that are part of the default session.</_description>
</key>
<key name="required-components-list" type="as">
<default>[ 'windowmanager', 'panel', 'filemanager' ]</default>
<_summary>Required session components</_summary>
<_description>List of components that are required as part of the session. (Each element names a key under "/desktop/mate/session/required_components"). The Startup Applications preferences tool will not normally allow users to remove a required component from the session, and the session manager will automatically add the required components back to the session at login time if they do get removed.</_description>
</key>
<child name="required-components" schema="org.mate.session.required-components"/>
</schema>
<schema id="org.mate.session.required-components" path="/desktop/mate/session/required-components/">
<key name="windowmanager" type="s">
<default>'@DEFAULT_WM@'</default>
<_summary>Window Manager</_summary>
<_description>The window manager is the program that draws the title bar and borders around windows, and allows you to move and resize windows.</_description>
</key>
<key name="panel" type="s">
<default>'mate-panel'</default>
<_summary>Panel</_summary>
<_description>The panel provides the bar at the top or bottom of the screen containing menus, the window list, status icons, the clock, etc.</_description>
</key>
<key name="filemanager" type="s">
<default>'caja'</default>
<_summary>File Manager</_summary>
<_description>The file manager provides the desktop icons and allows you to interact with your saved files.</_description>
</key>
</schema>
</schemalist>
Oops, something went wrong.

0 comments on commit b34dc27

Please sign in to comment.