summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/Makefile.am44
-rw-r--r--mate-panel/applet.c125
-rw-r--r--mate-panel/applet.h4
-rw-r--r--mate-panel/button-widget.c2
-rw-r--r--mate-panel/drawer.c194
-rw-r--r--mate-panel/drawer.h6
-rw-r--r--mate-panel/launcher.c59
-rw-r--r--mate-panel/launcher.h10
-rw-r--r--mate-panel/libmate-panel-applet-private/mate-panel-applet-container.c2
-rw-r--r--mate-panel/libmate-panel-applet-private/mate-panel-applet-frame-dbus.c2
-rw-r--r--mate-panel/libpanel-util/Makefile.am2
-rw-r--r--mate-panel/libpanel-util/panel-dconf.c109
-rw-r--r--mate-panel/libpanel-util/panel-dconf.h44
-rw-r--r--mate-panel/main.c10
-rw-r--r--mate-panel/mate-desktop-item-edit.c2
-rw-r--r--mate-panel/mate-panel-applet-frame.c36
-rw-r--r--mate-panel/mate-panel-applet-frame.h2
-rw-r--r--mate-panel/menu.c9
-rw-r--r--mate-panel/panel-action-button.c245
-rw-r--r--mate-panel/panel-action-button.h9
-rw-r--r--mate-panel/panel-addto.c50
-rw-r--r--mate-panel/panel-bindings.c138
-rw-r--r--mate-panel/panel-compatibility.c1167
-rw-r--r--mate-panel/panel-compatibility.h48
-rw-r--r--mate-panel/panel-compatibility.schemas546
-rw-r--r--mate-panel/panel-config-global.c68
-rw-r--r--mate-panel/panel-default-setup.entries657
-rw-r--r--mate-panel/panel-enums-gsettings.h79
-rw-r--r--mate-panel/panel-enums.h62
-rw-r--r--mate-panel/panel-general.schemas.in127
-rw-r--r--mate-panel/panel-global.schemas.in276
-rw-r--r--mate-panel/panel-gsettings.c178
-rw-r--r--mate-panel/panel-gsettings.h53
-rw-r--r--mate-panel/panel-layout.c353
-rw-r--r--mate-panel/panel-layout.h38
-rw-r--r--mate-panel/panel-lockdown.c251
-rw-r--r--mate-panel/panel-mateconf.c351
-rw-r--r--mate-panel/panel-mateconf.h76
-rw-r--r--mate-panel/panel-menu-bar.c4
-rw-r--r--mate-panel/panel-menu-bar.h2
-rw-r--r--mate-panel/panel-menu-button.c203
-rw-r--r--mate-panel/panel-menu-button.h4
-rw-r--r--mate-panel/panel-menu-items.c84
-rw-r--r--mate-panel/panel-object.schemas.in263
-rw-r--r--mate-panel/panel-profile.c2116
-rw-r--r--mate-panel/panel-profile.h62
-rw-r--r--mate-panel/panel-properties-dialog.c202
-rw-r--r--mate-panel/panel-reset.c21
-rw-r--r--mate-panel/panel-run-dialog.c91
-rw-r--r--mate-panel/panel-schemas.h90
-rw-r--r--mate-panel/panel-separator.c4
-rw-r--r--mate-panel/panel-separator.h2
-rw-r--r--mate-panel/panel-test-applets.c56
-rw-r--r--mate-panel/panel-test-applets.ui6
-rw-r--r--mate-panel/panel-toplevel.c44
-rw-r--r--mate-panel/panel-toplevel.h5
-rw-r--r--mate-panel/panel-toplevel.schemas.in434
-rw-r--r--mate-panel/panel-util.c19
-rw-r--r--mate-panel/panel.c12
59 files changed, 2411 insertions, 6747 deletions
diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am
index f6384132..03cae874 100644
--- a/mate-panel/Makefile.am
+++ b/mate-panel/Makefile.am
@@ -14,6 +14,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/mate-panel/libpanel-util \
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DBUILDERDIR=\""$(uidir)"\" \
+ -DPANELDATADIR=\""$(datadir)/mate-panel"\" \
-DICONDIR=\""$(datadir)/mate-panel/pixmaps"\" \
$(DISABLE_DEPRECATED_CFLAGS)
@@ -29,13 +30,12 @@ panel_sources = \
button-widget.c \
xstuff.c \
panel-session.c \
- panel-compatibility.c \
panel.c \
applet.c \
drawer.c \
panel-config-global.c \
panel-util.c \
- panel-mateconf.c \
+ panel-gsettings.c \
panel-properties-dialog.c \
panel-run-dialog.c \
menu.c \
@@ -61,6 +61,7 @@ panel_sources = \
panel-multiscreen.c \
panel-a11y.c \
panel-bindings.c \
+ panel-layout.c \
panel-profile.c \
panel-force-quit.c \
panel-lockdown.c \
@@ -77,14 +78,13 @@ panel_headers = \
button-widget.h \
xstuff.h \
panel-session.h \
- panel-compatibility.h \
panel.h \
applet.h \
drawer.h \
panel-util.h \
panel-properties-dialog.h \
panel-config-global.h \
- panel-mateconf.h \
+ panel-gsettings.h \
panel-run-dialog.h \
menu.h \
panel-context-menu.h \
@@ -109,6 +109,7 @@ panel_headers = \
panel-multiscreen.h \
panel-a11y.h \
panel-bindings.h \
+ panel-layout.h \
panel-profile.h \
panel-enums.h \
panel-force-quit.h \
@@ -118,7 +119,8 @@ panel_headers = \
panel-icon-names.h \
panel-modules.h \
mate-panel-applet-info.h \
- panel-reset.h
+ panel-reset.h \
+ panel-schemas.h
mate_panel_SOURCES = \
$(panel_sources) \
@@ -181,6 +183,7 @@ mate-panel-add: mate-panel-add.in Makefile
panel_enum_headers = \
$(top_srcdir)/mate-panel/panel-enums.h \
+ $(top_srcdir)/mate-panel/panel-enums-gsettings.h \
$(top_srcdir)/mate-panel/panel-types.h
panel-marshal.h: panel-marshal.list $(GLIB_GENMARSHAL)
@@ -239,40 +242,10 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
-entriesdir = $(MATECONF_SCHEMA_FILE_DIR)
-entries_DATA = panel-default-setup.entries
-
-schemasdir = $(MATECONF_SCHEMA_FILE_DIR)
-schemas_in_files = \
- panel-global.schemas.in \
- panel-general.schemas.in \
- panel-toplevel.schemas.in \
- panel-object.schemas.in
-schemas_DATA = panel-compatibility.schemas $(schemas_in_files:.schemas.in=.schemas)
-
-@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)/mate-panel/$$p ; \
- done ; \
- $(MATECONFTOOL) --direct --config-source=$(MATECONF_SCHEMA_CONFIG_SOURCE) --load $(srcdir)/panel-default-setup.entries ; \
- $(MATECONFTOOL) --direct --config-source=$(MATECONF_SCHEMA_CONFIG_SOURCE) --load $(srcdir)/panel-default-setup.entries /apps/panel ; \
- fi
-uninstall-local:
- for p in $(schema_DATA) ; do \
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-uninstall-rule $(top_builddir)/applets/mate-panel/$$p ; \
- done
-endif
-
EXTRA_DIST = \
$(ui_DATA) \
nothing.cP \
nothing.h \
- $(schemas_in_files) \
- panel-compatibility.schemas \
panel-marshal.list \
mate-panelrc \
$(entries_DATA) \
@@ -281,7 +254,6 @@ EXTRA_DIST = \
CLEANFILES = \
$(BUILT_SOURCES) \
- $(schemas_in_files:.schemas.in=.schemas) \
$(sys_DATA) \
$(desktop_DATA) \
mate-panel-add
diff --git a/mate-panel/applet.c b/mate-panel/applet.c
index e20e1faa..11fa617f 100644
--- a/mate-panel/applet.c
+++ b/mate-panel/applet.c
@@ -13,6 +13,7 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
+#include <gio/gio.h>
#include <libpanel-util/panel-show.h>
@@ -20,13 +21,11 @@
#include "drawer.h"
#include "launcher.h"
#include "panel-addto.h"
-#include "panel-mateconf.h"
#include "panel-config-global.h"
#include "mate-panel-applet-frame.h"
#include "panel-action-button.h"
#include "panel-menu-bar.h"
#include "panel-separator.h"
-#include "panel-compatibility.h"
#include "panel-toplevel.h"
#include "panel-util.h"
#include "panel-profile.h"
@@ -34,6 +33,7 @@
#include "panel-globals.h"
#include "panel-properties-dialog.h"
#include "panel-lockdown.h"
+#include "panel-schemas.h"
#define SMALL_ICON_SIZE 20
@@ -171,12 +171,10 @@ mate_panel_applet_recreate_menu (AppletInfo *info)
}
static void
-mate_panel_applet_locked_change_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- GtkWidget *applet)
+mate_panel_applet_locked_change_notify (GSettings *settings,
+ gchar *key,
+ GtkWidget *applet)
{
- MateConfValue *value;
gboolean locked;
gboolean applet_locked;
AppletInfo *info;
@@ -189,11 +187,7 @@ mate_panel_applet_locked_change_notify (MateConfClient *client,
if (info == NULL)
return;
- value = mateconf_entry_get_value (entry);
- if (value == NULL || value->type != MATECONF_VALUE_BOOL)
- return;
-
- locked = mateconf_value_get_bool (value);
+ locked = g_settings_get_boolean (settings, key);
panel_widget = mate_panel_applet_get_panel_widget (info);
applet_locked = panel_widget_get_applet_locked (panel_widget,
@@ -749,6 +743,11 @@ mate_panel_applet_destroy (GtkWidget *widget,
info->widget = NULL;
+ if (info->settings) {
+ g_object_unref (info->settings);
+ info->settings = NULL;
+ }
+
registered_applets = g_slist_remove (registered_applets, info);
queued_position_saves =
@@ -950,43 +949,33 @@ mate_panel_applet_load_idle_handler (gpointer dummy)
switch (applet_type) {
case PANEL_OBJECT_APPLET:
- mate_panel_applet_frame_load_from_mateconf (
+ mate_panel_applet_frame_load_from_gsettings (
panel_widget,
applet->locked,
applet->position,
applet->id);
break;
case PANEL_OBJECT_DRAWER:
- drawer_load_from_mateconf (panel_widget,
+ drawer_load_from_gsettings (panel_widget,
applet->locked,
applet->position,
applet->id);
break;
case PANEL_OBJECT_MENU:
- panel_menu_button_load_from_mateconf (panel_widget,
+ panel_menu_button_load_from_gsettings (panel_widget,
applet->locked,
applet->position,
TRUE,
applet->id);
break;
case PANEL_OBJECT_LAUNCHER:
- launcher_load_from_mateconf (panel_widget,
+ launcher_load_from_gsettings (panel_widget,
applet->locked,
applet->position,
applet->id);
break;
- case PANEL_OBJECT_LOGOUT:
- case PANEL_OBJECT_LOCK:
- panel_action_button_load_compatible (
- applet->type,
- panel_widget,
- applet->locked,
- applet->position,
- TRUE,
- applet->id);
- break;
case PANEL_OBJECT_ACTION:
- panel_action_button_load_from_mateconf (
+ panel_action_button_load_from_gsettings (
panel_widget,
applet->locked,
applet->position,
@@ -994,7 +983,7 @@ mate_panel_applet_load_idle_handler (gpointer dummy)
applet->id);
break;
case PANEL_OBJECT_MENU_BAR:
- panel_menu_bar_load_from_mateconf (
+ panel_menu_bar_load_from_gsettings (
panel_widget,
applet->locked,
applet->position,
@@ -1002,7 +991,7 @@ mate_panel_applet_load_idle_handler (gpointer dummy)
applet->id);
break;
case PANEL_OBJECT_SEPARATOR:
- panel_separator_load_from_mateconf (panel_widget,
+ panel_separator_load_from_gsettings (panel_widget,
applet->locked,
applet->position,
applet->id);
@@ -1136,10 +1125,7 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
const char *id,
gboolean immediate)
{
- PanelMateConfKeyType key_type;
- MateConfClient *client;
PanelWidget *panel_widget;
- const char *key;
const char *toplevel_id;
char *old_toplevel_id;
gboolean right_stick;
@@ -1165,19 +1151,14 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
if (!(toplevel_id = mate_panel_applet_get_toplevel_id (applet_info)))
return;
- client = panel_mateconf_get_client ();
-
- key_type = applet_info->type == PANEL_OBJECT_APPLET ? PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS;
-
panel_widget = mate_panel_applet_get_panel_widget (applet_info);
/* FIXME: Instead of getting keys, comparing and setting, there
should be a dirty flag */
- key = panel_mateconf_full_key (key_type, id, "toplevel_id");
- old_toplevel_id = mateconf_client_get_string (client, key, NULL);
+ old_toplevel_id = g_settings_get_string (applet_info->settings, PANEL_OBJECT_TOPLEVEL_ID_KEY);
if (old_toplevel_id == NULL || strcmp (old_toplevel_id, toplevel_id) != 0)
- mateconf_client_set_string (client, key, toplevel_id, NULL);
+ g_settings_set_string (applet_info->settings, PANEL_OBJECT_TOPLEVEL_ID_KEY, toplevel_id);
g_free (old_toplevel_id);
/* Note: changing some properties of the panel that may not be locked down
@@ -1186,25 +1167,21 @@ mate_panel_applet_save_position (AppletInfo *applet_info,
So check if these are writable before attempting to write them */
right_stick = panel_is_applet_right_stick (applet_info->widget) ? 1 : 0;
- key = panel_mateconf_full_key (
- key_type, id, "panel_right_stick");
- if (mateconf_client_key_is_writable (client, key, NULL) &&
- (mateconf_client_get_bool (client, key, NULL) ? 1 : 0) != right_stick)
- mateconf_client_set_bool (client, key, right_stick, NULL);
+ if (g_settings_is_writable (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY) &&
+ (g_settings_get_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY) ? 1 : 0) != right_stick)
+ g_settings_set_boolean (applet_info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, right_stick);
position = mate_panel_applet_get_position (applet_info);
if (right_stick && !panel_widget->packed)
position = panel_widget->size - position;
- key = panel_mateconf_full_key (key_type, id, "position");
- if (mateconf_client_key_is_writable (client, key, NULL) &&
- mateconf_client_get_int (client, key, NULL) != position)
- mateconf_client_set_int (client, key, position, NULL);
+ if (g_settings_is_writable (applet_info->settings, PANEL_OBJECT_POSITION_KEY) &&
+ g_settings_get_int (applet_info->settings, PANEL_OBJECT_POSITION_KEY) != position)
+ g_settings_set_int (applet_info->settings, PANEL_OBJECT_POSITION_KEY, position);
locked = panel_widget_get_applet_locked (panel_widget, applet_info->widget) ? 1 : 0;
- key = panel_mateconf_full_key (key_type, id, "locked");
- if (mateconf_client_get_bool (client, key, NULL) ? 1 : 0 != locked)
- mateconf_client_set_bool (client, key, locked, NULL);
+ if (g_settings_get_boolean (applet_info->settings, PANEL_OBJECT_LOCKED_KEY) ? 1 : 0 != locked)
+ g_settings_set_boolean (applet_info->settings, PANEL_OBJECT_LOCKED_KEY, locked);
}
const char *
@@ -1287,7 +1264,8 @@ mate_panel_applet_register (GtkWidget *applet,
const char *id)
{
AppletInfo *info;
- const char *key;
+ gchar *path;
+ gchar *locked_changed;
g_return_val_if_fail (applet != NULL && panel != NULL, NULL);
@@ -1307,18 +1285,21 @@ mate_panel_applet_register (GtkWidget *applet,
info->move_item = NULL;
info->id = g_strdup (id);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ info->settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
+
g_object_set_data (G_OBJECT (applet), "applet_info", info);
if (type != PANEL_OBJECT_APPLET)
panel_lockdown_notify_add (G_CALLBACK (mate_panel_applet_recreate_menu),
info);
- key = panel_mateconf_full_key ((type == PANEL_OBJECT_APPLET) ?
- PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS,
- id, "locked");
- panel_mateconf_notify_add_while_alive (key,
- (MateConfClientNotifyFunc) mate_panel_applet_locked_change_notify,
- G_OBJECT (applet));
+ locked_changed = g_strdup_printf ("changed::%s", PANEL_OBJECT_LOCKED_KEY);
+ g_signal_connect (info->settings,
+ locked_changed,
+ G_CALLBACK (mate_panel_applet_locked_change_notify),
+ G_OBJECT (applet));
if (type == PANEL_OBJECT_DRAWER) {
Drawer *drawer = data;
@@ -1403,27 +1384,16 @@ mate_panel_applet_get_position (AppletInfo *applet)
gboolean
mate_panel_applet_can_freely_move (AppletInfo *applet)
{
- MateConfClient *client;
- PanelMateConfKeyType key_type;
- const char *key;
-
if (panel_lockdown_get_locked_down ())
return FALSE;
- client = panel_mateconf_get_client ();
-
- key_type = (applet->type == PANEL_OBJECT_APPLET) ? PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS;
-
- key = panel_mateconf_full_key (key_type, applet->id, "position");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_POSITION_KEY))
return FALSE;
- key = panel_mateconf_full_key (key_type, applet->id, "toplevel_id");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_TOPLEVEL_ID_KEY))
return FALSE;
- key = panel_mateconf_full_key (key_type, applet->id, "panel_right_stick");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (applet->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY))
return FALSE;
return TRUE;
@@ -1432,18 +1402,9 @@ mate_panel_applet_can_freely_move (AppletInfo *applet)
gboolean
mate_panel_applet_lockable (AppletInfo *applet)
{
- MateConfClient *client;
- PanelMateConfKeyType key_type;
- const char *key;
-
if (panel_lockdown_get_locked_down ())
return FALSE;
- client = panel_mateconf_get_client ();
-
- key_type = (applet->type == PANEL_OBJECT_APPLET) ? PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS;
-
- key = panel_mateconf_full_key (key_type, applet->id, "locked");
- return mateconf_client_key_is_writable (client, key, NULL);
+ return g_settings_is_writable (applet->settings, PANEL_OBJECT_LOCKED_KEY);
}
diff --git a/mate-panel/applet.h b/mate-panel/applet.h
index 531e7e20..2ee60659 100644
--- a/mate-panel/applet.h
+++ b/mate-panel/applet.h
@@ -3,8 +3,8 @@
#include <glib.h>
#include <gdk/gdk.h>
+#include <gio/gio.h>
#include "panel-widget.h"
-#include "panel-mateconf.h"
#include "panel-enums.h"
#ifdef __cplusplus
@@ -27,6 +27,8 @@ typedef struct {
gpointer data;
GDestroyNotify data_destroy;
+ GSettings *settings;
+
char *id;
} AppletInfo;
diff --git a/mate-panel/button-widget.c b/mate-panel/button-widget.c
index 6f2fd6b8..7748a821 100644
--- a/mate-panel/button-widget.c
+++ b/mate-panel/button-widget.c
@@ -15,6 +15,8 @@
#include "panel-marshal.h"
#include "panel-typebuiltins.h"
#include "panel-globals.h"
+#include "panel-enums.h"
+#include "panel-enums-gsettings.h"
#define BUTTON_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BUTTON_TYPE_WIDGET, ButtonWidgetPrivate))
diff --git a/mate-panel/drawer.c b/mate-panel/drawer.c
index 924acb42..727924b2 100644
--- a/mate-panel/drawer.c
+++ b/mate-panel/drawer.c
@@ -17,19 +17,20 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
+#include <gio/gio.h>
#include "drawer.h"
#include "applet.h"
#include "button-widget.h"
#include "panel-config-global.h"
-#include "panel-mateconf.h"
#include "panel-profile.h"
#include "panel-util.h"
#include "xstuff.h"
#include "panel-globals.h"
#include "panel-lockdown.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
static void
drawer_click (GtkWidget *w, Drawer *drawer)
@@ -52,17 +53,6 @@ static void
destroy_drawer (GtkWidget *widget,
Drawer *drawer)
{
- MateConfClient *client;
- int i;
-
- client = panel_mateconf_get_client ();
-
- for (i = 0; i < PANEL_DRAWER_N_LISTENERS; i++) {
- if (drawer->listeners [i])
- mateconf_client_notify_remove (client, drawer->listeners [i]);
- drawer->listeners [i] = 0;
- }
-
if (drawer->toplevel)
gtk_widget_destroy (GTK_WIDGET (drawer->toplevel));
drawer->toplevel = NULL;
@@ -385,27 +375,20 @@ create_drawer_applet (PanelToplevel *toplevel,
}
static PanelToplevel *
-create_drawer_toplevel (const char *drawer_id)
+create_drawer_toplevel (const char *drawer_id, GSettings *settings)
{
PanelToplevel *toplevel;
- MateConfClient *client;
- const char *key;
char *toplevel_id;
- client = panel_mateconf_get_client ();
-
- toplevel_id = panel_profile_find_new_id (PANEL_MATECONF_TOPLEVELS);
-
- toplevel = panel_profile_load_toplevel (client, PANEL_CONFIG_DIR,
- PANEL_MATECONF_TOPLEVELS, toplevel_id);
+ toplevel_id = panel_profile_find_new_id (PANEL_GSETTINGS_TOPLEVELS);
+ toplevel = panel_profile_load_toplevel (toplevel_id);
if (!toplevel) {
g_free (toplevel_id);
return NULL;
}
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer_id, "attached_toplevel_id");
- mateconf_client_set_string (client, key, toplevel_id, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY, toplevel_id);
g_free (toplevel_id);
panel_profile_set_toplevel_enable_buttons (toplevel, TRUE);
@@ -428,24 +411,17 @@ drawer_button_size_allocated (GtkWidget *widget,
}
static void
-panel_drawer_use_custom_icon_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_drawer_use_custom_icon_changed (GSettings *settings,
+ gchar *key,
Drawer *drawer)
{
gboolean use_custom_icon;
char *custom_icon = NULL;
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- use_custom_icon = mateconf_value_get_bool (entry->value);
+ use_custom_icon = g_settings_get_boolean (settings, key);
if (use_custom_icon) {
- const char *key;
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer->info->id, "custom_icon");
- custom_icon = mateconf_client_get_string (client, key, NULL);
+ custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY);
}
button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon);
@@ -454,70 +430,45 @@ panel_drawer_use_custom_icon_changed (MateConfClient *client,
}
static void
-panel_drawer_custom_icon_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- Drawer *drawer)
+panel_drawer_custom_icon_changed (GSettings *settings,
+ gchar *key,
+ Drawer *drawer)
{
const char *custom_icon;
-
- if (!entry->value || entry->value->type != MATECONF_VALUE_STRING)
- return;
-
- custom_icon = mateconf_value_get_string (entry->value);
+ custom_icon = g_settings_get_string (settings, key);
if (custom_icon && custom_icon [0]) {
- const char *key;
gboolean use_custom_icon;
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer->info->id, "use_custom_icon");
- use_custom_icon = mateconf_client_get_bool (client, key, NULL);
+ use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY);
if (use_custom_icon)
button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon);
}
}
static void
-panel_drawer_tooltip_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_drawer_tooltip_changed (GSettings *settings,
+ gchar *key,
Drawer *drawer)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_STRING)
- return;
-
set_tooltip_and_name (drawer,
- mateconf_value_get_string (entry->value));
+ g_settings_get_string (settings, key));
}
static void
-panel_drawer_connect_to_mateconf (Drawer *drawer)
+panel_drawer_connect_to_gsettings (Drawer *drawer)
{
- MateConfClient *client;
- const char *key;
- int i = 0;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer->info->id, "use_custom_icon");
- drawer->listeners [i++] =
- mateconf_client_notify_add (client, key,
- (MateConfClientNotifyFunc) panel_drawer_use_custom_icon_changed,
- drawer, NULL, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer->info->id, "custom_icon");
- drawer->listeners [i++] =
- mateconf_client_notify_add (client, key,
- (MateConfClientNotifyFunc) panel_drawer_custom_icon_changed,
- drawer, NULL, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer->info->id, "tooltip");
- drawer->listeners [i++] =
- mateconf_client_notify_add (client, key,
- (MateConfClientNotifyFunc) panel_drawer_tooltip_changed,
- drawer, NULL, NULL);
-
- g_assert (i == PANEL_DRAWER_N_LISTENERS);
+ g_signal_connect (drawer->info->settings,
+ "changed::" PANEL_OBJECT_USE_CUSTOM_ICON_KEY,
+ G_CALLBACK (panel_drawer_use_custom_icon_changed),
+ drawer);
+ g_signal_connect (drawer->info->settings,
+ "changed::" PANEL_OBJECT_CUSTOM_ICON_KEY,
+ G_CALLBACK (panel_drawer_custom_icon_changed),
+ drawer);
+ g_signal_connect (drawer->info->settings,
+ "changed::" PANEL_OBJECT_TOOLTIP_KEY,
+ G_CALLBACK (panel_drawer_tooltip_changed),
+ drawer);
}
static gboolean
@@ -528,6 +479,7 @@ drawer_changes_enabled (void)
static void
load_drawer_applet (char *toplevel_id,
+ GSettings *settings,
const char *custom_icon,
gboolean use_custom_icon,
const char *tooltip,
@@ -548,7 +500,7 @@ load_drawer_applet (char *toplevel_id,
toplevel = panel_profile_get_toplevel_by_id (toplevel_id);
if (!toplevel)
- toplevel = create_drawer_toplevel (id);
+ toplevel = create_drawer_toplevel (id, settings);
if (toplevel) {
panel_toplevel_hide (toplevel, FALSE, -1);
@@ -601,7 +553,7 @@ load_drawer_applet (char *toplevel_id,
_("_Help"),
NULL);
- panel_drawer_connect_to_mateconf (drawer);
+ panel_drawer_connect_to_gsettings (drawer);
}
static void
@@ -611,45 +563,45 @@ panel_drawer_prepare (const char *drawer_id,
const char *tooltip,
char **attached_toplevel_id)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
+ GSettings *settings;
+ char *path;
+
+ path = g_strdup_printf ("%s%s/", PANEL_OBJECT_PATH, drawer_id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
if (tooltip) {
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer_id, "tooltip");
- mateconf_client_set_string (client, key, tooltip, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_TOOLTIP_KEY, tooltip);
}
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer_id, "use_custom_icon");
- mateconf_client_set_bool (client, key, use_custom_icon, NULL);
+ g_settings_set_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY, use_custom_icon);
if (custom_icon) {
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer_id, "custom_icon");
- mateconf_client_set_string (client, key, custom_icon, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY, custom_icon);
}
if (attached_toplevel_id) {
char *toplevel_id;
- char *toplevel_dir;
+ char *toplevel_path;
+ GSettings *toplevel_settings;
- toplevel_id = panel_profile_find_new_id (PANEL_MATECONF_TOPLEVELS);
+ toplevel_id = panel_profile_find_new_id (PANEL_GSETTINGS_TOPLEVELS);
- toplevel_dir = g_strdup_printf (PANEL_CONFIG_DIR "/toplevels/%s",
+ toplevel_path = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/",
toplevel_id);
- panel_mateconf_associate_schemas_in_dir (client, toplevel_dir, PANEL_SCHEMAS_DIR "/toplevels");
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, drawer_id, "attached_toplevel_id");
- mateconf_client_set_string (client, key, toplevel_id, NULL);
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, toplevel_id, "enable_buttons");
- mateconf_client_set_bool (client, key, TRUE, NULL);
+ toplevel_settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, toplevel_path);
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, toplevel_id, "enable_arrows");
- mateconf_client_set_bool (client, key, TRUE, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY, toplevel_id);
+ g_settings_set_boolean (toplevel_settings, PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY, TRUE);
+ g_settings_set_boolean (toplevel_settings, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY, TRUE);
*attached_toplevel_id = toplevel_id;
+
+ g_object_unref (toplevel_settings);
+ g_free (toplevel_path);
}
+ g_object_unref (settings);
}
void
@@ -665,7 +617,7 @@ panel_drawer_create (PanelToplevel *toplevel,
panel_drawer_prepare (id, custom_icon, use_custom_icon, tooltip, NULL);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
}
@@ -684,7 +636,7 @@ panel_drawer_create_with_id (const char *toplevel_id,
panel_drawer_prepare (id, custom_icon, use_custom_icon, tooltip, &attached_toplevel_id);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
@@ -692,38 +644,36 @@ panel_drawer_create_with_id (const char *toplevel_id,
}
void
-drawer_load_from_mateconf (PanelWidget *panel_widget,
- gboolean locked,
- gint position,
- const char *id)
+drawer_load_from_gsettings (PanelWidget *panel_widget,
+ gboolean locked,
+ gint position,
+ const char *id)
{
- MateConfClient *client;
- const char *key;
gboolean use_custom_icon;
char *toplevel_id;
char *custom_icon;
char *tooltip;
+ gchar *path;
+ GSettings *settings;
g_return_if_fail (panel_widget != NULL);
g_return_if_fail (id != NULL);
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "attached_toplevel_id");
- toplevel_id = mateconf_client_get_string (client, key, NULL);
+ path = g_strdup_printf ("%s%s/", PANEL_OBJECT_PATH, id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
- panel_profile_load_toplevel (client, PANEL_CONFIG_DIR, PANEL_MATECONF_TOPLEVELS, toplevel_id);
+ toplevel_id = g_settings_get_string (settings, PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "use_custom_icon");
- use_custom_icon = mateconf_client_get_bool (client, key, NULL);
+ panel_profile_load_toplevel (toplevel_id);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "custom_icon");
- custom_icon = mateconf_client_get_string (client, key, NULL);
+ use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY);
+ custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "tooltip");
- tooltip = mateconf_client_get_string (client, key, NULL);
+ tooltip = g_settings_get_string (settings, PANEL_OBJECT_TOOLTIP_KEY);
load_drawer_applet (toplevel_id,
+ settings,
custom_icon,
use_custom_icon,
tooltip,
diff --git a/mate-panel/drawer.h b/mate-panel/drawer.h
index 800e1a86..4365befc 100644
--- a/mate-panel/drawer.h
+++ b/mate-panel/drawer.h
@@ -7,8 +7,6 @@
extern "C" {
#endif
-#define PANEL_DRAWER_N_LISTENERS 3
-
typedef struct {
char *tooltip;
@@ -19,8 +17,6 @@ typedef struct {
guint close_timeout_id;
AppletInfo *info;
-
- guint listeners [PANEL_DRAWER_N_LISTENERS];
} Drawer;
void panel_drawer_create (PanelToplevel *toplevel,
@@ -38,7 +34,7 @@ char *panel_drawer_create_with_id (const char *toplevel_id,
void panel_drawer_set_dnd_enabled (Drawer *drawer,
gboolean dnd_enabled);
-void drawer_load_from_mateconf (PanelWidget *panel_widget,
+void drawer_load_from_gsettings (PanelWidget *panel_widget,
gboolean locked,
gint position,
const char *id);
diff --git a/mate-panel/launcher.c b/mate-panel/launcher.c
index 657bc0c8..24e4e846 100644
--- a/mate-panel/launcher.c
+++ b/mate-panel/launcher.c
@@ -33,7 +33,6 @@
#include "button-widget.h"
#include "panel-util.h"
#include "panel-config-global.h"
-#include "panel-mateconf.h"
#include "panel-profile.h"
#include "xstuff.h"
#include "panel-toplevel.h"
@@ -41,9 +40,9 @@
#include "panel-globals.h"
#include "panel-multiscreen.h"
#include "panel-lockdown.h"
-#include "panel-compatibility.h"
#include "panel-ditem-editor.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
static GdkScreen *
launcher_get_screen (Launcher *launcher)
@@ -414,7 +413,7 @@ static Launcher *
create_launcher (const char *location)
{
GKeyFile *key_file;
- gboolean loaded;
+ gboolean loaded = FALSE;
Launcher *launcher;
GError *error = NULL;
char *new_location;
@@ -686,21 +685,13 @@ launcher_saved (GtkWidget *dialog,
Launcher *launcher)
{
const char *uri;
- MateConfClient *client;
- const char *key;
-
uri = panel_ditem_editor_get_uri (PANEL_DITEM_EDITOR (dialog));
if (panel_launcher_get_filename (uri) != NULL)
uri = panel_launcher_get_filename (uri);
if (uri && launcher->location && strcmp (uri, launcher->location)) {
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS,
- launcher->info->id,
- "launcher_location");
- mateconf_client_set_string (client, key, uri, NULL);
+ g_settings_set_string (launcher->info->settings, PANEL_OBJECT_LAUNCHER_LOCATION_KEY, uri);
if (launcher->location)
g_free (launcher->location);
@@ -817,28 +808,28 @@ load_launcher_applet (const char *location,
}
void
-launcher_load_from_mateconf (PanelWidget *panel_widget,
- gboolean locked,
- int position,
- const char *id)
+launcher_load_from_gsettings (PanelWidget *panel_widget,
+ gboolean locked,
+ int position,
+ const char *id)
{
- MateConfClient *client;
+ GSettings *settings;
+ char *path;
Launcher *launcher;
- const char *key;
char *launcher_location;
g_return_if_fail (panel_widget != NULL);
g_return_if_fail (id != NULL);
- client = panel_mateconf_get_client ();
+ path = g_strdup_printf ("%s%s/", PANEL_OBJECT_PATH, id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "launcher_location");
- panel_compatibility_migrate_applications_scheme (client, key);
- launcher_location = mateconf_client_get_string (client, key, NULL);
+ launcher_location = g_settings_get_string (settings, PANEL_OBJECT_LAUNCHER_LOCATION_KEY);
if (!launcher_location) {
g_printerr (_("Key %s is not set, cannot load launcher\n"),
- key);
+ PANEL_OBJECT_LAUNCHER_LOCATION_KEY);
return;
}
@@ -850,8 +841,7 @@ launcher_load_from_mateconf (PanelWidget *panel_widget,
id);
if (launcher) {
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "launcher_location");
- if (!mateconf_client_key_is_writable (client, key, NULL)) {
+ if (!g_settings_is_writable (settings, PANEL_OBJECT_LAUNCHER_LOCATION_KEY)) {
AppletUserMenu *menu;
menu = mate_panel_applet_get_callback (launcher->info->user_menu,
@@ -862,6 +852,7 @@ launcher_load_from_mateconf (PanelWidget *panel_widget,
}
g_free (launcher_location);
+ g_object_unref (settings);
}
static void
@@ -976,21 +967,23 @@ panel_launcher_create_with_id (const char *toplevel_id,
int position,
const char *location)
{
- MateConfClient *client;
- const char *key;
+ GSettings *settings;
+ char *path;
char *id;
char *no_uri;
const char *new_location;
g_return_if_fail (location != NULL);
- client = panel_mateconf_get_client ();
-
id = panel_profile_prepare_object_with_id (PANEL_OBJECT_LAUNCHER,
toplevel_id,
position,
FALSE);
+ path = g_strdup_printf ("%s%s/", PANEL_OBJECT_PATH, id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
+
no_uri = NULL;
/* if we have an URI, it might contain escaped characters (? : etc)
* that might get unescaped on disk */
@@ -1003,15 +996,13 @@ panel_launcher_create_with_id (const char *toplevel_id,
if (new_location == NULL)
new_location = no_uri;
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS,
- id,
- "launcher_location");
- mateconf_client_set_string (client, key, new_location, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_LAUNCHER_LOCATION_KEY, new_location);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (no_uri);
g_free (id);
+ g_object_unref (settings);
}
void
diff --git a/mate-panel/launcher.h b/mate-panel/launcher.h
index 1b2d7b88..28cfd117 100644
--- a/mate-panel/launcher.h
+++ b/mate-panel/launcher.h
@@ -26,7 +26,7 @@ typedef struct {
GKeyFile *key_file;
GtkWidget *prop_dialog;
- GSList *error_dialogs;
+ GSList *error_dialogs;
gulong destroy_handler;
} Launcher;
@@ -53,10 +53,10 @@ void launcher_launch (Launcher *launcher,
void launcher_properties (Launcher *launcher);
-void launcher_load_from_mateconf (PanelWidget *panel_widget,
- gboolean locked,
- gint position,
- const char *id);
+void launcher_load_from_gsettings (PanelWidget *panel_widget,
+ gboolean locked,
+ gint position,
+ const char *id);
void panel_launcher_delete (Launcher *launcher);
diff --git a/mate-panel/libmate-panel-applet-private/mate-panel-applet-container.c b/mate-panel/libmate-panel-applet-private/mate-panel-applet-container.c
index 1076ff1d..00ef79c4 100644
--- a/mate-panel/libmate-panel-applet-private/mate-panel-applet-container.c
+++ b/mate-panel/libmate-panel-applet-private/mate-panel-applet-container.c
@@ -53,7 +53,7 @@ typedef struct {
} AppletPropertyInfo;
static const AppletPropertyInfo applet_properties [] = {
- { "prefs-key", "PrefsKey" },
+ { "prefs-path", "PrefsPath" },
{ "orient", "Orient" },
{ "size", "Size" },
{ "size-hints", "SizeHints" },
diff --git a/mate-panel/libmate-panel-applet-private/mate-panel-applet-frame-dbus.c b/mate-panel/libmate-panel-applet-private/mate-panel-applet-frame-dbus.c
index 3a694773..e2f69fc4 100644
--- a/mate-panel/libmate-panel-applet-private/mate-panel-applet-frame-dbus.c
+++ b/mate-panel/libmate-panel-applet-private/mate-panel-applet-frame-dbus.c
@@ -435,7 +435,7 @@ mate_panel_applet_frame_dbus_load (const gchar *iid,
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&builder, "{sv}",
- "prefs-key",
+ "prefs-path",
g_variant_new_string (conf_path));
g_variant_builder_add (&builder, "{sv}",
"orient",
diff --git a/mate-panel/libpanel-util/Makefile.am b/mate-panel/libpanel-util/Makefile.am
index 377e26e5..699f4b2a 100644
--- a/mate-panel/libpanel-util/Makefile.am
+++ b/mate-panel/libpanel-util/Makefile.am
@@ -15,6 +15,8 @@ libpanel_util_la_SOURCES = \
panel-cleanup.h \
panel-dbus-service.c \
panel-dbus-service.h \
+ panel-dconf.c \
+ panel-dconf.h \
panel-error.c \
panel-error.h \
panel-glib.c \
diff --git a/mate-panel/libpanel-util/panel-dconf.c b/mate-panel/libpanel-util/panel-dconf.c
new file mode 100644
index 00000000..21830da9
--- /dev/null
+++ b/mate-panel/libpanel-util/panel-dconf.c
@@ -0,0 +1,109 @@
+/*
+ * panel-dconf.c: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Vincent Untz <[email protected]>
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#include <string.h>
+
+#include <dconf.h>
+
+#include "panel-dconf.h"
+
+static DConfClient *
+panel_dconf_client_get (void)
+{
+#ifdef HAVE_DCONF_0_13
+ return dconf_client_new ();
+#else
+ return dconf_client_new (NULL, NULL, NULL, NULL);
+#endif
+}
+
+gboolean
+panel_dconf_write_sync (const gchar *key,
+ GVariant *value,
+ GError **error)
+{
+ gboolean ret;
+ DConfClient *client = panel_dconf_client_get ();
+
+#ifdef HAVE_DCONF_0_13
+ ret = dconf_client_write_sync (client, key, value, NULL, NULL, error);
+#else
+ ret = dconf_client_write (client, key, value, NULL, NULL, error);
+#endif
+
+ g_object_unref (client);
+
+ return ret;
+}
+
+gboolean
+panel_dconf_recursive_reset (const gchar *dir,
+ GError **error)
+{
+ gboolean ret;
+ DConfClient *client = panel_dconf_client_get ();
+
+#ifdef HAVE_DCONF_0_13
+ ret = dconf_client_write_sync (client, dir, NULL, NULL, NULL, error);
+#else
+ ret = dconf_client_write (client, dir, NULL, NULL, NULL, error);
+#endif
+
+ g_object_unref (client);
+
+ return ret;
+}
+
+gchar **
+panel_dconf_list_subdirs (const gchar *dir,
+ gboolean remove_trailing_slash)
+{
+ GArray *array;
+ gchar **children;
+ int len;
+ int i;
+ DConfClient *client = panel_dconf_client_get ();
+
+ array = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+ children = dconf_client_list (client, dir, &len);
+
+ g_object_unref (client);
+
+ for (i = 0; children[i] != NULL; i++) {
+ if (dconf_is_rel_dir (children[i], NULL)) {
+ char *val = g_strdup (children[i]);
+
+ if (remove_trailing_slash)
+ val[strlen (val) - 1] = '\0';
+
+ array = g_array_append_val (array, val);
+ }
+ }
+
+ g_strfreev (children);
+
+ return (gchar **) g_array_free (array, FALSE);
+}
diff --git a/mate-panel/libpanel-util/panel-dconf.h b/mate-panel/libpanel-util/panel-dconf.h
new file mode 100644
index 00000000..e4ef1e45
--- /dev/null
+++ b/mate-panel/libpanel-util/panel-dconf.h
@@ -0,0 +1,44 @@
+/*
+ * panel-dconf.h: helper API for dconf
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Vincent Untz <[email protected]>
+ */
+
+#ifndef __PANEL_DCONF_H__
+#define __PANEL_DCONF_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean panel_dconf_write_sync (const gchar *key,
+ GVariant *value,
+ GError **error);
+
+gboolean panel_dconf_recursive_reset (const gchar *dir,
+ GError **error);
+
+gchar **panel_dconf_list_subdirs (const gchar *dir,
+ gboolean remove_trailing_slash);
+
+G_END_DECLS
+
+#endif /* __PANEL_DCONF_H__ */
diff --git a/mate-panel/main.c b/mate-panel/main.c
index 7721fade..52535542 100644
--- a/mate-panel/main.c
+++ b/mate-panel/main.c
@@ -20,7 +20,6 @@
#include <libpanel-util/panel-cleanup.h>
#include <libpanel-util/panel-glib.h>
-#include "panel-mateconf.h"
#include "panel-profile.h"
#include "panel-config-global.h"
#include "panel-shell.h"
@@ -115,11 +114,6 @@ main (int argc, char **argv)
panel_multiscreen_init ();
panel_init_stock_icons_and_items ();
- mateconf_client_add_dir (panel_mateconf_get_client (),
- "/desktop/mate/interface",
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
-
panel_global_config_load ();
panel_lockdown_init ();
panel_profile_load ();
@@ -143,10 +137,6 @@ main (int argc, char **argv)
panel_lockdown_finalize ();
- mateconf_client_remove_dir (panel_mateconf_get_client (),
- "/desktop/mate/interface",
- NULL);
-
panel_cleanup_do ();
return 0;
diff --git a/mate-panel/mate-desktop-item-edit.c b/mate-panel/mate-desktop-item-edit.c
index f94b9254..4860cf84 100644
--- a/mate-panel/mate-desktop-item-edit.c
+++ b/mate-panel/mate-desktop-item-edit.c
@@ -14,8 +14,6 @@
/* FIXME Symbols needed by panel-util.c - sucky */
#include "applet.h"
GSList *mate_panel_applet_list_applets (void) { return NULL; }
-#include "panel-mateconf.h"
-MateConfClient *panel_mateconf_get_client (void) { return NULL; }
#include "panel-config-global.h"
gboolean panel_global_config_get_tooltips_enabled (void) { return FALSE; }
#include "panel-lockdown.h"
diff --git a/mate-panel/mate-panel-applet-frame.c b/mate-panel/mate-panel-applet-frame.c
index e950d789..b6f6e773 100644
--- a/mate-panel/mate-panel-applet-frame.c
+++ b/mate-panel/mate-panel-applet-frame.c
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
-#include <mateconf/mateconf.h>
+#include <gio/gio.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
@@ -42,7 +42,7 @@
#include "panel-lockdown.h"
#include "panel-stock-icons.h"
#include "xstuff.h"
-#include "panel-compatibility.h"
+#include "panel-schemas.h"
#include "mate-panel-applet-frame.h"
@@ -74,7 +74,7 @@ G_DEFINE_TYPE (MatePanelAppletFrame, mate_panel_applet_frame, GTK_TYPE_EVENT_BOX
#define MATE_PANEL_APPLET_FRAME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET_FRAME, MatePanelAppletFramePrivate))
#define HANDLE_SIZE 10
-#define MATE_PANEL_APPLET_PREFS_KEY "/apps/panel/applets/%s/prefs"
+#define MATE_PANEL_APPLET_PREFS_PATH "/org/mate/panel/objects/%s/prefs/"
struct _MatePanelAppletFramePrivate {
PanelWidget *panel;
@@ -834,7 +834,7 @@ mate_panel_applet_frame_activating_get_locked_down (MatePanelAppletFrameActivati
gchar *
mate_panel_applet_frame_activating_get_conf_path (MatePanelAppletFrameActivating *frame_act)
{
- return g_strdup_printf (MATE_PANEL_APPLET_PREFS_KEY, frame_act->id);
+ return g_strdup_printf (MATE_PANEL_APPLET_PREFS_PATH, frame_act->id);
}
static void
@@ -857,7 +857,7 @@ mate_panel_applet_frame_loading_failed_response (GtkWidget *dialog,
item);
}
- panel_profile_remove_from_list (PANEL_MATECONF_APPLETS, id);
+ panel_profile_remove_from_list (PANEL_GSETTINGS_OBJECTS, id);
}
g_free (id);
@@ -962,17 +962,24 @@ mate_panel_applet_frame_load (const gchar *iid,
}
void
-mate_panel_applet_frame_load_from_mateconf (PanelWidget *panel_widget,
+mate_panel_applet_frame_load_from_gsettings (PanelWidget *panel_widget,
gboolean locked,
int position,
const char *id)
{
+ GSettings *settings;
+ gchar *path;
gchar *applet_iid;
g_return_if_fail (panel_widget != NULL);
g_return_if_fail (id != NULL);
- applet_iid = panel_compatibility_get_applet_iid (id);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ applet_iid = g_settings_get_string (settings, PANEL_OBJECT_APPLET_IID_KEY);
+ g_object_unref (settings);
+ g_free (path);
+
if (!applet_iid) {
mate_panel_applet_stop_loading (id);
return;
@@ -989,20 +996,21 @@ mate_panel_applet_frame_create (PanelToplevel *toplevel,
int position,
const char *iid)
{
- MateConfClient *client;
- const char *key;
+ GSettings *settings;
+ gchar *path;
char *id;
g_return_if_fail (iid != NULL);
- client = panel_mateconf_get_client ();
-
id = panel_profile_prepare_object (PANEL_OBJECT_APPLET, toplevel, position, FALSE);
- key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "applet_iid");
- mateconf_client_set_string (client, key, iid, NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_settings_set_string (settings, PANEL_OBJECT_APPLET_IID_KEY, iid);
- panel_profile_add_to_list (PANEL_MATECONF_APPLETS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
+ g_free (path);
+ g_object_unref (settings);
}
diff --git a/mate-panel/mate-panel-applet-frame.h b/mate-panel/mate-panel-applet-frame.h
index b4e1e1cd..ad5fbc75 100644
--- a/mate-panel/mate-panel-applet-frame.h
+++ b/mate-panel/mate-panel-applet-frame.h
@@ -82,7 +82,7 @@ void mate_panel_applet_frame_create (PanelToplevel *toplevel,
int position,
const char *iid);
-void mate_panel_applet_frame_load_from_mateconf (PanelWidget *panel_widget,
+void mate_panel_applet_frame_load_from_gsettings (PanelWidget *panel_widget,
gboolean locked,
int position,
const char *id);
diff --git a/mate-panel/menu.c b/mate-panel/menu.c
index 8b60058c..48831c43 100644
--- a/mate-panel/menu.c
+++ b/mate-panel/menu.c
@@ -29,7 +29,6 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gdk/gdkkeysyms.h>
-#include <mateconf/mateconf-client.h>
#include <libpanel-util/panel-keyfile.h>
#include <libpanel-util/panel-xdg.h>
@@ -48,6 +47,7 @@
#include "panel-run-dialog.h"
#include "panel-lockdown.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
typedef struct {
GtkWidget *pixmap;
@@ -89,7 +89,12 @@ static gboolean panel_menu_key_press_handler (GtkWidget *widget,
static inline gboolean desktop_is_home_dir(void)
{
- return mateconf_client_get_bool(panel_mateconf_get_client(), "/apps/caja/preferences/desktop_is_home_dir", NULL);
+ gboolean retval;
+ GSettings *settings;
+ settings = g_settings_new (CAJA_PREFS_SCHEMA);
+ retval = g_settings_get_boolean (settings, CAJA_PREFS_DESKTOP_IS_HOME_DIR_KEY);
+ g_object_unref (settings);
+ return retval;
}
GtkWidget *
diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c
index 04536fff..3680ad5f 100644
--- a/mate-panel/panel-action-button.c
+++ b/mate-panel/panel-action-button.c
@@ -31,6 +31,7 @@
#include "panel-action-button.h"
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-launch.h>
@@ -39,7 +40,6 @@
#include "applet.h"
#include "panel-config-global.h"
-#include "panel-mateconf.h"
#include "panel-profile.h"
#include "panel-typebuiltins.h"
#include "panel-force-quit.h"
@@ -49,15 +49,13 @@
#include "panel-run-dialog.h"
#include "panel-a11y.h"
#include "panel-lockdown.h"
-#include "panel-compatibility.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
G_DEFINE_TYPE (PanelActionButton, panel_action_button, BUTTON_TYPE_WIDGET)
#define PANEL_ACTION_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_ACTION_BUTTON, PanelActionButtonPrivate))
-#define LOGOUT_PROMPT_KEY "/apps/mate-session/options/logout_prompt"
-
enum {
PROP_0,
PROP_ACTION_TYPE,
@@ -67,13 +65,25 @@ enum {
struct _PanelActionButtonPrivate {
PanelActionButtonType type;
AppletInfo *info;
-
- guint mateconf_notify;
+ GSettings *settings;
guint dnd_enabled : 1;
};
-static MateConfEnumStringPair panel_action_type_map [] = {
+static void
+panel_action_button_type_changed (GSettings *settings,
+ gchar *key,
+ PanelActionButton *button);
+
+/* Utility function converts enumerations to and from strings */
+typedef struct _ObsoleteEnumStringPair ObsoleteEnumStringPair;
+
+struct _ObsoleteEnumStringPair {
+ gint enum_value;
+ const gchar* str;
+};
+
+static ObsoleteEnumStringPair panel_action_type_map [] = {
{ PANEL_ACTION_NONE, "none" },
{ PANEL_ACTION_LOCK, "lock" },
{ PANEL_ACTION_LOGOUT, "logout" },
@@ -82,11 +92,49 @@ static MateConfEnumStringPair panel_action_type_map [] = {
{ PANEL_ACTION_FORCE_QUIT, "force-quit" },
{ PANEL_ACTION_CONNECT_SERVER, "connect-server" },
{ PANEL_ACTION_SHUTDOWN, "shutdown" },
- /* compatibility with MATE < 2.13.90 */
- { PANEL_ACTION_SCREENSHOT, "screenshot" },
{ 0, NULL },
};
+/* FIXME obsolete way to get string for enum */
+/* taken from deprecated mate-conf code */
+static const gchar*
+obsolete_enum_to_string (ObsoleteEnumStringPair lookup_table[],
+ gint enum_value)
+{
+ int i = 0;
+
+ while (lookup_table[i].str != NULL)
+ {
+ if (lookup_table[i].enum_value == enum_value)
+ return lookup_table[i].str;
+
+ ++i;
+ }
+
+ return NULL;
+}
+
+static gboolean
+obsolete_string_to_enum (ObsoleteEnumStringPair lookup_table[],
+ const gchar* str,
+ gint* enum_value_retloc)
+{
+ int i = 0;
+
+ while (lookup_table[i].str != NULL)
+ {
+ if (g_ascii_strcasecmp (lookup_table[i].str, str) == 0)
+ {
+ *enum_value_retloc = lookup_table[i].enum_value;
+ return TRUE;
+ }
+
+ ++i;
+ }
+
+ return FALSE;
+}
+
/* Lock Screen
*/
static void panel_action_lock_screen(GtkWidget* widget)
@@ -158,17 +206,16 @@ static void
panel_action_logout (GtkWidget *widget)
{
PanelSessionManager *manager;
- gboolean not_prompt;
+ gboolean prompt;
- not_prompt = mateconf_client_get_bool (panel_mateconf_get_client (),
- LOGOUT_PROMPT_KEY, NULL);
- /* this avoids handling errors from mateconf since prompting is
- * safer */
- not_prompt = !not_prompt;
+ GSettings *msm_settings;
+ msm_settings = g_settings_new (MATE_SESSION_SCHEMA);
+ prompt = g_settings_get_boolean (msm_settings, MATE_SESSION_LOGOUT_PROMPT_KEY);
+ g_object_unref (msm_settings);
manager = panel_session_manager_get ();
- if (not_prompt)
+ if (!prompt)
panel_session_manager_request_logout (manager,
PANEL_SESSION_MANAGER_LOGOUT_MODE_NO_CONFIRMATION);
else
@@ -350,31 +397,14 @@ static PanelAction actions [] = {
"ACTION:shutdown:NEW",
panel_action_shutdown, NULL, NULL,
panel_action_shutdown_reboot_is_disabled
- },
- /* deprecated actions */
- {
- PANEL_ACTION_SCREENSHOT,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL
}
};
-static gboolean
-panel_action_get_is_deprecated (PanelActionButtonType type)
-{
- g_return_val_if_fail (type > PANEL_ACTION_NONE && type < PANEL_ACTION_LAST, FALSE);
-
- return (type >= PANEL_ACTION_SCREENSHOT);
-}
-
gboolean
panel_action_get_is_disabled (PanelActionButtonType type)
{
g_return_val_if_fail (type > PANEL_ACTION_NONE && type < PANEL_ACTION_LAST, FALSE);
- if (panel_action_get_is_deprecated (type))
- return TRUE;
-
if (actions [type].is_disabled)
return actions [type].is_disabled ();
@@ -432,16 +462,16 @@ panel_action_button_finalize (GObject *object)
{
PanelActionButton *button = PANEL_ACTION_BUTTON (object);
+ if (button->priv->settings)
+ g_object_unref (button->priv->settings);
+ button->priv->settings = NULL;
+
button->priv->info = NULL;
button->priv->type = PANEL_ACTION_NONE;
panel_lockdown_notify_remove (G_CALLBACK (panel_action_button_update_sensitivity),
button);
- mateconf_client_notify_remove (panel_mateconf_get_client (),
- button->priv->mateconf_notify);
- button->priv->mateconf_notify = 0;
-
G_OBJECT_CLASS (panel_action_button_parent_class)->finalize (object);
}
@@ -512,7 +542,7 @@ panel_action_button_drag_data_get (GtkWidget *widget,
button = PANEL_ACTION_BUTTON (widget);
drag_data = g_strdup_printf ("ACTION:%s:%d",
- mateconf_enum_to_string (panel_action_type_map, button->priv->type),
+ obsolete_enum_to_string (panel_action_type_map, button->priv->type),
panel_find_applet_index (widget));
gtk_selection_data_set (
@@ -592,7 +622,6 @@ panel_action_button_init (PanelActionButton *button)
button->priv->type = PANEL_ACTION_NONE;
button->priv->info = NULL;
- button->priv->mateconf_notify = 0;
button->priv->dnd_enabled = FALSE;
}
@@ -602,9 +631,6 @@ panel_action_button_set_type (PanelActionButton *button,
{
g_return_if_fail (type > PANEL_ACTION_NONE && type < PANEL_ACTION_LAST);
- if (panel_action_get_is_deprecated (type))
- return;
-
if (type == button->priv->type)
return;
@@ -621,39 +647,33 @@ panel_action_button_set_type (PanelActionButton *button,
}
static void
-panel_action_button_type_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- PanelActionButton *button)
+panel_action_button_type_changed (GSettings *settings,
+ gchar *key,
+ PanelActionButton *button)
{
int type;
- const char *action_type;
-
g_return_if_fail (PANEL_IS_ACTION_BUTTON (button));
-
- if (!entry->value || entry->value->type != MATECONF_VALUE_STRING)
- return;
-
- action_type = mateconf_value_get_string (entry->value);
-
- if (!mateconf_string_to_enum (panel_action_type_map, action_type, &type))
- return;
-
+ type = g_settings_get_enum (settings, key);
panel_action_button_set_type (button, type);
}
static void
-panel_action_button_connect_to_mateconf (PanelActionButton *button)
+panel_action_button_connect_to_gsettings (PanelActionButton *button)
{
- const char *key;
+ gchar *settings_path;
+ gchar *signal_name;
+
+ settings_path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", button->priv->info->id);
+ button->priv->settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, settings_path);
- key = panel_mateconf_full_key (
- PANEL_MATECONF_OBJECTS, button->priv->info->id, "action_type");
+ signal_name = g_strdup_printf ("changed::%s", PANEL_OBJECT_ACTION_TYPE_KEY);
+ g_signal_connect (button->priv->settings,
+ signal_name,
+ G_CALLBACK (panel_action_button_type_changed),
+ button);
- button->priv->mateconf_notify =
- mateconf_client_notify_add (panel_mateconf_get_client (), key,
- (MateConfClientNotifyFunc) panel_action_button_type_changed,
- button, NULL, NULL);
+ g_free (signal_name);
+ g_free (settings_path);
panel_lockdown_notify_add (G_CALLBACK (panel_action_button_update_sensitivity),
button);
@@ -672,8 +692,7 @@ panel_action_button_load (PanelActionButtonType type,
gboolean locked,
int position,
gboolean exactpos,
- const char *id,
- gboolean compatibility)
+ const char *id)
{
PanelActionButton *button;
PanelObjectType object_type;
@@ -684,18 +703,6 @@ panel_action_button_load (PanelActionButtonType type,
object_type = PANEL_OBJECT_ACTION;
- if (compatibility)
- { /* Backward compatibility with MATE 2.0.x */
- if (type == PANEL_ACTION_LOCK)
- {
- object_type = PANEL_OBJECT_LOCK;
- }
- else if (type == PANEL_ACTION_LOGOUT)
- {
- object_type = PANEL_OBJECT_LOGOUT;
- }
- }
-
button->priv->info = mate_panel_applet_register (GTK_WIDGET (button),
NULL, NULL,
panel, locked, position,
@@ -717,7 +724,7 @@ panel_action_button_load (PanelActionButtonType type,
if (actions [button->priv->type].setup_menu)
actions [button->priv->type].setup_menu (button);
- panel_action_button_connect_to_mateconf (button);
+ panel_action_button_connect_to_gsettings (button);
g_signal_connect (button, "style-set",
G_CALLBACK (panel_action_button_style_set), NULL);
@@ -728,76 +735,47 @@ panel_action_button_create (PanelToplevel *toplevel,
int position,
PanelActionButtonType type)
{
- MateConfClient *client;
- const char *key;
+ GSettings *settings;
char *id;
-
- client = panel_mateconf_get_client ();
+ char *path;
id = panel_profile_prepare_object (PANEL_OBJECT_ACTION, toplevel, position, FALSE);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "action_type");
- mateconf_client_set_string (client,
- key,
- mateconf_enum_to_string (panel_action_type_map, type),
- NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ g_settings_set_enum (settings,
+ PANEL_OBJECT_ACTION_TYPE_KEY,
+ type);
- g_free (id);
-}
-
-/* This is only for backwards compatibility with 2.0.x
- * We load an old-style lock/logout button as an action
- * button but make sure to retain the lock/logout configuration
- * so logging back into 2.0.x still works.
- */
-void
-panel_action_button_load_compatible (PanelObjectType object_type,
- PanelWidget *panel,
- gboolean locked,
- int position,
- gboolean exactpos,
- const char *id)
-{
- PanelActionButtonType action_type;
-
- g_assert (object_type == PANEL_OBJECT_LOGOUT || object_type == PANEL_OBJECT_LOCK);
-
- action_type = object_type == PANEL_OBJECT_LOGOUT ? PANEL_ACTION_LOGOUT : PANEL_ACTION_LOCK;
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
- panel_action_button_load (action_type, panel, locked, position, exactpos, id, TRUE);
+ g_free (id);
+ g_free (path);
+ g_object_unref (settings);
}
void
-panel_action_button_load_from_mateconf (PanelWidget *panel,
+panel_action_button_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
gboolean exactpos,
const char *id)
{
- int type;
- const char *key;
- char *action_type;
+ GSettings *settings;
+ PanelActionButtonType type;
+ char *path;
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "action_type");
- action_type = mateconf_client_get_string (panel_mateconf_get_client (), key, NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
- if (!mateconf_string_to_enum (panel_action_type_map, action_type, &type)) {
- g_warning ("Unkown action type '%s' from %s", action_type, key);
- g_free (action_type);
- return;
- }
+ type = g_settings_get_enum (settings, PANEL_OBJECT_ACTION_TYPE_KEY);
- g_free (action_type);
+ g_free (path);
+ g_object_unref (settings);
- /* compatibility: migrate from MATE < 2.13.90 */
- if (type == PANEL_ACTION_SCREENSHOT)
- panel_compatibility_migrate_screenshot_action (panel_mateconf_get_client (),
- id);
- else
- panel_action_button_load (type, panel, locked,
- position, exactpos, id, FALSE);
+ panel_action_button_load (type, panel, locked,
+ position, exactpos, id);
}
void
@@ -849,16 +827,13 @@ panel_action_button_load_from_drag (PanelToplevel *toplevel,
return retval;
}
- if (!mateconf_string_to_enum (panel_action_type_map, elements [1], (gpointer) &type)) {
+ if (!obsolete_string_to_enum (panel_action_type_map, elements [1], (gpointer) &type)) {
g_strfreev (elements);
return retval;
}
g_return_val_if_fail (type > PANEL_ACTION_NONE && type < PANEL_ACTION_LAST, FALSE);
- if (panel_action_get_is_deprecated (type))
- return retval;
-
if (strcmp (elements [2], "NEW")) {
*old_applet_idx = strtol (elements [2], NULL, 10);
retval = TRUE; /* Remove the old applet */
diff --git a/mate-panel/panel-action-button.h b/mate-panel/panel-action-button.h
index 7139aef6..bc5e5da1 100644
--- a/mate-panel/panel-action-button.h
+++ b/mate-panel/panel-action-button.h
@@ -65,14 +65,7 @@ void panel_action_button_create (PanelToplevel *toplevel
void panel_action_button_set_type (PanelActionButton *button,
PanelActionButtonType type);
-void panel_action_button_load_from_mateconf (PanelWidget *panel,
- gboolean locked,
- int position,
- gboolean exactpos,
- const char *id);
-
-void panel_action_button_load_compatible (PanelObjectType object_type,
- PanelWidget *panel,
+void panel_action_button_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
gboolean exactpos,
diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c
index 150d83de..81d79ff0 100644
--- a/mate-panel/panel-addto.c
+++ b/mate-panel/panel-addto.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <matemenu-tree.h>
@@ -48,6 +49,7 @@
#include "panel-profile.h"
#include "panel-addto.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
typedef struct {
PanelWidget *panel_widget;
@@ -72,8 +74,6 @@ typedef struct {
gchar *search_text;
gchar *applet_search_text;
- guint name_notify;
-
int insertion_position;
} PanelAddtoDialog;
@@ -939,16 +939,18 @@ panel_addto_dialog_free_application_list (GSList *application_list)
}
static void
+panel_addto_name_notify (GSettings *settings,
+ gchar *key,
+ PanelAddtoDialog *dialog);
+
+static void
panel_addto_dialog_free (PanelAddtoDialog *dialog)
{
- MateConfClient *client;
GSList *item;
- client = panel_mateconf_get_client ();
-
- if (dialog->name_notify)
- mateconf_client_notify_remove (client, dialog->name_notify);
- dialog->name_notify = 0;
+ g_signal_handlers_disconnect_by_func(dialog->panel_widget->toplevel->settings,
+ G_CALLBACK (panel_addto_name_notify),
+ dialog);
if (dialog->search_text)
g_free (dialog->search_text);
@@ -1030,27 +1032,11 @@ panel_addto_name_change (PanelAddtoDialog *dialog,
}
static void
-panel_addto_name_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_addto_name_notify (GSettings *settings,
+ gchar *key,
PanelAddtoDialog *dialog)
{
- MateConfValue *value;
- const char *key;
- const char *text = NULL;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
-
- if (strcmp (key, "name"))
- return;
-
- value = mateconf_entry_get_value (entry);
-
- if (value && value->type == MATECONF_VALUE_STRING)
- text = mateconf_value_get_string (value);
-
- if (text)
- panel_addto_name_change (dialog, text);
+ panel_addto_name_change (dialog, g_settings_get_string (settings, key));
}
static gboolean
@@ -1253,13 +1239,11 @@ panel_addto_dialog_new (PanelWidget *panel_widget)
(GDestroyNotify) panel_addto_dialog_free);
dialog->panel_widget = panel_widget;
- dialog->name_notify =
- panel_profile_toplevel_notify_add (
- dialog->panel_widget->toplevel,
- "name",
- (MateConfClientNotifyFunc) panel_addto_name_notify,
- dialog);
+ g_signal_connect (dialog->panel_widget->toplevel->settings,
+ "changed::" PANEL_TOPLEVEL_NAME_KEY,
+ G_CALLBACK (panel_addto_name_notify),
+ dialog);
dialog->addto_dialog = gtk_dialog_new ();
gtk_dialog_add_button (GTK_DIALOG (dialog->addto_dialog),
diff --git a/mate-panel/panel-bindings.c b/mate-panel/panel-bindings.c
index 5b580005..e0a81945 100644
--- a/mate-panel/panel-bindings.c
+++ b/mate-panel/panel-bindings.c
@@ -28,14 +28,12 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
-#include "panel-mateconf.h"
+#include "panel-schemas.h"
#include "panel-profile.h"
#include "panel-xutils.h"
-#define BINDINGS_PREFIX "/apps/marco/window_keybindings"
-#define MOUSE_MODIFIER_DIR "/apps/marco/general"
-#define MOUSE_MODIFIER_KEY "/apps/marco/general/mouse_button_modifier"
#define DEFAULT_MOUSE_MODIFIER GDK_MOD1_MASK
typedef struct {
@@ -46,15 +44,17 @@ typedef struct {
} PanelBinding;
static gboolean initialised = FALSE;
+static GSettings *marco_settings = NULL;
+static GSettings *marco_keybindings_settings = NULL;
static PanelBinding bindings [] = {
- { "activate_window_menu", "popup-panel-menu", 0, 0 },
- { "toggle_maximized", "toggle-expand", 0, 0 },
- { "maximize", "expand", 0, 0 },
- { "unmaximize", "unexpand", 0, 0 },
- { "toggle_shaded", "toggle-hidden", 0, 0 },
- { "begin_move", "begin-move", 0, 0 },
- { "begin_resize", "begin-resize", 0, 0 },
+ { MARCO_ACTIVATE_WINDOW_MENU_KEY, "popup-panel-menu", 0, 0 },
+ { MARCO_TOGGLE_MAXIMIZED_KEY, "toggle-expand", 0, 0 },
+ { MARCO_MAXIMIZE_KEY, "expand", 0, 0 },
+ { MARCO_UNMAXIMIZE_KEY, "unexpand", 0, 0 },
+ { MARCO_TOGGLE_SHADED_KEY, "toggle-hidden", 0, 0 },
+ { MARCO_BEGIN_MOVE_KEY, "begin-move", 0, 0 },
+ { MARCO_BEGIN_RESIZE_KEY, "begin-resize", 0, 0 },
};
static guint mouse_button_modifier_keymask = DEFAULT_MOUSE_MODIFIER;
@@ -120,25 +120,17 @@ panel_binding_set_entry (PanelBinding *binding,
}
static void
-panel_binding_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- PanelBinding *binding)
+panel_binding_changed (GSettings *settings,
+ gchar *key,
+ PanelBinding *binding)
{
- MateConfValue *value;
-
if (binding->keyval)
panel_binding_clear_entry (binding, NULL);
binding->keyval = 0;
binding->modifiers = 0;
- value = mateconf_entry_get_value (entry);
-
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- panel_binding_set_from_string (binding, mateconf_value_get_string (value));
+ panel_binding_set_from_string (binding, g_settings_get_string (settings, key));
if (!binding->keyval)
return;
@@ -150,16 +142,13 @@ static void
panel_binding_watch (PanelBinding *binding,
const char *key)
{
- GError *error = NULL;
-
- mateconf_client_notify_add (panel_mateconf_get_client (), key,
- (MateConfClientNotifyFunc) panel_binding_changed,
- binding, NULL, &error);
- if (error) {
- g_warning ("Error watching mateconf key '%s': %s",
- key, error->message);
- g_error_free (error);
- }
+ gchar *signal_name;
+ signal_name = g_strdup_printf ("changed::%s", key);
+ g_signal_connect (marco_keybindings_settings,
+ signal_name,
+ G_CALLBACK (panel_binding_changed),
+ binding);
+ g_free (signal_name);
}
static void
@@ -182,95 +171,42 @@ panel_bindings_mouse_modifier_set_from_string (const char *str)
}
static void
-panel_bindings_mouse_modifier_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+panel_bindings_mouse_modifier_changed (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
- MateConfValue *value;
- const char *str;
-
- value = mateconf_entry_get_value (entry);
-
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- str = mateconf_value_get_string (value);
- panel_bindings_mouse_modifier_set_from_string (str);
+ panel_bindings_mouse_modifier_set_from_string (g_settings_get_string (settings, key));
}
static void
panel_bindings_initialise (void)
{
- MateConfClient *client;
- GError *error;
int i;
char *str;
if (initialised)
return;
- client = panel_mateconf_get_client ();
-
- error = NULL;
- mateconf_client_add_dir (client, BINDINGS_PREFIX,
- MATECONF_CLIENT_PRELOAD_ONELEVEL, &error);
- if (error) {
- g_warning ("Error loading mateconf directory '%s': %s",
- BINDINGS_PREFIX, error->message),
- g_error_free (error);
- }
+ marco_settings = g_settings_new (MARCO_SCHEMA);
+ marco_keybindings_settings = g_settings_new (MARCO_KEYBINDINGS_SCHEMA);
for (i = 0; i < G_N_ELEMENTS (bindings); i++) {
- const char *key;
-
- key = panel_mateconf_sprintf ("%s/%s", BINDINGS_PREFIX, bindings [i].key);
-
- error = NULL;
- str = mateconf_client_get_string (client, key, &error);
- if (error) {
- g_warning ("Error getting value for '%s': %s",
- key, error->message);
- g_error_free (error);
- continue;
- }
-
+ str = g_settings_get_string (marco_keybindings_settings, bindings [i].key);
panel_binding_set_from_string (&bindings [i], str);
- panel_binding_watch (&bindings [i], key);
-
+ panel_binding_watch (&bindings [i], bindings [i].key);
g_free (str);
}
/* mouse button modifier */
- error = NULL;
- mateconf_client_add_dir (client, MOUSE_MODIFIER_DIR,
- MATECONF_CLIENT_PRELOAD_NONE, &error);
- if (error) {
- g_warning ("Error loading mateconf directory '%s': %s",
- MOUSE_MODIFIER_DIR, error->message),
- g_error_free (error);
- }
- error = NULL;
- mateconf_client_notify_add (client, MOUSE_MODIFIER_KEY,
- panel_bindings_mouse_modifier_changed,
- NULL, NULL, &error);
- if (error) {
- g_warning ("Error watching mateconf key '%s': %s",
- MOUSE_MODIFIER_KEY, error->message);
- g_error_free (error);
- }
+ g_signal_connect (marco_settings,
+ "changed::" MARCO_MOUSE_BUTTON_MODIFIER_KEY,
+ G_CALLBACK (panel_bindings_mouse_modifier_changed),
+ NULL);
- error = NULL;
- str = mateconf_client_get_string (client, MOUSE_MODIFIER_KEY, &error);
- if (error) {
- g_warning ("Error getting value for '%s': %s",
- MOUSE_MODIFIER_KEY, error->message);
- g_error_free (error);
- } else {
- panel_bindings_mouse_modifier_set_from_string (str);
- g_free (str);
- }
+ str = g_settings_get_string (marco_settings, MARCO_MOUSE_BUTTON_MODIFIER_KEY);
+ panel_bindings_mouse_modifier_set_from_string (str);
+ g_free (str);
initialised = TRUE;
}
diff --git a/mate-panel/panel-compatibility.c b/mate-panel/panel-compatibility.c
deleted file mode 100644
index a746f695..00000000
--- a/mate-panel/panel-compatibility.c
+++ /dev/null
@@ -1,1167 +0,0 @@
-/*
- * panel-compatibility.c: panel backwards compatibility support
- *
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Mark McLoughlin <[email protected]>
- */
-
-#include <config.h>
-
-#include "string.h"
-
-#include <libpanel-util/panel-glib.h>
-
-#include "panel-compatibility.h"
-
-#include "panel-profile.h"
-#include "panel-menu-bar.h"
-#include "mate-panel-applet-frame.h"
-#include "mate-panel-applets-manager.h"
-#include "panel-globals.h"
-#include "panel-util.h"
-
-typedef enum {
- PANEL_ORIENT_UP,
- PANEL_ORIENT_DOWN,
- PANEL_ORIENT_LEFT,
- PANEL_ORIENT_RIGHT,
-} PanelOrient;
-
-static MateConfEnumStringPair panel_orient_map [] = {
- { PANEL_ORIENT_UP, "panel-orient-up" },
- { PANEL_ORIENT_DOWN, "panel-orient-down" },
- { PANEL_ORIENT_LEFT, "panel-orient-left" },
- { PANEL_ORIENT_RIGHT, "panel-orient-right" },
- { 0, NULL }
-};
-
-static gboolean
-panel_compatibility_map_orient_string (const char *str,
- PanelOrient *orient)
-{
- int mapped;
-
- g_return_val_if_fail (orient != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_orient_map, str, &mapped))
- return FALSE;
-
- *orient = mapped;
-
- return TRUE;
-}
-
-static MateConfEnumStringPair panel_orientation_map [] = {
- { GTK_ORIENTATION_HORIZONTAL, "panel-orientation-horizontal" },
- { GTK_ORIENTATION_VERTICAL, "panel-orientation-vertical" },
- { 0, NULL }
-};
-
-
-static gboolean
-panel_compatibility_map_orientation_string (const char *str,
- GtkOrientation *orientation)
-{
- int mapped;
-
- g_return_val_if_fail (orientation != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_orientation_map, str, &mapped))
- return FALSE;
-
- *orientation = mapped;
-
- return TRUE;
-}
-
-typedef enum {
- BORDER_TOP,
- BORDER_RIGHT,
- BORDER_BOTTOM,
- BORDER_LEFT
-} BorderEdge;
-
-static MateConfEnumStringPair panel_edge_map [] = {
- { BORDER_TOP, "panel-edge-top" },
- { BORDER_RIGHT, "panel-edge-right" },
- { BORDER_BOTTOM, "panel-edge-bottom" },
- { BORDER_LEFT, "panel-edge-left" },
- { 0, NULL }
-};
-
-static gboolean
-panel_compatibility_map_edge_string (const char *str,
- BorderEdge *edge)
-{
- int mapped;
-
- g_return_val_if_fail (edge != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_edge_map, str, &mapped))
- return FALSE;
-
- *edge = mapped;
-
- return TRUE;
-}
-
-typedef enum {
- EDGE_PANEL,
- DRAWER_PANEL,
- ALIGNED_PANEL,
- SLIDING_PANEL,
- FLOATING_PANEL,
- MENU_PANEL
-} PanelType;
-
-static MateConfEnumStringPair panel_type_map [] = {
- { EDGE_PANEL, "edge-panel" },
- { DRAWER_PANEL, "drawer-panel" },
- { ALIGNED_PANEL, "aligned-panel" },
- { SLIDING_PANEL, "sliding-panel" },
- { FLOATING_PANEL, "floating-panel" },
- { MENU_PANEL, "menu-panel" },
- { 0, NULL }
-};
-
-static gboolean
-panel_compatibility_map_panel_type_string (const char *str,
- PanelType *type)
-{
- int mapped;
-
- g_return_val_if_fail (type != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_type_map, str, &mapped))
- return FALSE;
-
- *type = mapped;
-
- return TRUE;
-}
-
-enum {
- PANEL_SIZE_XX_SMALL = 12,
- PANEL_SIZE_X_SMALL = 24,
- PANEL_SIZE_SMALL = 36,
- PANEL_SIZE_MEDIUM = 48,
- PANEL_SIZE_LARGE = 64,
- PANEL_SIZE_X_LARGE = 80,
- PANEL_SIZE_XX_LARGE = 128
-};
-
-static MateConfEnumStringPair panel_size_map [] = {
- { PANEL_SIZE_XX_SMALL, "panel-size-xx-small" },
- { PANEL_SIZE_X_SMALL, "panel-size-x-small" },
- { PANEL_SIZE_SMALL, "panel-size-small" },
- { PANEL_SIZE_MEDIUM, "panel-size-medium" },
- { PANEL_SIZE_LARGE, "panel-size-large" },
- { PANEL_SIZE_X_LARGE, "panel-size-x-large" },
- { PANEL_SIZE_XX_LARGE, "panel-size-xx-large" },
- { 0, NULL }
-};
-
-static gboolean
-panel_compatibility_map_panel_size_string (const char *str,
- int *size)
-{
- int mapped;
-
- g_return_val_if_fail (size != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_size_map, str, &mapped))
- return FALSE;
-
- *size = mapped;
-
- return TRUE;
-}
-
-static MateConfEnumStringPair panel_background_type_map [] = {
- { PANEL_BACK_NONE, "no-background" },
- { PANEL_BACK_COLOR, "color-background" },
- { PANEL_BACK_IMAGE, "pixmap-background" },
- { 0, NULL }
-};
-
-static gboolean
-panel_compatibility_map_background_type_string (const char *str,
- PanelBackgroundType *type)
-{
- int mapped;
-
- g_return_val_if_fail (type != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_background_type_map, str, &mapped))
- return FALSE;
-
- *type = mapped;
-
- return TRUE;
-}
-
-static void
-panel_compatibility_migrate_background_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- PanelBackgroundType type;
- const char *key;
- char *background_dir;
- char *type_str;
- char *color_str;
- char *image_str;
- gboolean fit;
- gboolean stretch;
- gboolean rotate;
- int opacity;
-
- background_dir = mateconf_concat_dir_and_key (toplevel_dir, "background");
-
- /* panel_background_type -> background/type */
- key = panel_mateconf_sprintf ("%s/panel_background_type", panel_dir);
- type_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_compatibility_map_background_type_string (type_str, &type)) {
- key = panel_mateconf_sprintf ("%s/type", background_dir);
- mateconf_client_set_string (client,
- key,
- panel_profile_map_background_type (type),
- NULL);
- }
-
- g_free (type_str);
-
- /* panel_background_color -> background/color */
- key = panel_mateconf_sprintf ("%s/panel_background_color", panel_dir);
- color_str = mateconf_client_get_string (client, key, NULL);
-
- if (color_str) {
- key = panel_mateconf_sprintf ("%s/color", background_dir);
- mateconf_client_set_string (client, key, color_str, NULL);
- }
-
- g_free (color_str);
-
- /* panel_background_color_alpha -> background/opacity */
- key = panel_mateconf_sprintf ("%s/panel_background_color_alpha", panel_dir);
- opacity = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/opacity", background_dir);
- mateconf_client_set_int (client, key, opacity, NULL);
-
- /* panel_background_pixmap -> background/image */
- key = panel_mateconf_sprintf ("%s/panel_background_pixmap", panel_dir);
- image_str = mateconf_client_get_string (client, key, NULL);
-
- if (image_str) {
- key = panel_mateconf_sprintf ("%s/image", background_dir);
- mateconf_client_set_string (client, key, image_str, NULL);
- }
-
- g_free (image_str);
-
- /* panel_background_pixmap_fit -> background/fit */
- key = panel_mateconf_sprintf ("%s/panel_background_pixmap_fit", panel_dir);
- fit = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/fit", background_dir);
- mateconf_client_set_bool (client, key, fit, NULL);
-
- /* panel_background_pixmap_stretch -> background/stretch */
- key = panel_mateconf_sprintf ("%s/panel_background_pixmap_stretch", panel_dir);
- stretch = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/stretch", background_dir);
- mateconf_client_set_bool (client, key, stretch, NULL);
-
- /* panel_background_pixmap_rotate -> background/rotate */
- key = panel_mateconf_sprintf ("%s/panel_background_pixmap_rotate", panel_dir);
- rotate = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/rotate", background_dir);
- mateconf_client_set_bool (client, key, rotate, NULL);
-
- g_free (background_dir);
-}
-
-static void
-panel_compatibility_migrate_edge_setting (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- BorderEdge edge;
- const char *key;
- char *edge_str;
-
- key = panel_mateconf_sprintf ("%s/screen_edge", panel_dir);
- edge_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_compatibility_map_edge_string (edge_str, &edge)) {
- PanelOrientation orientation;
-
- switch (edge) {
- case BORDER_TOP:
- orientation = PANEL_ORIENTATION_TOP;
- break;
- case BORDER_BOTTOM:
- orientation = PANEL_ORIENTATION_BOTTOM;
- break;
- case BORDER_LEFT:
- orientation = PANEL_ORIENTATION_LEFT;
- break;
- case BORDER_RIGHT:
- orientation = PANEL_ORIENTATION_RIGHT;
- break;
- default:
- orientation = 0;
- g_assert_not_reached ();
- break;
- }
-
- key = panel_mateconf_sprintf ("%s/orientation", toplevel_dir);
- mateconf_client_set_string (client,
- key,
- panel_profile_map_orientation (orientation),
- NULL);
- }
-
- g_free (edge_str);
-}
-
-static void
-panel_compatibility_migrate_edge_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- const char *key;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, TRUE, NULL);
-
- panel_compatibility_migrate_edge_setting (client, toplevel_dir, panel_dir);
-}
-
-static void
-panel_compatibility_migrate_drawer_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- PanelOrient orient;
- const char *key;
- char *orient_str;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, FALSE, NULL);
-
- key = panel_mateconf_sprintf ("%s/panel_orient", panel_dir);
- orient_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_compatibility_map_orient_string (orient_str, &orient)) {
- PanelOrientation orientation;
-
- switch (orient) {
- case PANEL_ORIENT_DOWN:
- orientation = PANEL_ORIENTATION_TOP;
- break;
- case PANEL_ORIENT_UP:
- orientation = PANEL_ORIENTATION_BOTTOM;
- break;
- case PANEL_ORIENT_RIGHT:
- orientation = PANEL_ORIENTATION_LEFT;
- break;
- case PANEL_ORIENT_LEFT:
- orientation = PANEL_ORIENTATION_RIGHT;
- break;
- default:
- orientation = 0;
- g_assert_not_reached ();
- break;
- }
-
- key = panel_mateconf_sprintf ("%s/orientation", toplevel_dir);
- mateconf_client_set_string (client,
- key,
- panel_profile_map_orientation (orientation),
- NULL);
- }
-
- g_free (orient_str);
-}
-
-static void
-panel_compatibility_migrate_corner_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-
-{
- const char *key;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, FALSE, NULL);
-
- /* screen edge */
- panel_compatibility_migrate_edge_setting (client, toplevel_dir, panel_dir);
-
- g_warning ("FIXME: implement migrating the 'panel_align' setting");
-}
-
-static void
-panel_compatibility_migrate_sliding_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- const char *key;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, FALSE, NULL);
-
- /* screen edge */
- panel_compatibility_migrate_edge_setting (client, toplevel_dir, panel_dir);
-
- g_warning ("FIXME: implement migrating the 'panel_anchor' and 'panel_offset' settings");
-}
-
-static void
-panel_compatibility_migrate_floating_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- GtkOrientation orientation;
- const char *key;
- char *orientation_str;
- int x, y;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, FALSE, NULL);
-
- key = panel_mateconf_sprintf ("%s/panel_orient", panel_dir);
- orientation_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_compatibility_map_orientation_string (orientation_str, &orientation)) {
- PanelOrientation panel_orientation;
-
- switch (orientation) {
- case GTK_ORIENTATION_HORIZONTAL:
- panel_orientation = PANEL_ORIENTATION_TOP;
- break;
- case GTK_ORIENTATION_VERTICAL:
- panel_orientation = PANEL_ORIENTATION_LEFT;
- break;
- default:
- panel_orientation = 0;
- g_assert_not_reached ();
- break;
- }
-
- key = panel_mateconf_sprintf ("%s/orientation", toplevel_dir);
- mateconf_client_set_string (client,
- key,
- panel_profile_map_orientation (panel_orientation),
- NULL);
- }
-
- g_free (orientation_str);
-
- /* x */
- key = panel_mateconf_sprintf ("%s/panel_x_position", panel_dir);
- x = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/x", toplevel_dir);
- mateconf_client_set_int (client, key, x, NULL);
-
- /* y */
- key = panel_mateconf_sprintf ("%s/panel_y_position", panel_dir);
- y = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/y", toplevel_dir);
- mateconf_client_set_int (client, key, y, NULL);
-}
-
-static void
-panel_compatibility_migrate_menu_panel_settings (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir)
-{
- const char *key;
- const char *toplevel_id;
- char *id;
-
- key = panel_mateconf_sprintf ("%s/expand", toplevel_dir);
- mateconf_client_set_bool (client, key, TRUE, NULL);
-
- key = panel_mateconf_sprintf ("%s/orientation", toplevel_dir);
- mateconf_client_set_string (client, key,
- panel_profile_map_orientation (PANEL_ORIENTATION_TOP),
- NULL);
-
- toplevel_id = panel_mateconf_basename (toplevel_dir);
-
- /* menu bar on far right corner */
- id = panel_profile_prepare_object_with_id (PANEL_OBJECT_MENU_BAR, toplevel_id, 0, FALSE);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
- g_free (id);
-
- /* window menu on far left corner */
- id = panel_profile_prepare_object_with_id (PANEL_OBJECT_APPLET, toplevel_id, 0, TRUE);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "matecomponent_iid");
- mateconf_client_set_string (client, key, "OAFIID:MATE_WindowMenuApplet", NULL);
-
- panel_profile_add_to_list (PANEL_MATECONF_APPLETS, id);
- g_free (id);
-}
-
-static void
-panel_compatibility_migrate_panel_type (MateConfClient *client,
- const char *toplevel_dir,
- const char *panel_dir,
- gboolean *is_drawer)
-{
- PanelType type;
- const char *key;
- char *type_str;
-
- key = panel_mateconf_sprintf ("%s/panel_type", panel_dir);
- type_str = mateconf_client_get_string (client, key, NULL);
-
- if (!panel_compatibility_map_panel_type_string (type_str, &type)) {
- g_free (type_str);
- return;
- }
-
- g_free (type_str);
-
- switch (type) {
- case EDGE_PANEL:
- panel_compatibility_migrate_edge_panel_settings (client, toplevel_dir, panel_dir);
- break;
- case DRAWER_PANEL:
- panel_compatibility_migrate_drawer_panel_settings (client, toplevel_dir, panel_dir);
- *is_drawer = TRUE;
- break;
- case ALIGNED_PANEL:
- panel_compatibility_migrate_corner_panel_settings (client, toplevel_dir, panel_dir);
- break;
- case SLIDING_PANEL:
- panel_compatibility_migrate_sliding_panel_settings (client, toplevel_dir, panel_dir);
- break;
- case FLOATING_PANEL:
- panel_compatibility_migrate_floating_panel_settings (client, toplevel_dir, panel_dir);
- break;
- case MENU_PANEL:
- panel_compatibility_migrate_menu_panel_settings (client, toplevel_dir, panel_dir);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-static char *
-panel_compatibility_migrate_panel_settings (MateConfClient *client,
- GSList *toplevel_id_list,
- const char *panel_id,
- gboolean *is_drawer)
-{
- const char *key;
- char *toplevel_id;
- char *toplevel_dir;
- char *panel_dir;
- char *size_str;
- int screen;
- int monitor;
- int size;
- gboolean enable_buttons;
- gboolean enable_arrows;
- gboolean auto_hide;
-
- toplevel_id = panel_profile_find_new_id (PANEL_MATECONF_TOPLEVELS);
-
- toplevel_dir = g_strdup_printf (PANEL_CONFIG_DIR "/toplevels/%s", toplevel_id);
- panel_dir = g_strdup_printf (PANEL_CONFIG_DIR "/panels/%s", panel_id);
-
- panel_mateconf_associate_schemas_in_dir (
- client, toplevel_dir, PANEL_SCHEMAS_DIR "/toplevels");
-
- /* screen */
- key = panel_mateconf_sprintf ("%s/screen", panel_dir);
- screen = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/screen", toplevel_dir);
- mateconf_client_set_int (client, key, screen, NULL);
-
- /* monitor */
- key = panel_mateconf_sprintf ("%s/monitor", panel_dir);
- monitor = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/monitor", toplevel_dir);
- mateconf_client_set_int (client, key, monitor, NULL);
-
- /* size */
- key = panel_mateconf_sprintf ("%s/panel_size", panel_dir);
- size_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_compatibility_map_panel_size_string (size_str, &size)) {
- key = panel_mateconf_sprintf ("%s/size", toplevel_dir);
- mateconf_client_set_int (client, key, size, NULL);
- }
-
- g_free (size_str);
-
- /* enable_buttons */
- key = panel_mateconf_sprintf ("%s/hide_buttons_enabled", panel_dir);
- enable_buttons = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/enable_buttons", toplevel_dir);
- mateconf_client_set_bool (client, key, enable_buttons, NULL);
-
- /* enable_arrows */
- key = panel_mateconf_sprintf ("%s/hide_button_pixmaps_enabled", panel_dir);
- enable_arrows = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/enable_arrows", toplevel_dir);
- mateconf_client_set_bool (client, key, enable_arrows, NULL);
-
- /* auto hide */
- key = panel_mateconf_sprintf ("%s/panel_hide_mode", panel_dir);
- auto_hide = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/auto_hide", toplevel_dir);
- mateconf_client_set_bool (client, key, auto_hide, NULL);
-
- /* migrate different panel types to toplevels */
- panel_compatibility_migrate_panel_type (client, toplevel_dir, panel_dir, is_drawer);
-
- /* background settings */
- panel_compatibility_migrate_background_settings (client, toplevel_dir, panel_dir);
-
- g_free (toplevel_dir);
- g_free (panel_dir);
-
- return toplevel_id;
-}
-
-static gboolean
-panel_compatibility_migrate_panel_id (MateConfClient *client,
- PanelMateConfKeyType key_type,
- const char *object_id,
- GHashTable *panel_id_hash)
-{
- const char *key;
- char *panel_id;
- char *toplevel_id;
- gboolean retval = FALSE;
-
- /* panel_id -> toplevel_id */
- key = panel_mateconf_full_key (key_type, object_id, "panel_id");
- panel_id = mateconf_client_get_string (client, key, NULL);
-
- if (panel_id && (toplevel_id = g_hash_table_lookup (panel_id_hash, panel_id))) {
- key = panel_mateconf_full_key (key_type, object_id, "toplevel_id");
- mateconf_client_set_string (client, key, toplevel_id, NULL);
-
- retval = TRUE;
- }
-
- g_free (panel_id);
-
- return retval;
-}
-
-static void
-panel_compatibility_migrate_drawer_settings (MateConfClient *client,
- PanelMateConfKeyType key_type,
- const char *object_id,
- GHashTable *panel_id_hash)
-{
- const char *key;
- char *toplevel_id;
- char *panel_id;
- char *custom_icon;
- char *pixmap;
-
- /* unique-drawer-panel-id -> attached_toplevel_id */
- key = panel_mateconf_full_key (key_type, object_id, "attached_toplevel_id");
- toplevel_id = mateconf_client_get_string (client, key, NULL);
-
- key = panel_mateconf_full_key (key_type, object_id, "unique-drawer-panel-id");
- panel_id = mateconf_client_get_string (client, key, NULL);
-
- if (!toplevel_id && panel_id &&
- (toplevel_id = g_hash_table_lookup (panel_id_hash, panel_id))) {
- key = panel_mateconf_full_key (key_type, object_id, "attached_toplevel_id");
- mateconf_client_set_string (client, key, toplevel_id, NULL);
-
- toplevel_id = NULL;
- }
-
- /* pixmap -> custom_icon */
- key = panel_mateconf_full_key (key_type, object_id, "custom_icon");
- custom_icon = mateconf_client_get_string (client, key, NULL);
-
- key = panel_mateconf_full_key (key_type, object_id, "pixmap");
- pixmap = mateconf_client_get_string (client, key, NULL);
-
- if (!custom_icon && pixmap) {
- key = panel_mateconf_full_key (key_type, object_id, "custom_icon");
- mateconf_client_set_string (client, key, pixmap, NULL);
-
- key = panel_mateconf_full_key (key_type, object_id, "use_custom_icon");
- mateconf_client_set_bool (client, key, TRUE, NULL);
- }
-
- g_free (toplevel_id);
- g_free (panel_id);
- g_free (custom_icon);
- g_free (pixmap);
-}
-
-static void
-panel_compatibility_migrate_menu_button_settings (MateConfClient *client,
- PanelMateConfKeyType key_type,
- const char *object_id)
-{
- const char *key;
- gboolean use_custom_icon;
- gboolean use_menu_path;
- char *custom_icon;
- char *menu_path;
-
- /* custom-icon -> use_custom_icon */
- key = panel_mateconf_full_key (key_type, object_id, "custom-icon");
- use_custom_icon = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_full_key (key_type, object_id, "use_custom_icon");
- mateconf_client_set_bool (client, key, use_custom_icon, NULL);
-
- /* custom-icon-file -> custom_icon */
- key = panel_mateconf_full_key (key_type, object_id, "custom-icon-file");
- custom_icon = mateconf_client_get_string (client, key, NULL);
-
- if (custom_icon) {
- key = panel_mateconf_full_key (key_type, object_id, "custom_icon");
- mateconf_client_set_string (client, key, custom_icon, NULL);
- }
-
- /* main_menu -> ! use_menu_path */
- key = panel_mateconf_full_key (key_type, object_id, "main-menu");
- use_menu_path = ! mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_full_key (key_type, object_id, "use_menu_path");
- mateconf_client_set_bool (client, key, use_menu_path, NULL);
-
- /* path -> menu_path */
- key = panel_mateconf_full_key (key_type, object_id, "path");
- menu_path = mateconf_client_get_string (client, key, NULL);
-
- if (menu_path) {
- key = panel_mateconf_full_key (key_type, object_id, "menu_path");
- mateconf_client_set_string (client, key, menu_path, NULL);
- }
-
- g_free (custom_icon);
- g_free (menu_path);
-}
-
-static void
-panel_compatibility_migrate_objects (MateConfClient *client,
- PanelMateConfKeyType key_type,
- GHashTable *panel_id_hash)
-{
- const char *key;
- GSList *l, *objects;
-
- key = panel_mateconf_general_key (panel_mateconf_key_type_to_id_list (key_type));
- objects = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- for (l = objects; l; l = l->next) {
- const char *id = l->data;
- PanelObjectType object_type;
- char *object_type_str;
-
- if (!panel_compatibility_migrate_panel_id (client, key_type, id, panel_id_hash)) {
- g_free (l->data);
- continue;
- }
-
- key = panel_mateconf_full_key (key_type, id, "object_type");
- object_type_str = mateconf_client_get_string (client, key, NULL);
-
- if (panel_profile_map_object_type_string (object_type_str, &object_type)) {
- switch (object_type) {
- case PANEL_OBJECT_DRAWER:
- panel_compatibility_migrate_drawer_settings (
- client, key_type, id, panel_id_hash);
- break;
- case PANEL_OBJECT_MENU:
- panel_compatibility_migrate_menu_button_settings (
- client, key_type, id);
- break;
- default:
- break;
- }
- }
- g_free (object_type_str);
- g_free (l->data);
- }
- g_slist_free (objects);
-}
-
-/* Major hack, but we now set toplevel_id_list in the defaults database,
- * so we need to figure out if its actually set in the users database.
- */
-
-static MateConfEngine *
-get_homedir_source (void)
-{
- MateConfEngine *engine;
- GError *error = NULL;
- char *source;
-
- source = g_strdup_printf ("xml:readwrite:%s/.mateconf", g_get_home_dir ());
-
- if (!(engine = mateconf_engine_get_for_address (source, &error))) {
-#if 0
- g_warning ("Cannot get MateConf source '%s': %s\n",
- source, error->message);
-#endif
- g_error_free (error);
- g_free (source);
- return NULL;
- }
-
- g_free (source);
-
- return engine;
-}
-
-static gboolean
-is_general_key_set (MateConfEngine *engine,
- const char *config_dir,
- const char *general_key)
-{
- MateConfEntry *entry;
- const char *key;
- gboolean retval;
-
- key = panel_mateconf_sprintf ("%s/general/%s", config_dir, general_key);
-
- if (!(entry = mateconf_engine_get_entry (engine, key, NULL, FALSE, NULL)))
- return FALSE;
-
- retval = mateconf_entry_get_value (entry) != NULL ||
- mateconf_entry_get_schema_name (entry) != NULL;
-
- mateconf_entry_unref (entry);
-
- return retval;
-}
-
-static gboolean
-panel_compatibility_detect_needs_migration (void)
-{
- MateConfEngine *engine;
- gboolean needs_migration = FALSE;
-
- if (!(engine = get_homedir_source ()))
- return FALSE;
-
- if (!is_general_key_set (engine, PANEL_CONFIG_DIR, "panel_id_list"))
- goto no_migration;
-
- if (is_general_key_set (engine, PANEL_CONFIG_DIR, "toplevel_id_list"))
- goto no_migration;
-
- needs_migration = TRUE;
-
- no_migration:
- mateconf_engine_unref (engine);
-
- return needs_migration;
-}
-
-/* If toplevel_id_list is unset, migrate all the panels in
- * panel_id_list to toplevels
- */
-void
-panel_compatibility_migrate_panel_id_list (MateConfClient *client)
-{
- GHashTable *panel_id_hash;
- const char *key;
- GSList *panel_id_list;
- GSList *toplevel_id_list = NULL;
- GSList *l;
-
- if (!panel_compatibility_detect_needs_migration ())
- return;
-
- panel_id_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
- key = panel_mateconf_general_key ("panel_id_list");
- panel_id_list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- for (l = panel_id_list; l; l = l->next) {
- char *new_id;
- gboolean is_drawer = FALSE;
-
- new_id = panel_compatibility_migrate_panel_settings (client,
- toplevel_id_list,
- l->data,
- &is_drawer);
-
- /* Drawer toplevels don't belong on the toplevel list */
- if (!is_drawer)
- toplevel_id_list = g_slist_prepend (toplevel_id_list, new_id);
-
- g_hash_table_insert (panel_id_hash, l->data, new_id);
- }
-
- key = panel_mateconf_general_key ("toplevel_id_list");
- mateconf_client_set_list (client, key, MATECONF_VALUE_STRING, toplevel_id_list, NULL);
-
- g_slist_free (panel_id_list);
- g_slist_free (toplevel_id_list);
-
- panel_compatibility_migrate_objects (client, PANEL_MATECONF_OBJECTS, panel_id_hash);
- panel_compatibility_migrate_objects (client, PANEL_MATECONF_APPLETS, panel_id_hash);
-
- g_hash_table_destroy (panel_id_hash);
-}
-
-static void
-copy_mateconf_dir (MateConfClient *client,
- const char *src_dir,
- const char *dest_dir)
-{
- GSList *list, *l;
-
- list = mateconf_client_all_entries (client, src_dir, NULL);
- for (l = list; l; l = l->next) {
- MateConfEntry *entry = l->data;
- const char *key;
- char *tmp;
-
- tmp = g_path_get_basename (mateconf_entry_get_key (entry));
- key = panel_mateconf_sprintf ("%s/%s", dest_dir, tmp);
- g_free (tmp);
-
- if (mateconf_entry_get_schema_name (entry))
- mateconf_engine_associate_schema (client->engine,
- key,
- mateconf_entry_get_schema_name (entry),
- NULL);
-
- if (entry->value)
- mateconf_client_set (client, key, entry->value, NULL);
-
- mateconf_entry_unref (entry);
- }
- g_slist_free (list);
-
- list = mateconf_client_all_dirs (client, src_dir, NULL);
- for (l = list; l; l = l->next) {
- char *subdir = l->data;
- char *src_subdir;
- char *dest_subdir;
- char *tmp;
-
- tmp = g_path_get_basename (subdir);
- src_subdir = mateconf_concat_dir_and_key (src_dir, tmp);
- dest_subdir = mateconf_concat_dir_and_key (dest_dir, tmp);
- g_free (tmp);
-
- copy_mateconf_dir (client, src_subdir, dest_subdir);
-
- g_free (src_subdir);
- g_free (dest_subdir);
- g_free (subdir);
- }
-
- g_slist_free (list);
-}
-
-void
-panel_compatibility_maybe_copy_old_config (MateConfClient *client)
-{
- MateConfEngine *engine;
- const char *key;
-
- key = panel_mateconf_general_key ("profiles_migrated");
- if (mateconf_client_get_bool (client, key, NULL))
- return;
-
- if (!(engine = get_homedir_source ()))
- goto no_migration_needed;;
-
- if (!is_general_key_set (engine, PANEL_OLD_CONFIG_DIR, "panel_id_list") &&
- !is_general_key_set (engine, PANEL_OLD_CONFIG_DIR, "toplevel_id_list") &&
- !is_general_key_set (engine, PANEL_OLD_CONFIG_DIR, "applet_id_list") &&
- !is_general_key_set (engine, PANEL_OLD_CONFIG_DIR, "object_id_list"))
- goto no_migration_needed;
-
- copy_mateconf_dir (client, PANEL_OLD_CONFIG_DIR, PANEL_CONFIG_DIR);
-
- key = panel_mateconf_general_key ("profiles_migrated");
- mateconf_client_set_bool (client, key, TRUE, NULL);
-
- no_migration_needed:
- if (engine)
- mateconf_engine_unref (engine);
-}
-
-void
-panel_compatibility_migrate_applications_scheme (MateConfClient *client,
- const char *key)
-{
- char *location;
-
- location = mateconf_client_get_string (client, key, NULL);
-
- if (!location)
- return;
-
- if (!strncmp (location, "applications:", strlen ("applications:")) ||
- !strncmp (location, "applications-all-users:", strlen ("applications-all-users:")) ||
- !strncmp (location, "all-applications:", strlen ("all-applications:")) ||
- !strncmp (location, "preferences:", strlen ("preferences:")) ||
- !strncmp (location, "preferences-all-users:", strlen ("preferences-all-users:")) ||
- !strncmp (location, "all-preferences:", strlen ("all-preferences:")) ||
- !strncmp (location, "system-settings:", strlen ("system-settings:")) ||
- !strncmp (location, "server-settings:", strlen ("server-settings:"))) {
- char *basename;
- char *new_location;
-
- basename = g_path_get_basename (location);
- new_location = panel_g_lookup_in_applications_dirs (basename);
- g_free (basename);
-
- if (new_location != NULL) {
- mateconf_client_set_string (client, key,
- new_location, NULL);
- g_free (new_location);
- }
- }
-
- g_free (location);
-}
-
-void
-panel_compatibility_migrate_screenshot_action (MateConfClient *client,
- const char *id)
-{
- const char *key;
-
- panel_profile_remove_from_list (PANEL_MATECONF_OBJECTS, id);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id,
- "launcher_location");
- mateconf_client_set_string (client, key, "mate-screenshot.desktop", NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id,
- "object_type");
- //FIXME: ideally, we would use panel_object_type_map, but it's private
- //in panel-profile.c
- mateconf_client_set_string (client, key, "launcher-object", NULL);
-
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
-}
-
-gchar *
-panel_compatibility_get_applet_iid (const gchar *id)
-{
- MateConfClient *client = panel_mateconf_get_client ();
- MatePanelAppletInfo *info;
- const char *key;
- gchar *applet_iid;
- gboolean needs_migration;
- const char *iid;
-
- /*
- * There are two compatibility steps here:
- *
- * 1) we need to migrate from matecomponent_iid to applet_iid if there's no
- * value in the applet_iid key. Always.
- *
- * 2) we need to try to migrate the iid to a new iid. We can't assume
- * that the fact that the applet_iid key was used mean anything
- * since the value there could well be a matecomponent iid.
- * The reason we really have to try to migrate first is this case:
- * if an applet was added with the matecomponent iid but gets ported later
- * to dbus, then the reference to the matecomponent iid will only be valid
- * as an old reference.
- * And if migration fails, we just use the iid as it is.
- */
-
- needs_migration = FALSE;
-
- key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "applet_iid");
- applet_iid = mateconf_client_get_string (client, key, NULL);
-
- if (!applet_iid || !applet_iid[0]) {
- needs_migration = TRUE;
-
- key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "matecomponent_iid");
- applet_iid = mateconf_client_get_string (client, key, NULL);
-
- if (!applet_iid || !applet_iid[0])
- return NULL;
- }
-
- info = mate_panel_applets_manager_get_applet_info_from_old_id (applet_iid);
- if (!info)
- info = mate_panel_applets_manager_get_applet_info (applet_iid);
-
- if (!info)
- return NULL;
-
- iid = mate_panel_applet_info_get_iid (info);
-
- /* migrate if the iid in the configuration is different than the real
- * iid that will get used */
- if (!g_str_equal (iid, applet_iid))
- needs_migration = TRUE;
-
- g_free (applet_iid);
-
- if (needs_migration) {
- key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "applet_iid");
- mateconf_client_set_string (client, key, iid, NULL);
- }
-
- return g_strdup (iid);
-}
diff --git a/mate-panel/panel-compatibility.h b/mate-panel/panel-compatibility.h
deleted file mode 100644
index 4413fb95..00000000
--- a/mate-panel/panel-compatibility.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * panel-compatibility.h: panel backwards compatibility support
- *
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Authors:
- * Mark McLoughlin <[email protected]>
- */
-
-#ifndef __PANEL_COMPATIBILITY_H__
-#define __PANEL_COMPATIBILITY_H__
-
-#include <glib.h>
-#include <mateconf/mateconf-client.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void panel_compatibility_migrate_panel_id_list (MateConfClient *client);
-void panel_compatibility_maybe_copy_old_config (MateConfClient *client);
-void panel_compatibility_migrate_applications_scheme (MateConfClient *client,
- const char *key);
-void panel_compatibility_migrate_screenshot_action (MateConfClient *client,
- const char *id);
-
-gchar *panel_compatibility_get_applet_iid (const gchar *id);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PANEL_MENU_BAR_H__ */
diff --git a/mate-panel/panel-compatibility.schemas b/mate-panel/panel-compatibility.schemas
deleted file mode 100644
index ea4a7a68..00000000
--- a/mate-panel/panel-compatibility.schemas
+++ /dev/null
@@ -1,546 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
-
-<!--
- Schemas to maintain compatibility with the 2.0/2.2 configurations.
-
- The problem being addressed here is that because the 2.0/2.2 panel
- applies schemas to keys at runtime, existing user configurations
- will end up with dangling references to the old schemas unless we
- install these old schemas.
-
- For example, a 2.0/2.2 panel will apply the medium/general/panel_id_list
- schema to profiles/default/general/panel_id_list. This association
- is in the user's configuration, not in the system MateConf database.
- If the user never changes panel_id_list and logs into a machine without
- this schema, then panel_id_list will be empty.
- -->
-
- <schemalist>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/general/panel_id_list</key>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[00000001,00000002]</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/general/applet_id_list</key>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[00000001,00000002,00000003,00000004,show_desktop_button]</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/general/object_id_list</key>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[00000001,00000002]</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>edge-panel</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_size</key>
- <owner>panel</owner>
- <type>string</type>
- <default>panel-size-x-small</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_hide_mode</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_hide_state</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/screen</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/monitor</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/screen_edge</key>
- <owner>panel</owner>
- <type>string</type>
- <default>panel-edge-bottom</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/hide_buttons_enabled</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/hide_button_pixmaps_enabled</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>no-background</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_pixmap</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_pixmap_fit</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_pixmap_stretch</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_pixmap_rotate</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_color</key>
- <owner>panel</owner>
- <type>string</type>
- <default>#ffffff</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000001/panel_background_color_alpha</key>
- <owner>panel</owner>
- <type>int</type>
- <default>65535</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000001/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>launcher-object</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000001/launcher_location</key>
- <owner>panel</owner>
- <type>string</type>
- <default>applications:///caja.desktop</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000001/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000002</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000001/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>20</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000001/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000002/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>launcher-object</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000002/launcher_location</key>
- <owner>panel</owner>
- <type>string</type>
- <default>applications:///System/mate-terminal.desktop</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000002/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000002</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000002/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>25</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/objects/00000002/panel_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/show_desktop_button/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>matecomponent-applet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/show_desktop_button/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000001</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/show_desktop_button/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/show_desktop_button/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default>OAFIID:MATE_ShowDesktopApplet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/show_desktop_button/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000001/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>matecomponent-applet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000001/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000001</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000001/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>1</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000001/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default>OAFIID:MATE_TasklistApplet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000001/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000002/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>matecomponent-applet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000002/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000001</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000002/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000002/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default>OAFIID:MATE_PagerApplet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000002/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000003/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>matecomponent-applet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000003/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000002</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000003/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000003/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default>OAFIID:MATE_MixerApplet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000003/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000004/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>matecomponent-applet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000004/panel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default>00000002</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000004/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000004/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default>OAFIID:MATE_ClockApplet</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/applets/00000004/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>menu-panel</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_size</key>
- <owner>panel</owner>
- <type>string</type>
- <default>panel-size-x-small</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/screen</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/monitor</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>no-background</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_pixmap</key>
- <owner>panel</owner>
- <type>string</type>
- <default> </default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_pixmap_fit</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_pixmap_stretch</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_pixmap_rotate</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/panel_background_color</key>
- <owner>panel</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C"/>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/default_profiles/medium/panels/00000002/clock_format</key>
- <owner>panel</owner>
- <type>string</type>
- <default>%I:%M %p</default>
- <locale name="C"/>
- </schema>
-
- </schemalist>
-
-</mateconfschemafile>
diff --git a/mate-panel/panel-config-global.c b/mate-panel/panel-config-global.c
index 1ed3348a..32687748 100644
--- a/mate-panel/panel-config-global.c
+++ b/mate-panel/panel-config-global.c
@@ -21,6 +21,7 @@
* Authors:
* Mark McLoughlin <[email protected]>
* Glynn Foster <[email protected]>
+ * Stefano Karapetsas <[email protected]>
*/
#include <config.h>
@@ -28,10 +29,9 @@
#include "panel-config-global.h"
#include <string.h>
-#include <mateconf/mateconf.h>
+#include <gio/gio.h>
#include "panel-globals.h"
-#include "panel-mateconf.h"
typedef struct {
guint tooltips_enabled : 1;
@@ -43,6 +43,7 @@ typedef struct {
static GlobalConfig global_config = { 0, };
static gboolean global_config_initialised = FALSE;
+static GSettings *panel_global_settings = NULL;
gboolean
panel_global_config_get_highlight_when_over (void)
@@ -85,69 +86,56 @@ panel_global_config_get_confirm_panel_remove (void)
}
static void
-panel_global_config_set_entry (MateConfEntry *entry)
+panel_global_config_set_entry (GSettings *settings, gchar *key)
{
- MateConfValue *value;
- const char *key;
+ g_return_if_fail (settings != NULL);
+ g_return_if_fail (key != NULL);
- g_return_if_fail (entry != NULL);
-
- value = mateconf_entry_get_value (entry);
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
-
- if (!value || !key)
- return;
-
- if (strcmp (key, "tooltips_enabled") == 0)
+ if (strcmp (key, "tooltips-enabled") == 0)
global_config.tooltips_enabled =
- mateconf_value_get_bool (value);
+ g_settings_get_boolean (settings, key);
- else if (strcmp (key, "enable_animations") == 0)
+ else if (strcmp (key, "enable-animations") == 0)
global_config.enable_animations =
- mateconf_value_get_bool (value);
+ g_settings_get_boolean (settings, key);
- else if (strcmp (key, "drawer_autoclose") == 0)
+ else if (strcmp (key, "drawer-autoclose") == 0)
global_config.drawer_auto_close =
- mateconf_value_get_bool (value);
+ g_settings_get_boolean (settings, key);
- else if (strcmp (key, "confirm_panel_remove") == 0)
+ else if (strcmp (key, "confirm-panel-remove") == 0)
global_config.confirm_panel_remove =
- mateconf_value_get_bool (value);
+ g_settings_get_boolean (settings, key);
- else if (strcmp (key, "highlight_launchers_on_mouseover") == 0)
+ else if (strcmp (key, "highlight-launchers-on-mouseover") == 0)
global_config.highlight_when_over =
- mateconf_value_get_bool (value);
+ g_settings_get_boolean (settings, key);
}
static void
-panel_global_config_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+panel_global_config_notify (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
- panel_global_config_set_entry (entry);
+ panel_global_config_set_entry (settings, key);
}
void
panel_global_config_load (void)
{
- MateConfClient *client;
- GSList *l, *entries;
- const char *key = "/apps/panel/global";
-
- client = panel_mateconf_get_client ();
+ gchar **keys;
+ gint i;
- mateconf_client_add_dir (client, key, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ panel_global_settings = g_settings_new ("org.mate.panel");
- entries = mateconf_client_all_entries (client, key, NULL);
+ keys = g_settings_list_keys (panel_global_settings);
- for (l = entries; l; l = l->next) {
- panel_global_config_set_entry (l->data);
- mateconf_entry_unref (l->data);
+ for (i = 0; keys[i]; i++) {
+ panel_global_config_set_entry (panel_global_settings, keys[i]);
}
- g_slist_free (entries);
+ g_strfreev (keys);
- mateconf_client_notify_add (client, key, panel_global_config_notify, NULL, NULL, NULL);
+ g_signal_connect (panel_global_settings, "changed", G_CALLBACK (panel_global_config_notify), NULL);
global_config_initialised = TRUE;
}
diff --git a/mate-panel/panel-default-setup.entries b/mate-panel/panel-default-setup.entries
deleted file mode 100644
index c232b4d8..00000000
--- a/mate-panel/panel-default-setup.entries
+++ /dev/null
@@ -1,657 +0,0 @@
-<mateconfentryfile>
-
- <entrylist base="/apps/panel/default_setup">
-
- <!-- List of toplevels -->
-
- <entry>
- <key>general/toplevel_id_list</key>
- <schema_key>/schemas/apps/panel/general/toplevel_id_list</schema_key>
- <value>
- <list type="string">
- <value>
- <string>top_panel</string>
- </value>
- <value>
- <string>bottom_panel</string>
- </value>
- </list>
- </value>
- </entry>
-
- <!-- List of objects -->
-
- <entry>
- <key>general/object_id_list</key>
- <schema_key>/schemas/apps/panel/general/object_id_list</schema_key>
- <value>
- <list type="string">
- <value>
- <string>menu_bar</string>
- </value>
- <value>
- <string>browser_launcher</string>
- </value>
- <value>
- <string>email_launcher</string>
- </value>
- </list>
- </value>
- </entry>
-
- <!-- List of applets -->
-
- <entry>
- <key>general/applet_id_list</key>
- <schema_key>/schemas/apps/panel/general/applet_id_list</schema_key>
- <value>
- <list type="string">
- <value>
- <string>window_menu</string>
- </value>
- <value>
- <string>clock</string>
- </value>
- <value>
- <string>notification_area</string>
- </value>
- <value>
- <string>show_desktop_button</string>
- </value>
- <value>
- <string>window_list</string>
- </value>
- <value>
- <string>workspace_switcher</string>
- </value>
- </list>
- </value>
- </entry>
-
- <!-- Top Panel -->
-
- <entry>
- <key>toplevels/top_panel/expand</key>
- <schema_key>/schemas/apps/panel/toplevels/expand</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>toplevels/top_panel/orientation</key>
- <schema_key>/schemas/apps/panel/toplevels/orientation</schema_key>
- <value>
- <string>top</string>
- </value>
- </entry>
- <entry>
- <key>toplevels/top_panel/size</key>
- <schema_key>/schemas/apps/panel/toplevels/size</schema_key>
- <value>
- <int>24</int>
- </value>
- </entry>
-
- <entry><key>toplevels/top_panel/name</key><schema_key>/schemas/apps/panel/toplevels/name</schema_key></entry>
- <entry><key>toplevels/top_panel/screen</key><schema_key>/schemas/apps/panel/toplevels/screen</schema_key></entry>
- <entry><key>toplevels/top_panel/monitor</key><schema_key>/schemas/apps/panel/toplevels/monitor</schema_key></entry>
- <entry><key>toplevels/top_panel/x</key><schema_key>/schemas/apps/panel/toplevels/x</schema_key></entry>
- <entry><key>toplevels/top_panel/y</key><schema_key>/schemas/apps/panel/toplevels/y</schema_key></entry>
- <entry><key>toplevels/top_panel/x_right</key><schema_key>/schemas/apps/panel/toplevels/x_right</schema_key></entry>
- <entry><key>toplevels/top_panel/y_bottom</key><schema_key>/schemas/apps/panel/toplevels/y_bottom</schema_key></entry>
- <entry><key>toplevels/top_panel/x_centered</key><schema_key>/schemas/apps/panel/toplevels/x_centered</schema_key></entry>
- <entry><key>toplevels/top_panel/y_centered</key><schema_key>/schemas/apps/panel/toplevels/y_centered</schema_key></entry>
- <entry><key>toplevels/top_panel/auto_hide</key><schema_key>/schemas/apps/panel/toplevels/auto_hide</schema_key></entry>
- <entry><key>toplevels/top_panel/enable_animations</key><schema_key>/schemas/apps/panel/toplevels/enable_animations</schema_key></entry>
- <entry><key>toplevels/top_panel/enable_buttons</key><schema_key>/schemas/apps/panel/toplevels/enable_buttons</schema_key></entry>
- <entry><key>toplevels/top_panel/enable_arrows</key><schema_key>/schemas/apps/panel/toplevels/enable_arrows</schema_key></entry>
- <entry><key>toplevels/top_panel/hide_delay</key><schema_key>/schemas/apps/panel/toplevels/hide_delay</schema_key></entry>
- <entry><key>toplevels/top_panel/unhide_delay</key><schema_key>/schemas/apps/panel/toplevels/unhide_delay</schema_key></entry>
- <entry><key>toplevels/top_panel/auto_hide_size</key><schema_key>/schemas/apps/panel/toplevels/auto_hide_size</schema_key></entry>
- <entry><key>toplevels/top_panel/animation_speed</key><schema_key>/schemas/apps/panel/toplevels/animation_speed</schema_key></entry>
- <entry><key>toplevels/top_panel/background/type</key><schema_key>/schemas/apps/panel/toplevels/background/type</schema_key></entry>
- <entry><key>toplevels/top_panel/background/color</key><schema_key>/schemas/apps/panel/toplevels/background/color</schema_key></entry>
- <entry><key>toplevels/top_panel/background/opacity</key><schema_key>/schemas/apps/panel/toplevels/background/opacity</schema_key></entry>
- <entry><key>toplevels/top_panel/background/image</key><schema_key>/schemas/apps/panel/toplevels/background/image</schema_key></entry>
- <entry><key>toplevels/top_panel/background/fit</key><schema_key>/schemas/apps/panel/toplevels/background/fit</schema_key></entry>
- <entry><key>toplevels/top_panel/background/stretch</key><schema_key>/schemas/apps/panel/toplevels/background/stretch</schema_key></entry>
- <entry><key>toplevels/top_panel/background/rotate</key><schema_key>/schemas/apps/panel/toplevels/background/rotate</schema_key></entry>
-
- <!-- Bottom Panel -->
-
- <entry>
- <key>toplevels/bottom_panel/expand</key>
- <schema_key>/schemas/apps/panel/toplevels/expand</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>toplevels/bottom_panel/orientation</key>
- <schema_key>/schemas/apps/panel/toplevels/orientation</schema_key>
- <value>
- <string>bottom</string>
- </value>
- </entry>
- <entry>
- <key>toplevels/bottom_panel/size</key>
- <schema_key>/schemas/apps/panel/toplevels/size</schema_key>
- <value>
- <int>24</int>
- </value>
- </entry>
- <entry>
- <key>toplevels/bottom_panel/y_bottom</key>
- <schema_key>/schemas/apps/panel/toplevels/y_bottom</schema_key>
- <value>
- <int>0</int>
- </value>
- </entry>
-
- <entry><key>toplevels/bottom_panel/name</key><schema_key>/schemas/apps/panel/toplevels/name</schema_key></entry>
- <entry><key>toplevels/bottom_panel/screen</key><schema_key>/schemas/apps/panel/toplevels/screen</schema_key></entry>
- <entry><key>toplevels/bottom_panel/monitor</key><schema_key>/schemas/apps/panel/toplevels/monitor</schema_key></entry>
- <entry><key>toplevels/bottom_panel/x</key><schema_key>/schemas/apps/panel/toplevels/x</schema_key></entry>
- <entry><key>toplevels/bottom_panel/y</key><schema_key>/schemas/apps/panel/toplevels/y</schema_key></entry>
- <entry><key>toplevels/bottom_panel/x_right</key><schema_key>/schemas/apps/panel/toplevels/x_right</schema_key></entry>
- <entry><key>toplevels/bottom_panel/x_centered</key><schema_key>/schemas/apps/panel/toplevels/x_centered</schema_key></entry>
- <entry><key>toplevels/bottom_panel/y_centered</key><schema_key>/schemas/apps/panel/toplevels/y_centered</schema_key></entry>
- <entry><key>toplevels/bottom_panel/auto_hide</key><schema_key>/schemas/apps/panel/toplevels/auto_hide</schema_key></entry>
- <entry><key>toplevels/bottom_panel/enable_animations</key><schema_key>/schemas/apps/panel/toplevels/enable_animations</schema_key></entry>
- <entry><key>toplevels/bottom_panel/enable_buttons</key><schema_key>/schemas/apps/panel/toplevels/enable_buttons</schema_key></entry>
- <entry><key>toplevels/bottom_panel/enable_arrows</key><schema_key>/schemas/apps/panel/toplevels/enable_arrows</schema_key></entry>
- <entry><key>toplevels/bottom_panel/hide_delay</key><schema_key>/schemas/apps/panel/toplevels/hide_delay</schema_key></entry>
- <entry><key>toplevels/bottom_panel/unhide_delay</key><schema_key>/schemas/apps/panel/toplevels/unhide_delay</schema_key></entry>
- <entry><key>toplevels/bottom_panel/auto_hide_size</key><schema_key>/schemas/apps/panel/toplevels/auto_hide_size</schema_key></entry>
- <entry><key>toplevels/bottom_panel/animation_speed</key><schema_key>/schemas/apps/panel/toplevels/animation_speed</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/type</key><schema_key>/schemas/apps/panel/toplevels/background/type</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/color</key><schema_key>/schemas/apps/panel/toplevels/background/color</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/opacity</key><schema_key>/schemas/apps/panel/toplevels/background/opacity</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/image</key><schema_key>/schemas/apps/panel/toplevels/background/image</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/fit</key><schema_key>/schemas/apps/panel/toplevels/background/fit</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/stretch</key><schema_key>/schemas/apps/panel/toplevels/background/stretch</schema_key></entry>
- <entry><key>toplevels/bottom_panel/background/rotate</key><schema_key>/schemas/apps/panel/toplevels/background/rotate</schema_key></entry>
-
- <!-- Menu Bar -->
-
- <entry>
- <key>objects/menu_bar/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>menu-bar</string>
- </value>
- </entry>
- <entry>
- <key>objects/menu_bar/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>objects/menu_bar/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>0</int>
- </value>
- </entry>
- <entry>
- <key>objects/menu_bar/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>false</bool>
- </value>
- </entry>
- <entry>
- <key>objects/menu_bar/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
-
- <entry><key>objects/menu_bar/applet_iid</key><schema_key>/schemas/apps/panel/objects/applet_iid</schema_key></entry>
- <entry><key>objects/menu_bar/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>objects/menu_bar/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>objects/menu_bar/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>objects/menu_bar/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>objects/menu_bar/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>objects/menu_bar/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>objects/menu_bar/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>objects/menu_bar/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Browser Launcher -->
-
- <entry>
- <key>objects/browser_launcher/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>launcher-object</string>
- </value>
- </entry>
- <entry>
- <key>objects/browser_launcher/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>objects/browser_launcher/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>1</int>
- </value>
- </entry>
- <entry>
- <key>objects/browser_launcher/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>false</bool>
- </value>
- </entry>
- <entry>
- <key>objects/browser_launcher/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>objects/browser_launcher/launcher_location</key>
- <schema_key>/schemas/apps/panel/objects/launcher_location</schema_key>
- <value>
- <string>firefox.desktop</string>
- </value>
- </entry>
-
- <entry><key>objects/browser_launcher/applet_iid</key><schema_key>/schemas/apps/panel/objects/applet_iid</schema_key></entry>
- <entry><key>objects/browser_launcher/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>objects/browser_launcher/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>objects/browser_launcher/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>objects/browser_launcher/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>objects/browser_launcher/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>objects/browser_launcher/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>objects/browser_launcher/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Email Launcher -->
-
- <entry>
- <key>objects/email_launcher/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>launcher-object</string>
- </value>
- </entry>
- <entry>
- <key>objects/email_launcher/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>objects/email_launcher/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>2</int>
- </value>
- </entry>
- <entry>
- <key>objects/email_launcher/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>false</bool>
- </value>
- </entry>
- <entry>
- <key>objects/email_launcher/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>objects/email_launcher/launcher_location</key>
- <schema_key>/schemas/apps/panel/objects/launcher_location</schema_key>
- <value>
- <string>thunderbird.desktop</string>
- </value>
- </entry>
-
- <entry><key>objects/email_launcher/applet_iid</key><schema_key>/schemas/apps/panel/objects/applet_iid</schema_key></entry>
- <entry><key>objects/email_launcher/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>objects/email_launcher/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>objects/email_launcher/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>objects/email_launcher/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>objects/email_launcher/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>objects/email_launcher/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>objects/email_launcher/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Window Menu Applet -->
-
- <entry>
- <key>applets/window_menu/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/window_menu/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/window_menu/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>0</int>
- </value>
- </entry>
- <entry>
- <key>applets/window_menu/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/window_menu/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/window_menu/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>WnckletFactory::WindowMenuApplet</string>
- </value>
- </entry>
-
- <entry><key>applets/window_menu/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/window_menu/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/window_menu/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/window_menu/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/window_menu/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/window_menu/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/window_menu/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/window_menu/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Clock Applet -->
-
- <entry>
- <key>applets/clock/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/clock/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/clock/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>2</int>
- </value>
- </entry>
- <entry>
- <key>applets/clock/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/clock/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/clock/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>ClockAppletFactory::ClockApplet</string>
- </value>
- </entry>
-
- <entry><key>applets/clock/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/clock/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/clock/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/clock/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/clock/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/clock/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/clock/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/clock/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Notification Area Applet -->
-
- <entry>
- <key>applets/notification_area/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/notification_area/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>top_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/notification_area/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>3</int>
- </value>
- </entry>
- <entry>
- <key>applets/notification_area/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/notification_area/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/notification_area/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>NotificationAreaAppletFactory::NotificationArea</string>
- </value>
- </entry>
-
- <entry><key>applets/notification_area/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/notification_area/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/notification_area/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/notification_area/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/notification_area/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/notification_area/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/notification_area/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/notification_area/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Show Desktop Applet -->
-
- <entry>
- <key>applets/show_desktop_button/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/show_desktop_button/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>bottom_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/show_desktop_button/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>0</int>
- </value>
- </entry>
- <entry>
- <key>applets/show_desktop_button/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>false</bool>
- </value>
- </entry>
- <entry>
- <key>applets/show_desktop_button/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/show_desktop_button/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>WnckletFactory::ShowDesktopApplet</string>
- </value>
- </entry>
-
- <entry><key>applets/show_desktop_button/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/show_desktop_button/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/show_desktop_button/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/show_desktop_button/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/show_desktop_button/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/show_desktop_button/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/show_desktop_button/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/show_desktop_button/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Window List Applet -->
-
- <entry>
- <key>applets/window_list/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/window_list/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>bottom_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/window_list/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>1</int>
- </value>
- </entry>
- <entry>
- <key>applets/window_list/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>false</bool>
- </value>
- </entry>
- <entry>
- <key>applets/window_list/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/window_list/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>WnckletFactory::WindowListApplet</string>
- </value>
- </entry>
-
- <entry><key>applets/window_list/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/window_list/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/window_list/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/window_list/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/window_list/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/window_list/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/window_list/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/window_list/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- <!-- Workspace Switcher Applet -->
-
- <entry>
- <key>applets/workspace_switcher/object_type</key>
- <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
- <value>
- <string>external-applet</string>
- </value>
- </entry>
- <entry>
- <key>applets/workspace_switcher/toplevel_id</key>
- <schema_key>/schemas/apps/panel/objects/toplevel_id</schema_key>
- <value>
- <string>bottom_panel</string>
- </value>
- </entry>
- <entry>
- <key>applets/workspace_switcher/position</key>
- <schema_key>/schemas/apps/panel/objects/position</schema_key>
- <value>
- <int>0</int>
- </value>
- </entry>
- <entry>
- <key>applets/workspace_switcher/panel_right_stick</key>
- <schema_key>/schemas/apps/panel/objects/panel_right_stick</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/workspace_switcher/locked</key>
- <schema_key>/schemas/apps/panel/objects/locked</schema_key>
- <value>
- <bool>true</bool>
- </value>
- </entry>
- <entry>
- <key>applets/workspace_switcher/applet_iid</key>
- <schema_key>/schemas/apps/panel/objects/applet_iid</schema_key>
- <value>
- <string>WnckletFactory::WorkspaceSwitcherApplet</string>
- </value>
- </entry>
-
- <entry><key>applets/workspace_switcher/attached_toplevel_id</key><schema_key>/schemas/apps/panel/objects/attached_toplevel_id</schema_key> </entry>
- <entry><key>applets/workspace_switcher/tooltip</key><schema_key>/schemas/apps/panel/objects/tooltip</schema_key></entry>
- <entry><key>applets/workspace_switcher/use_custom_icon</key><schema_key>/schemas/apps/panel/objects/use_custom_icon</schema_key></entry>
- <entry><key>applets/workspace_switcher/custom_icon</key><schema_key>/schemas/apps/panel/objects/custom_icon</schema_key></entry>
- <entry><key>applets/workspace_switcher/use_menu_path</key><schema_key>/schemas/apps/panel/objects/use_menu_path</schema_key></entry>
- <entry><key>applets/workspace_switcher/menu_path</key><schema_key>/schemas/apps/panel/objects/menu_path</schema_key></entry>
- <entry><key>applets/workspace_switcher/launcher_location</key><schema_key>/schemas/apps/panel/objects/launcher_location</schema_key></entry>
- <entry><key>applets/workspace_switcher/action_type</key><schema_key>/schemas/apps/panel/objects/action_type</schema_key></entry>
-
- </entrylist>
-
-</mateconfentryfile>
diff --git a/mate-panel/panel-enums-gsettings.h b/mate-panel/panel-enums-gsettings.h
new file mode 100644
index 00000000..70600c47
--- /dev/null
+++ b/mate-panel/panel-enums-gsettings.h
@@ -0,0 +1,79 @@
+/*
+ * panel-enums-gsettings.h:
+ *
+ * Copyright (C) 2003 Sun Microsystems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+
+ * Authors:
+ * Mark McLoughlin <[email protected]>
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#ifndef __PANEL_ENUMS_GSETTINGS_H__
+#define __PANEL_ENUMS_GSETTINGS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum { /*< flags=0 >*/
+ PANEL_ORIENTATION_TOP = 1 << 0,
+ PANEL_ORIENTATION_RIGHT = 1 << 1,
+ PANEL_ORIENTATION_BOTTOM = 1 << 2,
+ PANEL_ORIENTATION_LEFT = 1 << 3
+} PanelOrientation;
+
+typedef enum {
+ PANEL_ANIMATION_SLOW = 0,
+ PANEL_ANIMATION_MEDIUM = 1,
+ PANEL_ANIMATION_FAST = 2
+} PanelAnimationSpeed;
+
+typedef enum {
+ PANEL_BACK_NONE = 0,
+ PANEL_BACK_COLOR = 1,
+ PANEL_BACK_IMAGE = 2
+} PanelBackgroundType;
+
+typedef enum {
+ PANEL_OBJECT_DRAWER,
+ PANEL_OBJECT_MENU,
+ PANEL_OBJECT_LAUNCHER,
+ PANEL_OBJECT_APPLET,
+ PANEL_OBJECT_ACTION,
+ PANEL_OBJECT_MENU_BAR,
+ PANEL_OBJECT_SEPARATOR,
+ /* The following two are for backwards compatibility with 2.0.x */
+ PANEL_OBJECT_LOGOUT,
+ PANEL_OBJECT_LOCK
+} PanelObjectType;
+
+typedef enum {
+ PANEL_ACTION_NONE = 0,
+ PANEL_ACTION_LOCK,
+ PANEL_ACTION_LOGOUT,
+ PANEL_ACTION_RUN,
+ PANEL_ACTION_SEARCH,
+ PANEL_ACTION_FORCE_QUIT,
+ PANEL_ACTION_CONNECT_SERVER,
+ PANEL_ACTION_SHUTDOWN,
+ PANEL_ACTION_LAST
+} PanelActionButtonType;
+
+G_END_DECLS
+
+#endif /* __PANEL_ENUMS_GSETTINGS_H__ */
diff --git a/mate-panel/panel-enums.h b/mate-panel/panel-enums.h
index b9418fbb..6a98ab97 100644
--- a/mate-panel/panel-enums.h
+++ b/mate-panel/panel-enums.h
@@ -26,17 +26,9 @@
#define __PANEL_ENUMS_H__
#include <glib.h>
+#include "panel-enums-gsettings.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- PANEL_ORIENTATION_TOP = 1 << 0,
- PANEL_ORIENTATION_RIGHT = 1 << 1,
- PANEL_ORIENTATION_BOTTOM = 1 << 2,
- PANEL_ORIENTATION_LEFT = 1 << 3
-} PanelOrientation;
+G_BEGIN_DECLS
#define PANEL_HORIZONTAL_MASK (PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)
#define PANEL_VERTICAL_MASK (PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)
@@ -59,52 +51,10 @@ typedef enum {
} PanelState;
typedef enum {
- PANEL_ANIMATION_SLOW = 0,
- PANEL_ANIMATION_MEDIUM = 1,
- PANEL_ANIMATION_FAST = 2
-} PanelAnimationSpeed;
-
-typedef enum {
- PANEL_BACK_NONE = 0,
- PANEL_BACK_COLOR = 1,
- PANEL_BACK_IMAGE = 2
-} PanelBackgroundType;
-
-typedef enum {
- PANEL_MATECONF_TOPLEVELS,
- PANEL_MATECONF_OBJECTS,
- PANEL_MATECONF_APPLETS
-} PanelMateConfKeyType;
-
-typedef enum {
- PANEL_OBJECT_DRAWER,
- PANEL_OBJECT_MENU,
- PANEL_OBJECT_LAUNCHER,
- PANEL_OBJECT_APPLET,
- PANEL_OBJECT_ACTION,
- PANEL_OBJECT_MENU_BAR,
- PANEL_OBJECT_SEPARATOR,
- /* The following two are for backwards compatibility with 2.0.x */
- PANEL_OBJECT_LOGOUT,
- PANEL_OBJECT_LOCK
-} PanelObjectType;
-
-typedef enum {
- PANEL_ACTION_NONE = 0,
- PANEL_ACTION_LOCK,
- PANEL_ACTION_LOGOUT,
- PANEL_ACTION_RUN,
- PANEL_ACTION_SEARCH,
- PANEL_ACTION_FORCE_QUIT,
- PANEL_ACTION_CONNECT_SERVER,
- PANEL_ACTION_SHUTDOWN,
- /* compatibility with MATE < 2.13.90 */
- PANEL_ACTION_SCREENSHOT,
- PANEL_ACTION_LAST
-} PanelActionButtonType;
+ PANEL_GSETTINGS_TOPLEVELS,
+ PANEL_GSETTINGS_OBJECTS
+} PanelGSettingsKeyType;
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __PANEL_ENUMS_H__ */
diff --git a/mate-panel/panel-general.schemas.in b/mate-panel/panel-general.schemas.in
deleted file mode 100644
index 1bfc2c7a..00000000
--- a/mate-panel/panel-general.schemas.in
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
-
- <schemalist>
-
- <schema>
- <key>/schemas/apps/panel/general/enable_program_list</key>
- <applyto>/apps/panel/general/enable_program_list</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable program list in "Run Application" dialog</short>
- <long>
- If true, the "Known Applications" listing in the "Run
- Application" dialog is made available. Whether or not
- the listing is expanded when the dialog is shown is
- controlled by the show_program_list key.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/show_program_list</key>
- <applyto>/apps/panel/general/show_program_list</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Expand program list in "Run Application" dialog</short>
- <long>
- If true, the "Known Applications" listing in the "Run
- Application" dialog is expanded when the dialog is opened.
- This key is only relevant if the enable_program_list key
- is true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/enable_autocompletion</key>
- <applyto>/apps/panel/general/enable_autocompletion</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable autocompletion in "Run Application" dialog</short>
- <long>
- If true, autocompletion in the "Run Application" dialog is
- made available.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/toplevel_id_list</key>
- <applyto>/apps/panel/general/toplevel_id_list</applyto>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Panel ID list</short>
- <long>
- A list of panel IDs. Each ID identifies an individual
- toplevel panel. The settings for each of these panels are
- stored in /apps/panel/toplevels/$(id).
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/applet_id_list</key>
- <applyto>/apps/panel/general/applet_id_list</applyto>
- <owner>panel</owner>
- <list_type>string</list_type>
- <type>list</type>
- <default>[]</default>
- <locale name="C">
- <short>Panel applet ID list</short>
- <long>
- A list of panel applet IDs. Each ID identifies an
- individual panel applet. The settings for each of
- these applets are stored in
- /apps/panel/applets/$(id).
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/object_id_list</key>
- <applyto>/apps/panel/general/object_id_list</applyto>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Panel object ID list</short>
- <long>
- A list of panel object IDs. Each ID identifies an individual
- panel object (e.g. a launcher, action button or menu
- button/bar). The settings for each of these objects are
- stored in
- /apps/panel/objects/$(id).
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/general/profiles_migrated</key>
- <applyto>/apps/panel/general/profiles_migrated</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Old profiles configuration migrated</short>
- <long>
- A boolean flag to indicate whether the user's previous
- configuration in /apps/panel/profiles/default has been
- copied to the new location in /apps/panel.
- </long>
- </locale>
- </schema>
-
- </schemalist>
-
-</mateconfschemafile>
diff --git a/mate-panel/panel-global.schemas.in b/mate-panel/panel-global.schemas.in
deleted file mode 100644
index f99c5b28..00000000
--- a/mate-panel/panel-global.schemas.in
+++ /dev/null
@@ -1,276 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
-
-<!--
-Panel Global Config Schema File - work in progress
--->
-
- <schemalist>
-
- <schema>
- <key>/schemas/apps/panel/global/tooltips_enabled</key>
- <applyto>/apps/panel/global/tooltips_enabled</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable tooltips</short>
- <long>If true, tooltips are shown for objects in panels.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/keep_menus_in_memory</key>
- <applyto>/apps/panel/global/keep_menus_in_memory</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/enable_animations</key>
- <applyto>/apps/panel/global/enable_animations</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable animations</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/panel_minimized_size</key>
- <applyto>/apps/panel/global/panel_minimized_size</applyto>
- <owner>panel</owner>
- <type>int</type>
- <default>3</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/panel_show_delay</key>
- <applyto>/apps/panel/global/panel_show_delay</applyto>
- <owner>panel</owner>
- <type>int</type>
- <default>300</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/panel_animation_speed</key>
- <applyto>/apps/panel/global/panel_animation_speed</applyto>
- <owner>panel</owner>
- <type>string</type>
- <default>panel-speed-medium</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/panel_hide_delay</key>
- <applyto>/apps/panel/global/panel_hide_delay</applyto>
- <owner>panel</owner>
- <type>int</type>
- <default>500</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/enable_key_bindings</key>
- <applyto>/apps/panel/global/enable_key_bindings</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/menu_key</key>
- <applyto>/apps/panel/global/menu_key</applyto>
- <owner>panel</owner>
- <type>string</type>
- <default>&lt;Alt&gt;F1</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/run_key</key>
- <applyto>/apps/panel/global/run_key</applyto>
- <owner>panel</owner>
- <type>string</type>
- <default>&lt;Alt&gt;F2</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/screenshot_key</key>
- <applyto>/apps/panel/global/screenshot_key</applyto>
- <owner>panel</owner>
- <type>string</type>
- <default>Print</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/window_screenshot_key</key>
- <applyto>/apps/panel/global/window_screenshot_key</applyto>
- <owner>panel</owner>
- <type>string</type>
- <default>&lt;Alt&gt;Print</default>
- <locale name="C">
- <short>Deprecated</short>
- <long></long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/drawer_autoclose</key>
- <applyto>/apps/panel/global/drawer_autoclose</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Autoclose drawer</short>
- <long>If true, a drawer will automatically be closed
- when the user clicks a launcher in it.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/confirm_panel_remove</key>
- <applyto>/apps/panel/global/confirm_panel_remove</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Confirm panel removal</short>
- <long>If true, a dialog is shown asking for confirmation
- if the user wants to remove a panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/highlight_launchers_on_mouseover</key>
- <applyto>/apps/panel/global/highlight_launchers_on_mouseover</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Highlight launchers on mouseover</short>
- <long>If true, a launcher is highlighted when the user
- moves the pointer over it.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/locked_down</key>
- <applyto>/apps/panel/global/locked_down</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Complete panel lockdown</short>
- <long>If true, the panel will not allow any changes to
- the configuration of the panel. Individual applets
- may need to be locked down separately however.
- The panel must be restarted for this to take effect.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/disabled_applets</key>
- <applyto>/apps/panel/global/disabled_applets</applyto>
- <owner>panel</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Applet IIDs to disable from loading</short>
- <long>A list of applet IIDs that the panel will ignore. This way you
- can disable certain applets from loading or showing up in the menu.
- For example to disable the mini-commander applet add 'OAFIID:MATE_MiniCommanderApplet'
- to this list. The panel must be restarted for this to take effect.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/disable_lock_screen</key>
- <applyto>/apps/panel/global/disable_lock_screen</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Deprecated</short>
- <long>This key is deprecated as it cannot be used to implement proper
- lockdown. The /desktop/mate/lockdown/disable_lock_screen key
- should be used instead.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/disable_log_out</key>
- <applyto>/apps/panel/global/disable_log_out</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Disable Logging Out</short>
- <long>If true, the panel will not allow a user to log out,
- by removing access to the log out menu entries.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/global/disable_force_quit</key>
- <applyto>/apps/panel/global/disable_force_quit</applyto>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Disable Force Quit</short>
- <long>If true, the panel will not allow a user to force
- an application to quit by removing access to the
- force quit button.
- </long>
- </locale>
- </schema>
-
- </schemalist>
-
-</mateconfschemafile>
diff --git a/mate-panel/panel-gsettings.c b/mate-panel/panel-gsettings.c
new file mode 100644
index 00000000..44ffe342
--- /dev/null
+++ b/mate-panel/panel-gsettings.c
@@ -0,0 +1,178 @@
+/*
+ * panel-gsettings.c: panel gsettings utility methods
+ *
+ * Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
+ * 2012 Stefano Karapetsas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Mark McLoughlin <[email protected]>
+ * Glynn Foster <[email protected]>
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#include <config.h>
+
+#include "panel-gsettings.h"
+
+#include <string.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libpanel-util/panel-cleanup.h>
+
+/* (copied from gnome-panel)
+ * Adapted from is_valid_keyname() in glib (gio/glib-compile-schemas.c)
+ * Differences:
+ * - gettext support removed (we don't need translations here)
+ * - remove support for allow_any_name
+ */
+gboolean
+panel_gsettings_is_valid_keyname (const gchar *key,
+ GError **error)
+{
+ gint i;
+
+ if (key[0] == '\0')
+ {
+ g_set_error_literal (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "empty names are not permitted");
+ return FALSE;
+ }
+
+ if (!g_ascii_islower (key[0]))
+ {
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid name '%s': names must begin "
+ "with a lowercase letter", key);
+ return FALSE;
+ }
+
+ for (i = 1; key[i]; i++)
+ {
+ if (key[i] != '-' &&
+ !g_ascii_islower (key[i]) &&
+ !g_ascii_isdigit (key[i]))
+ {
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid name '%s': invalid character '%c'; "
+ "only lowercase letters, numbers and dash ('-') "
+ "are permitted.", key, key[i]);
+ return FALSE;
+ }
+
+ if (key[i] == '-' && key[i + 1] == '-')
+ {
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid name '%s': two successive dashes ('--') "
+ "are not permitted.", key);
+ return FALSE;
+ }
+ }
+
+ if (key[i - 1] == '-')
+ {
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid name '%s': the last character may not be a "
+ "dash ('-').", key);
+ return FALSE;
+ }
+
+ if (i > 32)
+ {
+ g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid name '%s': maximum length is 32", key);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* copied from gnome-panel */
+gboolean
+panel_gsettings_append_strv (GSettings *settings,
+ const gchar *key,
+ const gchar *value)
+{
+ gchar **old;
+ gchar **new;
+ gint size;
+ gboolean retval;
+
+ old = g_settings_get_strv (settings, key);
+
+ for (size = 0; old[size] != NULL; size++);
+
+ size += 1; /* appended value */
+ size += 1; /* NULL */
+
+ new = g_realloc_n (old, size, sizeof (gchar *));
+
+ new[size - 2] = g_strdup (value);
+ new[size - 1] = NULL;
+
+ retval = g_settings_set_strv (settings, key,
+ (const gchar **) new);
+
+ g_strfreev (new);
+
+ return retval;
+}
+
+/* copied from gnome-panel */
+gboolean
+panel_gsettings_remove_all_from_strv (GSettings *settings,
+ const gchar *key,
+ const gchar *value)
+{
+ GArray *array;
+ gchar **old;
+ gint i;
+ gboolean retval;
+
+ old = g_settings_get_strv (settings, key);
+ array = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+ for (i = 0; old[i] != NULL; i++) {
+ if (g_strcmp0 (old[i], value) != 0)
+ array = g_array_append_val (array, old[i]);
+ }
+
+ retval = g_settings_set_strv (settings, key,
+ (const gchar **) array->data);
+
+ g_strfreev (old);
+ g_array_free (array, TRUE);
+
+ return retval;
+}
+
+
+
+/* convert a gchar ** to GList (taken from libmatekbd code) */
+GSList*
+panel_gsettings_strv_to_gslist (gchar **array)
+{
+ GSList *list = NULL;
+ gint i;
+ if (array != NULL) {
+ for (i = 0; array[i]; i++) {
+ list = g_slist_append (list, g_strdup (array[i]));
+ }
+ }
+ return list;
+}
diff --git a/mate-panel/panel-gsettings.h b/mate-panel/panel-gsettings.h
new file mode 100644
index 00000000..ac606207
--- /dev/null
+++ b/mate-panel/panel-gsettings.h
@@ -0,0 +1,53 @@
+/*
+ * panel-gsettings.h: panel gsettings utility methods
+ *
+ * Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
+ * 2012 Stefano Karapetsas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Mark McLoughlin <[email protected]>
+ * Glynn Foster <[email protected]>
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#ifndef __PANEL_GSETTINGS_H__
+#define __PANEL_GSETTINGS_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "panel-enums.h"
+
+G_BEGIN_DECLS
+
+gboolean panel_gsettings_is_valid_keyname (const gchar *key,
+ GError **error);
+
+gboolean panel_gsettings_append_strv (GSettings *settings,
+ const gchar *key,
+ const gchar *value);
+
+gboolean panel_gsettings_remove_all_from_strv (GSettings *settings,
+ const gchar *key,
+ const gchar *value);
+
+GSList* panel_gsettings_strv_to_gslist (gchar **array);
+
+G_END_DECLS
+
+#endif /* __PANEL_GSETTINGS_H__ */
diff --git a/mate-panel/panel-layout.c b/mate-panel/panel-layout.c
new file mode 100644
index 00000000..76e7747a
--- /dev/null
+++ b/mate-panel/panel-layout.c
@@ -0,0 +1,353 @@
+/*
+ * panel-layout.c: methods to load default panels from file
+ *
+ * Copyright (C) 2011 Novell, Inc.
+ * 2012 Stefano Karapetsas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#include <config.h>
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libpanel-util/panel-dconf.h>
+
+#include "panel-layout.h"
+#include "panel-profile.h"
+#include "panel-gsettings.h"
+#include "panel-schemas.h"
+#include "panel-enums.h"
+
+#define PANEL_LAYOUT_MATE_FILE PANELDATADIR "/panel-default-layout.mate"
+#define PANEL_LAYOUT_DIST_FILE PANELDATADIR "/panel-default-layout.dist"
+
+typedef struct {
+ const char *name;
+ GType type;
+} PanelLayoutKeyDefinition;
+
+static PanelLayoutKeyDefinition panel_layout_toplevel_keys[] = {
+ { PANEL_TOPLEVEL_NAME_KEY, G_TYPE_STRING },
+ { PANEL_TOPLEVEL_SCREEN_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_MONITOR_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_EXPAND_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_ORIENTATION_KEY, G_TYPE_STRING },
+ { PANEL_TOPLEVEL_SIZE_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_X_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_Y_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_X_RIGHT_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_Y_BOTTOM_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_X_CENTERED_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_Y_CENTERED_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_AUTO_HIDE_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_ENABLE_ANIMATIONS_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_ENABLE_ARROWS_KEY, G_TYPE_BOOLEAN },
+ { PANEL_TOPLEVEL_HIDE_DELAY_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_UNHIDE_DELAY_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_AUTO_HIDE_SIZE_KEY, G_TYPE_INT },
+ { PANEL_TOPLEVEL_ANIMATION_SPEED_KEY, G_TYPE_STRING }
+};
+
+static PanelLayoutKeyDefinition panel_layout_object_keys[] = {
+ { PANEL_OBJECT_TYPE_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_TOPLEVEL_ID_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_POSITION_KEY, G_TYPE_INT },
+ { PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, G_TYPE_BOOLEAN },
+ { PANEL_OBJECT_LOCKED_KEY, G_TYPE_BOOLEAN },
+ { PANEL_OBJECT_APPLET_IID_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_TOOLTIP_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_USE_CUSTOM_ICON_KEY, G_TYPE_BOOLEAN },
+ { PANEL_OBJECT_CUSTOM_ICON_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_USE_MENU_PATH_KEY, G_TYPE_BOOLEAN },
+ { PANEL_OBJECT_MENU_PATH_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_HAS_ARROW_KEY, G_TYPE_BOOLEAN },
+ { PANEL_OBJECT_LAUNCHER_LOCATION_KEY, G_TYPE_STRING },
+ { PANEL_OBJECT_ACTION_TYPE_KEY, G_TYPE_STRING }
+};
+
+/*
+ * return the default layout file path, making it overridable by
+ * distributions
+ */
+static gchar *
+panel_layout_filename () {
+
+ if (g_file_test (PANEL_LAYOUT_DIST_FILE, G_FILE_TEST_IS_REGULAR)) {
+ return g_strdup (PANEL_LAYOUT_DIST_FILE);
+ }
+ else if (g_file_test (PANEL_LAYOUT_MATE_FILE, G_FILE_TEST_IS_REGULAR)) {
+ return g_strdup (PANEL_LAYOUT_MATE_FILE);
+ }
+ else {
+ return NULL;
+ }
+}
+
+static gboolean
+panel_layout_append_group_helper (GKeyFile *keyfile,
+ const char *group,
+ int set_screen_to,
+ const char *group_prefix,
+ char *id_list_key,
+ const char *schema,
+ const char *path_prefix,
+ const char *default_prefix,
+ PanelLayoutKeyDefinition *key_definitions,
+ int key_definitions_len,
+ const char *type_for_error_message)
+{
+ gboolean retval = FALSE;
+ const char *id;
+ char *unique_id = NULL;
+ char *path = NULL;
+ GSettings *settings = NULL;
+ char **keyfile_keys = NULL;
+ char *value_str;
+ int value_int;
+ gboolean value_boolean;
+ int i, j;
+ GError *error = NULL;
+ gchar **existing_ids;
+ gboolean existing_id = FALSE;
+ gchar *dir = NULL;
+ gchar *dconf_path = NULL;
+ PanelGSettingsKeyType type;
+
+ /* Try to extract an id from the group, by stripping the prefix,
+ * and create a unique id out of that */
+ id = group + strlen (group_prefix);
+ while (g_ascii_isspace (*id))
+ id++;
+
+ if (!*id)
+ id = NULL;
+
+ if (id && !panel_gsettings_is_valid_keyname (id, &error)) {
+ g_warning ("Invalid id name in layout '%s' (%s)", id, error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+
+ if (g_strcmp0 (id_list_key, PANEL_TOPLEVEL_ID_LIST_KEY) == 0) {
+ dir = "toplevels";
+ type = PANEL_GSETTINGS_TOPLEVELS;
+ }
+ if (g_strcmp0 (id_list_key, PANEL_OBJECT_ID_LIST_KEY) == 0) {
+ dir = "objects";
+ type = PANEL_GSETTINGS_OBJECTS;
+ }
+
+ dconf_path = g_strdup_printf (PANEL_RESOURCE_PATH "/%s", dir);
+ existing_ids = panel_dconf_list_subdirs (dconf_path, TRUE);
+
+ if (id) {
+ for (i = 0; existing_ids[i]; i) {
+ if (!strcmp (existing_ids[i], id)) {
+ existing_id = TRUE;
+ }
+ }
+ }
+ g_strfreev (existing_ids);
+ g_free (dconf_path);
+
+ if (existing_id || !id)
+ unique_id = panel_profile_find_new_id (type);
+ else
+ unique_id = g_strdup (id);
+
+ path = g_strdup_printf ("%s%s/", path_prefix, unique_id);
+ settings = g_settings_new_with_path (schema, path);
+ g_free (path);
+
+ keyfile_keys = g_key_file_get_keys (keyfile, group, NULL, NULL);
+
+ if (keyfile_keys) {
+
+ /* validate/add keys from the keyfile */
+ for (i = 0; keyfile_keys[i] != NULL; i++) {
+ gboolean found = FALSE;
+
+ for (j = 0; j < key_definitions_len; j++) {
+ if (g_strcmp0 (keyfile_keys[i],
+ key_definitions[j].name) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ g_warning ("Unknown key '%s' for %s",
+ keyfile_keys[i],
+ unique_id);
+ return FALSE;
+ }
+
+ switch (key_definitions[j].type) {
+ case G_TYPE_STRING:
+ value_str = g_key_file_get_string (keyfile,
+ group, keyfile_keys[i],
+ NULL);
+ if (value_str)
+ g_settings_set_string (settings,
+ key_definitions[j].name,
+ value_str);
+ g_free (value_str);
+ break;
+
+ case G_TYPE_INT:
+ value_int = g_key_file_get_integer (keyfile,
+ group, keyfile_keys[i],
+ NULL);
+ g_settings_set_int (settings,
+ key_definitions[j].name,
+ value_int);
+ break;
+
+ case G_TYPE_BOOLEAN:
+ value_boolean = g_key_file_get_boolean (keyfile,
+ group, keyfile_keys[i],
+ NULL);
+ g_settings_set_boolean (settings,
+ key_definitions[j].name,
+ value_boolean);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
+
+ if (set_screen_to != -1 &&
+ g_strcmp0 (schema, PANEL_TOPLEVEL_SCHEMA) == 0)
+ g_settings_set_int (settings,
+ PANEL_TOPLEVEL_SCREEN_KEY,
+ set_screen_to);
+
+ GSettings *panel_settings;
+ panel_settings = g_settings_new (PANEL_SCHEMA);
+ panel_gsettings_append_strv (panel_settings,
+ id_list_key,
+ unique_id);
+ g_object_unref (panel_settings);
+
+ retval = TRUE;
+ }
+
+ if (keyfile_keys)
+ g_strfreev (keyfile_keys);
+
+ if (settings)
+ g_object_unref (settings);
+
+ if (unique_id)
+ g_free (unique_id);
+
+ return retval;
+}
+
+void
+panel_layout_apply_default_from_gkeyfile (GdkScreen *screen)
+{
+ int screen_n;
+ gchar *layout_file = NULL;
+ GKeyFile *keyfile = NULL;
+ gchar **groups = NULL;
+ GError *error = NULL;
+ int i;
+
+ screen_n = gdk_screen_get_number (screen);
+ layout_file = panel_layout_filename();
+
+ if (layout_file)
+ {
+ keyfile = g_key_file_new ();
+ if (g_key_file_load_from_file (keyfile,
+ layout_file,
+ G_KEY_FILE_NONE,
+ &error))
+ {
+ groups = g_key_file_get_groups (keyfile, NULL);
+
+ for (i = 0; groups[i] != NULL; i++) {
+
+ if (g_strcmp0 (groups[i], "Toplevel") == 0 ||
+ g_str_has_prefix (groups[i], "Toplevel "))
+
+ panel_layout_append_group_helper (
+ keyfile, groups[i],
+ screen_n,
+ "Toplevel",
+ PANEL_TOPLEVEL_ID_LIST_KEY,
+ PANEL_TOPLEVEL_SCHEMA,
+ PANEL_TOPLEVEL_PATH,
+ PANEL_TOPLEVEL_DEFAULT_PREFIX,
+ panel_layout_toplevel_keys,
+ G_N_ELEMENTS (panel_layout_toplevel_keys),
+ "toplevel");
+
+ else if (g_strcmp0 (groups[i], "Object") == 0 ||
+ g_str_has_prefix (groups[i], "Object "))
+
+ panel_layout_append_group_helper (
+ keyfile, groups[i],
+ -1,
+ "Object",
+ PANEL_OBJECT_ID_LIST_KEY,
+ PANEL_OBJECT_SCHEMA,
+ PANEL_OBJECT_PATH,
+ PANEL_OBJECT_DEFAULT_PREFIX,
+ panel_layout_object_keys,
+ G_N_ELEMENTS (panel_layout_object_keys),
+ "object");
+
+ else
+
+ g_warning ("Unknown group in default layout: '%s'",
+ groups[i]);
+
+ }
+
+ }
+ else
+ {
+ g_warning ("Error while parsing default layout from '%s': %s\n",
+ layout_file, error->message);
+ g_error_free (error);
+ }
+
+ }
+ else {
+ g_warning ("Cant find a default layout file!");
+ /* FIXME implement a fallback panel */
+ }
+
+ if (groups)
+ g_strfreev (groups);
+
+ if (keyfile)
+ g_key_file_free (keyfile);
+
+ if (layout_file)
+ g_free (layout_file);
+}
diff --git a/mate-panel/panel-layout.h b/mate-panel/panel-layout.h
new file mode 100644
index 00000000..3d50e292
--- /dev/null
+++ b/mate-panel/panel-layout.h
@@ -0,0 +1,38 @@
+/*
+ * panel-layout.h: methods to load default panels from file
+ *
+ * Copyright (C) 2012 Stefano Karapetsas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ * Stefano Karapetsas <[email protected]>
+ */
+
+#ifndef __PANEL_LAYOUT_H__
+#define __PANEL_LAYOUT_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+void panel_layout_apply_default_from_gkeyfile (GdkScreen *screen);
+
+G_END_DECLS
+
+#endif /* __PANEL_LAYOUT_H__ */
diff --git a/mate-panel/panel-lockdown.c b/mate-panel/panel-lockdown.c
index e484b016..953944c6 100644
--- a/mate-panel/panel-lockdown.c
+++ b/mate-panel/panel-lockdown.c
@@ -27,18 +27,8 @@
#include "panel-lockdown.h"
#include <string.h>
-#include "panel-mateconf.h"
-
-#define N_LISTENERS 6
-
-#define PANEL_GLOBAL_LOCKDOWN_DIR "/apps/panel/global"
-#define DESKTOP_MATE_LOCKDOWN_DIR "/desktop/mate/lockdown"
-#define PANEL_GLOBAL_LOCKED_DOWN_KEY PANEL_GLOBAL_LOCKDOWN_DIR "/locked_down"
-#define DISABLE_COMMAND_LINE_KEY DESKTOP_MATE_LOCKDOWN_DIR "/disable_command_line"
-#define DISABLE_LOCK_SCREEN_KEY DESKTOP_MATE_LOCKDOWN_DIR "/disable_lock_screen"
-#define DISABLE_LOG_OUT_KEY PANEL_GLOBAL_LOCKDOWN_DIR "/disable_log_out"
-#define DISABLE_FORCE_QUIT_KEY PANEL_GLOBAL_LOCKDOWN_DIR "/disable_force_quit"
-#define DISABLED_APPLETS_KEY PANEL_GLOBAL_LOCKDOWN_DIR "/disabled_applets"
+#include <gio/gio.h>
+#include "panel-schemas.h"
typedef struct {
guint initialized : 1;
@@ -49,11 +39,12 @@ typedef struct {
guint disable_log_out : 1;
guint disable_force_quit : 1;
- GSList *disabled_applets;
-
- guint listeners [N_LISTENERS];
+ gchar **disabled_applets;
GSList *closures;
+
+ GSettings *panel_settings;
+ GSettings *lockdown_settings;
} PanelLockdown;
static PanelLockdown panel_lockdown = { 0, };
@@ -69,148 +60,95 @@ panel_lockdown_invoke_closures (PanelLockdown *lockdown)
}
static void
-locked_down_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+locked_down_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- lockdown->locked_down = mateconf_value_get_bool (entry->value);
-
+ lockdown->locked_down = g_settings_get_boolean (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static void
-disable_command_line_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+disable_command_line_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- lockdown->disable_command_line = mateconf_value_get_bool (entry->value);
-
+ lockdown->disable_command_line = g_settings_get_boolean (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static void
-disable_lock_screen_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+disable_lock_screen_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- lockdown->disable_lock_screen = mateconf_value_get_bool (entry->value);
-
+ lockdown->disable_lock_screen = g_settings_get_boolean (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static void
-disable_log_out_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+disable_log_out_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- lockdown->disable_log_out = mateconf_value_get_bool (entry->value);
-
+ lockdown->disable_log_out = g_settings_get_boolean (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static void
-disable_force_quit_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+disable_force_quit_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- if (!entry->value || entry->value->type != MATECONF_VALUE_BOOL)
- return;
-
- lockdown->disable_force_quit = mateconf_value_get_bool (entry->value);
-
+ lockdown->disable_force_quit = g_settings_get_boolean (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static void
-disabled_applets_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+disabled_applets_notify (GSettings *settings,
+ gchar *key,
PanelLockdown *lockdown)
{
- GSList *l;
-
- if (!entry->value || entry->value->type != MATECONF_VALUE_LIST ||
- mateconf_value_get_list_type (entry->value) != MATECONF_VALUE_STRING)
- return;
-
- for (l = lockdown->disabled_applets; l; l = l->next)
- g_free (l->data);
- g_slist_free (lockdown->disabled_applets);
- lockdown->disabled_applets = NULL;
-
- for (l = mateconf_value_get_list (entry->value); l; l = l->next) {
- const char *iid = mateconf_value_get_string (l->data);
-
- lockdown->disabled_applets =
- g_slist_prepend (lockdown->disabled_applets,
- g_strdup (iid));
- }
-
+ lockdown->disabled_applets = g_settings_get_strv (settings, key);
panel_lockdown_invoke_closures (lockdown);
}
static gboolean
panel_lockdown_load_bool (PanelLockdown *lockdown,
- MateConfClient *client,
+ GSettings *settings,
const char *key,
- MateConfClientNotifyFunc notify_func,
- int listener)
+ GCallback notify_func)
{
- GError *error = NULL;
gboolean retval;
+ gchar *signal_name;
- retval = mateconf_client_get_bool (client, key, &error);
- if (error) {
- g_warning ("Error getting value of '%s': %s\n",
- key, error->message);
- retval = FALSE;
- }
+ retval = g_settings_get_boolean (settings, key);
+
+ signal_name = g_strdup_printf ("changed::%s", key);
- lockdown->listeners [listener] =
- mateconf_client_notify_add (client,
- key,
- notify_func,
- lockdown,
- NULL, NULL);
+ g_signal_connect (settings,
+ signal_name,
+ G_CALLBACK (notify_func),
+ lockdown);
+
+ g_free (signal_name);
return retval;
}
-static GSList *
+static gchar **
panel_lockdown_load_disabled_applets (PanelLockdown *lockdown,
- MateConfClient *client,
- int listener)
+ GSettings *settings)
{
- GSList *retval;
+ gchar **retval;
- retval = mateconf_client_get_list (client,
- DISABLED_APPLETS_KEY,
- MATECONF_VALUE_STRING,
- NULL);
+ retval = g_settings_get_strv (settings,
+ PANEL_DISABLED_APPLETS_KEY);
- lockdown->listeners [listener] =
- mateconf_client_notify_add (client,
- DISABLED_APPLETS_KEY,
- (MateConfClientNotifyFunc) disabled_applets_notify,
- lockdown,
- NULL, NULL);
+ g_signal_connect (settings,
+ "changed::" PANEL_DISABLED_APPLETS_KEY,
+ G_CALLBACK (disabled_applets_notify),
+ lockdown);
return retval;
}
@@ -218,62 +156,42 @@ panel_lockdown_load_disabled_applets (PanelLockdown *lockdown,
void
panel_lockdown_init (void)
{
- MateConfClient *client;
- int i = 0;
-
- client = panel_mateconf_get_client ();
-
- mateconf_client_add_dir (client,
- DESKTOP_MATE_LOCKDOWN_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
-
- mateconf_client_add_dir (client,
- PANEL_GLOBAL_LOCKDOWN_DIR,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
+ panel_lockdown.panel_settings = g_settings_new (PANEL_SCHEMA);
+ panel_lockdown.lockdown_settings = g_settings_new (LOCKDOWN_SCHEMA);
panel_lockdown.locked_down =
panel_lockdown_load_bool (&panel_lockdown,
- client,
- PANEL_GLOBAL_LOCKED_DOWN_KEY,
- (MateConfClientNotifyFunc) locked_down_notify,
- i++);
+ panel_lockdown.panel_settings,
+ PANEL_LOCKED_DOWN_KEY,
+ G_CALLBACK (locked_down_notify));
panel_lockdown.disable_command_line =
panel_lockdown_load_bool (&panel_lockdown,
- client,
- DISABLE_COMMAND_LINE_KEY,
- (MateConfClientNotifyFunc) disable_command_line_notify,
- i++);
+ panel_lockdown.lockdown_settings,
+ LOCKDOWN_DISABLE_COMMAND_LINE_KEY,
+ G_CALLBACK (disable_command_line_notify));
panel_lockdown.disable_lock_screen =
panel_lockdown_load_bool (&panel_lockdown,
- client,
- DISABLE_LOCK_SCREEN_KEY,
- (MateConfClientNotifyFunc) disable_lock_screen_notify,
- i++);
+ panel_lockdown.lockdown_settings,
+ LOCKDOWN_DISABLE_LOCK_SCREEN_KEY,
+ G_CALLBACK (disable_lock_screen_notify));
panel_lockdown.disable_log_out =
panel_lockdown_load_bool (&panel_lockdown,
- client,
- DISABLE_LOG_OUT_KEY,
- (MateConfClientNotifyFunc) disable_log_out_notify,
- i++);
+ panel_lockdown.panel_settings,
+ PANEL_DISABLE_LOG_OUT_KEY,
+ G_CALLBACK (disable_log_out_notify));
panel_lockdown.disable_force_quit =
panel_lockdown_load_bool (&panel_lockdown,
- client,
- DISABLE_FORCE_QUIT_KEY,
- (MateConfClientNotifyFunc) disable_force_quit_notify,
- i++);
+ panel_lockdown.panel_settings,
+ PANEL_DISABLE_FORCE_QUIT_KEY,
+ G_CALLBACK (disable_force_quit_notify));
panel_lockdown.disabled_applets =
panel_lockdown_load_disabled_applets (&panel_lockdown,
- client,
- i++);
-
- g_assert (i == N_LISTENERS);
+ panel_lockdown.panel_settings);
panel_lockdown.initialized = TRUE;
}
@@ -281,33 +199,23 @@ panel_lockdown_init (void)
void
panel_lockdown_finalize (void)
{
- MateConfClient *client;
- GSList *l;
- int i;
+ GSList *l;
g_assert (panel_lockdown.initialized != FALSE);
- client = panel_mateconf_get_client ();
-
- for (l = panel_lockdown.disabled_applets; l; l = l->next)
- g_free (l->data);
- g_slist_free (panel_lockdown.disabled_applets);
- panel_lockdown.disabled_applets = NULL;
-
- for (i = 0; i < N_LISTENERS; i++) {
- if (panel_lockdown.listeners [i])
- mateconf_client_notify_remove (client,
- panel_lockdown.listeners [i]);
- panel_lockdown.listeners [i] = 0;
+ if (panel_lockdown.disabled_applets) {
+ g_strfreev (panel_lockdown.disabled_applets);
+ panel_lockdown.disabled_applets = NULL;
}
- mateconf_client_remove_dir (client,
- PANEL_GLOBAL_LOCKDOWN_DIR,
- NULL);
-
- mateconf_client_remove_dir (client,
- DESKTOP_MATE_LOCKDOWN_DIR,
- NULL);
+ if (panel_lockdown.panel_settings) {
+ g_object_unref (panel_lockdown.panel_settings);
+ panel_lockdown.panel_settings = NULL;
+ }
+ if (panel_lockdown.lockdown_settings) {
+ g_object_unref (panel_lockdown.lockdown_settings);
+ panel_lockdown.lockdown_settings = NULL;
+ }
for (l = panel_lockdown.closures; l; l = l->next)
g_closure_unref (l->data);
@@ -360,13 +268,14 @@ panel_lockdown_get_disable_force_quit (void)
gboolean
panel_lockdown_is_applet_disabled (const char *iid)
{
- GSList *l;
+ gint i;
g_assert (panel_lockdown.initialized != FALSE);
- for (l = panel_lockdown.disabled_applets; l; l = l->next)
- if (!strcmp (l->data, iid))
- return TRUE;
+ if (panel_lockdown.disabled_applets)
+ for (i = 0; panel_lockdown.disabled_applets[i]; i++)
+ if (!strcmp (panel_lockdown.disabled_applets[i], iid))
+ return TRUE;
return FALSE;
}
diff --git a/mate-panel/panel-mateconf.c b/mate-panel/panel-mateconf.c
deleted file mode 100644
index 974ddb4b..00000000
--- a/mate-panel/panel-mateconf.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * panel-mateconf.c: panel mateconf utility methods
- *
- * Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Authors:
- * Mark McLoughlin <[email protected]>
- * Glynn Foster <[email protected]>
- */
-
-#include <config.h>
-
-#include "panel-mateconf.h"
-
-#include <string.h>
-#include <glib.h>
-#include <mateconf/mateconf-client.h>
-
-#include <libpanel-util/panel-cleanup.h>
-
-#undef PANEL_MATECONF_DEBUG
-
-MateConfClient *
-panel_mateconf_get_client (void)
-{
- static MateConfClient *panel_mateconf_client = NULL;
-
- if (!panel_mateconf_client) {
- panel_mateconf_client = mateconf_client_get_default ();
- panel_cleanup_register (panel_cleanup_unref_and_nullify,
- &panel_mateconf_client);
- }
-
- return panel_mateconf_client;
-}
-
-/*
- * panel_mateconf_sprintf:
- * @format: the format string. See sprintf() documentation.
- * @...: the arguments to be inserted.
- *
- * This is a version of sprintf using a static buffer which is
- * intended for use in generating the full mateconf key for all panel
- * config keys.
- * Note, you should not free the return value from this function and
- * you should realize that the return value will get overwritten or
- * freed by a subsequent call to this function.
- *
- * Return Value: a pointer to the static string buffer.
- */
-const char *
-panel_mateconf_sprintf (const char *format,
- ...)
-{
- static char *buffer = NULL;
- static int buflen = 128;
- va_list args;
- int len;
-
- if (!buffer)
- buffer = g_new (char, buflen);
-
- va_start (args, format);
- len = g_vsnprintf (buffer, buflen, format, args);
-
- if (len >= buflen) {
- int i;
-
- /* Round up length to the nearest power of 2 */
- for (i = 0; len != 1; i++, len >>= 1);
-
- buflen = len << (i + 1);
- g_assert (buflen > 0);
-
- g_free (buffer);
- buffer = g_new (char, buflen);
-
- va_start (args, format);
- len = g_vsnprintf (buffer, buflen, format, args);
-
- g_assert (len < buflen);
- }
-
- va_end (args);
-
- return buffer;
-}
-
-const char *
-panel_mateconf_key_type_to_id_list (PanelMateConfKeyType type)
-{
- char *retval;
-
- switch (type) {
- case PANEL_MATECONF_TOPLEVELS:
- retval = "toplevel_id_list";
- break;
- case PANEL_MATECONF_APPLETS:
- retval = "applet_id_list";
- break;
- case PANEL_MATECONF_OBJECTS:
- retval = "object_id_list";
- break;
- default:
- retval = NULL;
- g_assert_not_reached ();
- break;
- }
-
- return retval;
-}
-
-const char *
-panel_mateconf_global_key (const char *key)
-{
- return panel_mateconf_sprintf ("/apps/panel/global/%s", key);
-}
-
-const char *
-panel_mateconf_general_key (const char *key)
-{
- return panel_mateconf_sprintf (PANEL_CONFIG_DIR "/general/%s", key);
-}
-
-const char *
-panel_mateconf_full_key (PanelMateConfKeyType type,
- const char *id,
- const char *key)
-{
- char *subdir = NULL;
-
- switch (type) {
- case PANEL_MATECONF_TOPLEVELS:
- subdir = "toplevels";
- break;
- case PANEL_MATECONF_OBJECTS:
- subdir = "objects";
- break;
- case PANEL_MATECONF_APPLETS:
- subdir = "applets";
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return panel_mateconf_sprintf (PANEL_CONFIG_DIR "/%s/%s/%s",
- subdir, id, key);
-}
-
-const char *
-panel_mateconf_basename (const char *key)
-{
- char *retval;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- retval = strrchr (key, '/');
-
- return retval ? retval + 1 : NULL;
-}
-
-char *
-panel_mateconf_dirname (const char *key)
-{
- char *retval;
- int len;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- retval = strrchr (key, '/');
- g_assert (retval != NULL);
-
- len = retval - key;
- g_assert (len > 0);
-
- retval = g_new0 (char, len + 1);
- memcpy (retval, key, len);
-
- return retval;
-}
-
-static void
-panel_notify_object_dead (guint notify_id)
-{
- MateConfClient *client;
-
- client = panel_mateconf_get_client ();
-
- mateconf_client_notify_remove (client, notify_id);
-}
-
-guint
-panel_mateconf_notify_add_while_alive (const char *key,
- MateConfClientNotifyFunc notify_func,
- GObject *alive_object)
-{
- MateConfClient *client;
- guint notify_id;
-
- g_return_val_if_fail (G_IS_OBJECT (alive_object), 0);
-
- client = panel_mateconf_get_client ();
-
- notify_id = mateconf_client_notify_add (client, key, notify_func,
- alive_object, NULL, NULL);
-
- if (notify_id > 0)
- g_object_weak_ref (alive_object,
- (GWeakNotify) panel_notify_object_dead,
- GUINT_TO_POINTER (notify_id));
-
- return notify_id;
-}
-
-void
-panel_mateconf_copy_dir (MateConfClient *client,
- const char *src_dir,
- const char *dest_dir)
-{
- GSList *list, *l;
-
- list = mateconf_client_all_entries (client, src_dir, NULL);
- for (l = list; l; l = l->next) {
- MateConfEntry *entry = l->data;
- const char *key;
- char *tmp;
-
- tmp = g_path_get_basename (mateconf_entry_get_key (entry));
- key = panel_mateconf_sprintf ("%s/%s", dest_dir, tmp);
- g_free (tmp);
-
- mateconf_engine_associate_schema (client->engine,
- key,
- mateconf_entry_get_schema_name (entry),
- NULL);
-
- if (!mateconf_entry_get_is_default (entry) && entry->value)
- mateconf_client_set (client, key, entry->value, NULL);
-
- mateconf_entry_unref (entry);
- }
- g_slist_free (list);
-
- list = mateconf_client_all_dirs (client, src_dir, NULL);
- for (l = list; l; l = l->next) {
- char *subdir = l->data;
- char *src_subdir;
- char *dest_subdir;
- char *tmp;
-
- tmp = g_path_get_basename (subdir);
- src_subdir = mateconf_concat_dir_and_key (src_dir, tmp);
- dest_subdir = mateconf_concat_dir_and_key (dest_dir, tmp);
- g_free (tmp);
-
- panel_mateconf_copy_dir (client, src_subdir, dest_subdir);
-
- g_free (src_subdir);
- g_free (dest_subdir);
- g_free (subdir);
- }
-
- g_slist_free (list);
-}
-
-void
-panel_mateconf_associate_schemas_in_dir (MateConfClient *client,
- const char *profile_dir,
- const char *schema_dir)
-{
- GSList *list, *l;
-
-#ifdef PANEL_MATECONF_DEBUG
- g_print ("associating schemas in %s to %s\n", schema_dir, profile_dir);
-#endif
-
- list = mateconf_client_all_entries (client, schema_dir, NULL);
- for (l = list; l; l = l->next) {
- MateConfEntry *entry = l->data;
- const char *key;
- char *tmp;
-
- tmp = g_path_get_basename (mateconf_entry_get_key (entry));
-
- key = panel_mateconf_sprintf ("%s/%s", profile_dir, tmp);
-
- g_free (tmp);
-
- mateconf_engine_associate_schema (
- client->engine, key, mateconf_entry_get_key (entry), NULL);
-
- mateconf_entry_unref (entry);
- }
-
- g_slist_free (list);
-
- list = mateconf_client_all_dirs (client, schema_dir, NULL);
- for (l = list; l; l = l->next) {
- char *subdir = l->data;
- char *prefs_subdir;
- char *schema_subdir;
- char *tmp;
-
- tmp = g_path_get_basename (subdir);
-
- prefs_subdir = g_strdup_printf ("%s/%s", profile_dir, tmp);
- schema_subdir = g_strdup_printf ("%s/%s", schema_dir, tmp);
-
- panel_mateconf_associate_schemas_in_dir (
- client, prefs_subdir, schema_subdir);
-
- g_free (prefs_subdir);
- g_free (schema_subdir);
- g_free (subdir);
- g_free (tmp);
- }
-
- g_slist_free (list);
-}
-
-gint
-panel_mateconf_value_strcmp (gconstpointer a,
- gconstpointer b)
-{
- const char *str_a;
- const char *str_b;
-
- if (a == b || !a || !b)
- return 0;
-
- str_a = mateconf_value_get_string (a);
- str_b = mateconf_value_get_string (b);
-
- return strcmp (str_a, str_b);
-}
diff --git a/mate-panel/panel-mateconf.h b/mate-panel/panel-mateconf.h
deleted file mode 100644
index 80c49fa5..00000000
--- a/mate-panel/panel-mateconf.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * panel-mateconf.h: panel mateconf utility methods
- *
- * Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Authors:
- * Mark McLoughlin <[email protected]>
- * Glynn Foster <[email protected]>
- */
-
-#ifndef __PANEL_MATECONF_H__
-#define __PANEL_MATECONF_H__
-
-#include <mateconf/mateconf-client.h>
-
-#include "panel-enums.h"
-
-#define PANEL_CONFIG_DIR "/apps/panel"
-#define PANEL_SCHEMAS_DIR "/schemas/apps/panel"
-#define PANEL_DEFAULTS_DIR "/apps/panel/default_setup"
-#define PANEL_OLD_CONFIG_DIR "/apps/panel/profiles/default"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-MateConfClient *panel_mateconf_get_client (void);
-
-const char *panel_mateconf_sprintf (const char *format, ...) G_GNUC_PRINTF (1, 2);
-const char *panel_mateconf_basename (const char *key);
-char *panel_mateconf_dirname (const char *key);
-const char *panel_mateconf_global_key (const char *key);
-const char *panel_mateconf_general_key (const char *key);
-const char *panel_mateconf_full_key (PanelMateConfKeyType type,
- const char *id,
- const char *key);
-const char *panel_mateconf_key_type_to_id_list (PanelMateConfKeyType type);
-
-guint panel_mateconf_notify_add (const char *key,
- MateConfClientNotifyFunc notify_func,
- gpointer user_data);
-guint panel_mateconf_notify_add_while_alive (const char *key,
- MateConfClientNotifyFunc notify_func,
- GObject *alive_object);
-
-void panel_mateconf_copy_dir (MateConfClient *client,
- const char *src_dir,
- const char *dest_dir);
-
-void panel_mateconf_associate_schemas_in_dir (MateConfClient *client,
- const char *profile_dir,
- const char *schema_dir);
-
-gint panel_mateconf_value_strcmp (gconstpointer a,
- gconstpointer b);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PANEL_MATECONF_H__ */
diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c
index 1a2d3ac6..16a62d06 100644
--- a/mate-panel/panel-menu-bar.c
+++ b/mate-panel/panel-menu-bar.c
@@ -302,7 +302,7 @@ static void panel_menu_bar_load(PanelWidget* panel, gboolean locked, int positio
panel_widget_set_applet_expandable(panel, GTK_WIDGET(menubar), FALSE, TRUE);
}
-void panel_menu_bar_load_from_mateconf(PanelWidget* panel, gboolean locked, int position, gboolean exactpos, const char* id)
+void panel_menu_bar_load_from_gsettings (PanelWidget* panel, gboolean locked, int position, gboolean exactpos, const char* id)
{
panel_menu_bar_load(panel, locked, position, exactpos, id);
}
@@ -312,7 +312,7 @@ void panel_menu_bar_create(PanelToplevel* toplevel, int position)
char* id;
id = panel_profile_prepare_object(PANEL_OBJECT_MENU_BAR, toplevel, position, FALSE);
- panel_profile_add_to_list(PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list(PANEL_GSETTINGS_OBJECTS, id);
g_free(id);
}
diff --git a/mate-panel/panel-menu-bar.h b/mate-panel/panel-menu-bar.h
index 43672da9..6fe47d09 100644
--- a/mate-panel/panel-menu-bar.h
+++ b/mate-panel/panel-menu-bar.h
@@ -58,7 +58,7 @@ GType panel_menu_bar_get_type (void) G_GNUC_CONST;
void panel_menu_bar_create (PanelToplevel *toplevel,
int position);
-void panel_menu_bar_load_from_mateconf (PanelWidget *panel,
+void panel_menu_bar_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
gboolean exactpos,
diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c
index 091c3993..b78d973b 100644
--- a/mate-panel/panel-menu-button.c
+++ b/mate-panel/panel-menu-button.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <matemenu-tree.h>
@@ -44,6 +45,7 @@
#include "panel-lockdown.h"
#include "panel-a11y.h"
#include "panel-icon-names.h"
+#include "panel-schemas.h"
G_DEFINE_TYPE (PanelMenuButton, panel_menu_button, BUTTON_TYPE_WIDGET)
@@ -56,6 +58,7 @@ enum {
PROP_TOOLTIP,
PROP_USE_MENU_PATH,
PROP_USE_CUSTOM_ICON,
+ PROP_HAS_ARROW,
PROP_DND_ENABLED
};
@@ -80,7 +83,7 @@ static MenuPathRootItem root_items[] = {
struct _PanelMenuButtonPrivate {
PanelToplevel *toplevel;
- guint mateconf_notify;
+ GSettings *settings;
char *applet_id;
GtkWidget *menu;
@@ -92,10 +95,11 @@ struct _PanelMenuButtonPrivate {
MenuPathRoot path_root;
guint use_menu_path : 1;
guint use_custom_icon : 1;
+ guint has_arrow : 1;
guint dnd_enabled : 1;
};
-static void panel_menu_button_disconnect_from_mateconf (PanelMenuButton *button);
+static void panel_menu_button_disconnect_from_gsettings (PanelMenuButton *button);
static void panel_menu_button_recreate_menu (PanelMenuButton *button);
static void panel_menu_button_set_icon (PanelMenuButton *button);
@@ -172,15 +176,15 @@ panel_menu_button_init (PanelMenuButton *button)
button->priv->applet_id = NULL;
button->priv->toplevel = NULL;
- button->priv->mateconf_notify = 0;
button->priv->menu_path = NULL;
button->priv->custom_icon = NULL;
- button->priv->tooltip = NULL;
+ button->priv->tooltip = NULL;
button->priv->path_root = LAST_MENU;
button->priv->use_menu_path = FALSE;
button->priv->use_custom_icon = FALSE;
+ button->priv->has_arrow = FALSE;
}
static void
@@ -191,7 +195,7 @@ panel_menu_button_finalize (GObject *object)
panel_lockdown_notify_remove (G_CALLBACK (panel_menu_button_recreate_menu),
button);
- panel_menu_button_disconnect_from_mateconf (button);
+ panel_menu_button_disconnect_from_gsettings (button);
if (button->priv->menu) {
/* detaching the menu will kill our reference */
@@ -242,6 +246,9 @@ panel_menu_button_get_property (GObject *object,
case PROP_USE_CUSTOM_ICON:
g_value_set_boolean (value, button->priv->use_custom_icon);
break;
+ case PROP_HAS_ARROW:
+ g_value_set_boolean (value, button->priv->has_arrow);
+ break;
case PROP_DND_ENABLED:
g_value_set_boolean (value, button->priv->dnd_enabled);
break;
@@ -279,6 +286,9 @@ panel_menu_button_set_property (GObject *object,
case PROP_USE_CUSTOM_ICON:
panel_menu_button_set_use_custom_icon (button, g_value_get_boolean (value));
break;
+ case PROP_HAS_ARROW:
+ panel_menu_button_set_has_arrow (button, g_value_get_boolean (value));
+ break;
case PROP_DND_ENABLED:
panel_menu_button_set_dnd_enabled (button, g_value_get_boolean (value));
break;
@@ -543,6 +553,16 @@ panel_menu_button_class_init (PanelMenuButtonClass *klass)
FALSE,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ gobject_class,
+ PROP_HAS_ARROW,
+ g_param_spec_boolean ("has-arrow",
+ "Has Arrow",
+ "Determine if an arrow is drawn over the menu button icon",
+ FALSE,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (
gobject_class,
PROP_DND_ENABLED,
@@ -554,76 +574,52 @@ panel_menu_button_class_init (PanelMenuButtonClass *klass)
}
static void
-panel_menu_button_mateconf_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- PanelMenuButton *button)
+panel_menu_button_gsettings_notify (GSettings *settings,
+ gchar *key,
+ PanelMenuButton *button)
{
- MateConfValue *value;
- const char *key;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
-
- value = entry->value;
-
- if (!strcmp (key, "menu_path")) {
- if (value && value->type == MATECONF_VALUE_STRING)
- panel_menu_button_set_menu_path (button,
- mateconf_value_get_string (value));
- } else if (!strcmp (key, "custom_icon")) {
- if (value && value->type == MATECONF_VALUE_STRING)
- panel_menu_button_set_custom_icon (button,
- mateconf_value_get_string (value));
- } else if (!strcmp (key, "tooltip")) {
- if (value && value->type == MATECONF_VALUE_STRING)
- panel_menu_button_set_tooltip (button,
- mateconf_value_get_string (value));
- } else if (!strcmp (key, "use_menu_path")) {
- if (value && value->type == MATECONF_VALUE_BOOL)
- panel_menu_button_set_use_menu_path (button,
- mateconf_value_get_bool (value));
- } else if (!strcmp (key, "use_custom_icon")) {
- if (value && value->type == MATECONF_VALUE_BOOL)
- panel_menu_button_set_use_custom_icon (button,
- mateconf_value_get_bool (value));
+ if (!strcmp (key, PANEL_OBJECT_MENU_PATH_KEY)) {
+ panel_menu_button_set_menu_path (button,
+ g_settings_get_string (settings, key));
+ } else if (!strcmp (key, PANEL_OBJECT_CUSTOM_ICON_KEY)) {
+ panel_menu_button_set_custom_icon (button,
+ g_settings_get_string (settings, key));
+ } else if (!strcmp (key, PANEL_OBJECT_TOOLTIP_KEY)) {
+ panel_menu_button_set_tooltip (button,
+ g_settings_get_string (settings, key));
+ } else if (!strcmp (key, PANEL_OBJECT_USE_MENU_PATH_KEY)) {
+ panel_menu_button_set_use_menu_path (button,
+ g_settings_get_boolean (settings, key));
+ } else if (!strcmp (key, PANEL_OBJECT_USE_CUSTOM_ICON_KEY)) {
+ panel_menu_button_set_use_custom_icon (button,
+ g_settings_get_boolean (settings, key));
+ } else if (!strcmp (key, PANEL_OBJECT_HAS_ARROW_KEY)) {
+ panel_menu_button_set_has_arrow (button,
+ g_settings_get_boolean (settings, key));
}
}
static void
-panel_menu_button_connect_to_mateconf (PanelMenuButton *button)
+panel_menu_button_connect_to_gsettings (PanelMenuButton *button)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/objects/%s",
- button->priv->applet_id);
- mateconf_client_add_dir (client, key, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- button->priv->mateconf_notify =
- mateconf_client_notify_add (client, key,
- (MateConfClientNotifyFunc) panel_menu_button_mateconf_notify,
- button, NULL, NULL);
+ gchar *path;
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", button->priv->applet_id);
+ button->priv->settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_signal_connect (button->priv->settings,
+ "changed",
+ G_CALLBACK (panel_menu_button_gsettings_notify),
+ button);
+ g_free (path);
}
static void
-panel_menu_button_disconnect_from_mateconf (PanelMenuButton *button)
+panel_menu_button_disconnect_from_gsettings (PanelMenuButton *button)
{
- MateConfClient *client;
- const char *key;
-
- if (!button->priv->mateconf_notify)
- return;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/objects/%s",
- button->priv->applet_id);
-
- mateconf_client_notify_remove (client, button->priv->mateconf_notify);
- button->priv->mateconf_notify = 0;
-
- mateconf_client_remove_dir (client, key, NULL);
+ if (button->priv->settings)
+ {
+ g_object_unref (button->priv->settings);
+ button->priv->settings = NULL;
+ }
}
static void
@@ -674,7 +670,7 @@ panel_menu_button_load (const char *menu_path,
panel_widget_set_applet_expandable (panel, GTK_WIDGET (button), FALSE, TRUE);
panel_widget_set_applet_size_constrained (panel, GTK_WIDGET (button), TRUE);
- panel_menu_button_connect_to_mateconf (button);
+ panel_menu_button_connect_to_gsettings (button);
panel_lockdown_notify_add (G_CALLBACK (panel_menu_button_recreate_menu),
button);
@@ -866,14 +862,26 @@ panel_menu_button_set_use_custom_icon (PanelMenuButton *button,
}
void
-panel_menu_button_load_from_mateconf (PanelWidget *panel,
+panel_menu_button_set_has_arrow (PanelMenuButton *button,
+ gboolean has_arrow)
+{
+ g_return_if_fail (PANEL_IS_MENU_BUTTON (button));
+
+ button->priv->has_arrow = has_arrow != FALSE;
+
+ button_widget_set_has_arrow (BUTTON_WIDGET (button), has_arrow);
+}
+
+
+void
+panel_menu_button_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
gboolean exactpos,
const char *id)
{
- MateConfClient *client;
- const char *key;
+ GSettings *settings;
+ gchar *path;
char *menu_path;
char *custom_icon;
char *tooltip;
@@ -881,25 +889,15 @@ panel_menu_button_load_from_mateconf (PanelWidget *panel,
gboolean use_custom_icon;
gboolean has_arrow;
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "menu_path");
- menu_path = mateconf_client_get_string (client, key, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "custom_icon");
- custom_icon = mateconf_client_get_string (client, key, NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "tooltip");
- tooltip = mateconf_client_get_string (client, key, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "use_menu_path");
- use_menu_path = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "use_custom_icon");
- use_custom_icon = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "has_arrow");
- has_arrow = mateconf_client_get_bool (client, key, NULL);
+ menu_path = g_settings_get_string (settings, PANEL_OBJECT_MENU_PATH_KEY);
+ custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY);
+ tooltip = g_settings_get_string (settings, PANEL_OBJECT_TOOLTIP_KEY);
+ use_menu_path = g_settings_get_boolean (settings, PANEL_OBJECT_USE_MENU_PATH_KEY);
+ use_custom_icon = g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY);
+ has_arrow = g_settings_get_boolean (settings, PANEL_OBJECT_HAS_ARROW_KEY);
panel_menu_button_load (menu_path,
use_menu_path,
@@ -916,6 +914,8 @@ panel_menu_button_load_from_mateconf (PanelWidget *panel,
g_free (menu_path);
g_free (custom_icon);
g_free (tooltip);
+ g_free (path);
+ g_object_unref (settings);
}
gboolean
@@ -926,44 +926,43 @@ panel_menu_button_create (PanelToplevel *toplevel,
gboolean use_menu_path,
const char *tooltip)
{
- MateConfClient *client;
+ GSettings *settings;
+ gchar *path;
const char *scheme;
- const char *key;
char *id;
- client = panel_mateconf_get_client ();
-
id = panel_profile_prepare_object (PANEL_OBJECT_MENU, toplevel, position, FALSE);
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "use_menu_path");
- mateconf_client_set_bool (client, key, use_menu_path, NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+
+ g_settings_set_boolean (settings, PANEL_OBJECT_USE_MENU_PATH_KEY, use_menu_path);
scheme = panel_menu_filename_to_scheme (filename);
if (filename && !scheme) {
g_warning ("Failed to find menu scheme for %s\n", filename);
g_free (id);
+ g_free (path);
+ g_object_unref (settings);
return FALSE;
}
if (use_menu_path && menu_path && menu_path [0] && scheme) {
- char *menu_uri;
-
+ char *menu_uri;
menu_uri = g_strconcat (scheme, ":", menu_path, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "menu_path");
- mateconf_client_set_string (client, key, menu_uri, NULL);
-
+ g_settings_set_string (settings, PANEL_OBJECT_MENU_PATH_KEY, menu_uri);
g_free (menu_uri);
}
if (tooltip && tooltip [0]) {
- key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "tooltip");
- mateconf_client_set_string (client, key, tooltip, NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_TOOLTIP_KEY, tooltip);
}
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
+ g_free (path);
+ g_object_unref (settings);
return TRUE;
}
diff --git a/mate-panel/panel-menu-button.h b/mate-panel/panel-menu-button.h
index c6c9d564..66755079 100644
--- a/mate-panel/panel-menu-button.h
+++ b/mate-panel/panel-menu-button.h
@@ -74,8 +74,10 @@ void panel_menu_button_set_use_menu_path (PanelMenuButton *button,
gboolean panel_menu_button_get_use_menu_path (PanelMenuButton *button);
void panel_menu_button_set_use_custom_icon (PanelMenuButton *button,
gboolean use_custom_icon);
+void panel_menu_button_set_has_arrow (PanelMenuButton *button,
+ gboolean has_arrow);
-void panel_menu_button_load_from_mateconf (PanelWidget *panel,
+void panel_menu_button_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
gboolean exactpos,
diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c
index bd234de9..46c9a6a3 100644
--- a/mate-panel/panel-menu-items.c
+++ b/mate-panel/panel-menu-items.c
@@ -54,13 +54,9 @@
#include "panel-recent.h"
#include "panel-stock-icons.h"
#include "panel-util.h"
+#include "panel-schemas.h"
#define BOOKMARKS_FILENAME ".gtk-bookmarks"
-#define DESKTOP_IS_HOME_DIR_DIR "/apps/caja/preferences"
-#define DESKTOP_IS_HOME_DIR_KEY "/apps/caja/preferences/desktop_is_home_dir"
-#define NAMES_DIR "/apps/caja/desktop"
-#define HOME_NAME_KEY "/apps/caja/desktop/home_icon_name"
-#define COMPUTER_NAME_KEY "/apps/caja/desktop/computer_icon_name"
#define MAX_ITEMS_OR_SUBMENU 8
#define MAX_BOOKMARK_ITEMS 100
@@ -76,6 +72,9 @@ struct _PanelPlaceMenuItemPrivate {
GtkWidget *menu;
PanelWidget *panel;
+ GSettings *caja_desktop_settings;
+ GSettings *caja_prefs_settings;
+
GtkRecentManager *recent_manager;
GFileMonitor *bookmarks_monitor;
@@ -1027,7 +1026,7 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
{
GtkWidget *places_menu;
GtkWidget *item;
- char *mateconf_name;
+ char *gsettings_name;
char *name;
char *uri;
GFile *file;
@@ -1048,9 +1047,8 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
g_free (name);
g_free (uri);
- if (!mateconf_client_get_bool (panel_mateconf_get_client (),
- DESKTOP_IS_HOME_DIR_KEY,
- NULL)) {
+ if (!g_settings_get_boolean (place_item->priv->caja_prefs_settings,
+ CAJA_PREFS_DESKTOP_IS_HOME_DIR_KEY)) {
file = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
uri = g_file_get_uri (file);
g_object_unref (file);
@@ -1072,15 +1070,14 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
panel_place_menu_item_append_gtk_bookmarks (places_menu);
add_menu_separator (places_menu);
- mateconf_name = mateconf_client_get_string (panel_mateconf_get_client (),
- COMPUTER_NAME_KEY,
- NULL);
+ gsettings_name = g_settings_get_string (place_item->priv->caja_desktop_settings,
+ CAJA_DESKTOP_COMPUTER_ICON_NAME_KEY);
panel_menu_items_append_from_desktop (places_menu,
"caja-computer.desktop",
- mateconf_name,
+ gsettings_name,
TRUE);
- if (mateconf_name)
- g_free (mateconf_name);
+ if (gsettings_name)
+ g_free (gsettings_name);
panel_place_menu_item_append_local_gio (place_item, places_menu);
add_menu_separator (places_menu);
@@ -1130,9 +1127,8 @@ panel_place_menu_item_recreate_menu (GtkWidget *widget)
}
static void
-panel_place_menu_item_key_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_place_menu_item_key_changed (GSettings *settings,
+ gchar *key,
GtkWidget *place_item)
{
panel_place_menu_item_recreate_menu (place_item);
@@ -1195,7 +1191,12 @@ panel_desktop_menu_item_append_menu (GtkWidget *menu,
if (add_separator)
add_menu_separator (menu);
+ /* FIXME replace this with MATE documentation system, when it will be ready
+ * see: http://forums.mate-desktop.org/viewtopic.php?f=17&t=805
+
panel_menu_items_append_from_desktop (menu, "yelp.desktop", NULL, FALSE);
+ */
+
panel_menu_items_append_from_desktop (menu, "mate-about.desktop", NULL, FALSE);
if (parent->priv->append_lock_logout)
@@ -1238,12 +1239,14 @@ panel_place_menu_item_finalize (GObject *object)
{
PanelPlaceMenuItem *menuitem = (PanelPlaceMenuItem *) object;
- mateconf_client_remove_dir (panel_mateconf_get_client (),
- DESKTOP_IS_HOME_DIR_DIR,
- NULL);
- mateconf_client_remove_dir (panel_mateconf_get_client (),
- NAMES_DIR,
- NULL);
+ if (menuitem->priv->caja_desktop_settings) {
+ g_object_unref (menuitem->priv->caja_desktop_settings);
+ menuitem->priv->caja_desktop_settings = NULL;
+ }
+ if (menuitem->priv->caja_prefs_settings) {
+ g_object_unref (menuitem->priv->caja_prefs_settings);
+ menuitem->priv->caja_prefs_settings = NULL;
+ }
if (menuitem->priv->bookmarks_monitor != NULL) {
g_file_monitor_cancel (menuitem->priv->bookmarks_monitor);
@@ -1323,24 +1326,21 @@ panel_place_menu_item_init (PanelPlaceMenuItem *menuitem)
menuitem->priv = PANEL_PLACE_MENU_ITEM_GET_PRIVATE (menuitem);
- mateconf_client_add_dir (panel_mateconf_get_client (),
- DESKTOP_IS_HOME_DIR_DIR,
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
- mateconf_client_add_dir (panel_mateconf_get_client (),
- NAMES_DIR,
- MATECONF_CLIENT_PRELOAD_NONE,
- NULL);
-
- panel_mateconf_notify_add_while_alive (HOME_NAME_KEY,
- (MateConfClientNotifyFunc) panel_place_menu_item_key_changed,
- G_OBJECT (menuitem));
- panel_mateconf_notify_add_while_alive (DESKTOP_IS_HOME_DIR_KEY,
- (MateConfClientNotifyFunc) panel_place_menu_item_key_changed,
- G_OBJECT (menuitem));
- panel_mateconf_notify_add_while_alive (COMPUTER_NAME_KEY,
- (MateConfClientNotifyFunc) panel_place_menu_item_key_changed,
- G_OBJECT (menuitem));
+ menuitem->priv->caja_desktop_settings = g_settings_new (CAJA_DESKTOP_SCHEMA);
+ menuitem->priv->caja_prefs_settings = g_settings_new (CAJA_PREFS_SCHEMA);
+
+ g_signal_connect (menuitem->priv->caja_desktop_settings,
+ "changed::" CAJA_DESKTOP_HOME_ICON_NAME_KEY,
+ G_CALLBACK (panel_place_menu_item_key_changed),
+ G_OBJECT (menuitem));
+ g_signal_connect (menuitem->priv->caja_desktop_settings,
+ "changed::" CAJA_DESKTOP_COMPUTER_ICON_NAME_KEY,
+ G_CALLBACK (panel_place_menu_item_key_changed),
+ G_OBJECT (menuitem));
+ g_signal_connect (menuitem->priv->caja_prefs_settings,
+ "changed::" CAJA_PREFS_DESKTOP_IS_HOME_DIR_KEY,
+ G_CALLBACK (panel_place_menu_item_key_changed),
+ G_OBJECT (menuitem));
menuitem->priv->recent_manager = gtk_recent_manager_get_default ();
diff --git a/mate-panel/panel-object.schemas.in b/mate-panel/panel-object.schemas.in
deleted file mode 100644
index cf73c6cc..00000000
--- a/mate-panel/panel-object.schemas.in
+++ /dev/null
@@ -1,263 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
-
- <schemalist>
-
- <!-- Applies to all object types -->
-
- <schema>
- <key>/schemas/apps/panel/objects/object_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>menu-object</default>
- <locale name="C">
- <short>Panel object type</short>
- <long>
- The type of this panel object. Possible values are
- "drawer-object", "menu-object", "launcher-object",
- "external-applet", "action-applet", "menu-bar" and
- "separator".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/toplevel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Toplevel panel containing object</short>
- <long>
- The identifier of the toplevel panel which contains this object.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/position</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>Object's position on the panel</short>
- <long>
- The position of this panel object. The position is specified
- by the number of pixels from the left (or top if vertical)
- panel edge.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/panel_right_stick</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Interpret position relative to bottom/right edge</short>
- <long>
- If true, the position of the object is interpreted relative
- to the right (or bottom if vertical) edge of the panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/locked</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Lock the object to the panel</short>
- <long>
- If true, the user may not move the applet without first unlocking
- the object using the "Unlock" menuitem.
- </long>
- </locale>
- </schema>
-
-
- <!-- Applies to applets -->
-
- <schema>
- <key>/schemas/apps/panel/objects/matecomponent_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Applet MateComponent IID</short>
- <long>
- This key is deprecated, following the migration to a new library for
- applets. The MateComponent implementation ID of the applet - e.g.
- "OAFIID:MATE_ClockApplet". This key is only relevant if the
- object_type key is "matecomponent-applet".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/applet_iid</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Applet IID</short>
- <long>
- The implementation ID of the applet - e.g.
- "ClockAppletFactory::ClockApplet". This key is only
- relevant if the object_type key is "external-applet"
- (or the deprecated "matecomponent-applet").
- </long>
- </locale>
- </schema>
-
- <!-- Applies to drawers -->
-
- <schema>
- <key>/schemas/apps/panel/objects/attached_toplevel_id</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Panel attached to drawer</short>
- <long>
- The identifier of the panel attached to this drawer. This
- key is only relevant if the object_type key is "drawer-object".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/tooltip</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Tooltip displayed for drawer or menu</short>
- <long>
- The text to display in a tooltip for this drawer or this menu. This
- key is only relevant if the object_type key is "drawer-object" or
- "menu-object".
- </long>
- </locale>
- </schema>
-
- <!-- Applies to drawers and menu buttons -->
-
- <schema>
- <key>/schemas/apps/panel/objects/use_custom_icon</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Use custom icon for object's button</short>
- <long>
- If true, the custom_icon key is used as a custom icon for
- the button. If false, the custom_icon key is ignored.
- This key is only relevant if the object_type key is
- "menu-object" or "drawer-object".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/custom_icon</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Icon used for object's button</short>
- <long>
- The location of the image file used as the icon for the
- object's button. This key is only relevant if the
- object_type key is "drawer-object" or "menu-object" and
- the use_custom_icon key is true.
- </long>
- </locale>
- </schema>
-
- <!-- Applies to menu buttons -->
-
- <schema>
- <key>/schemas/apps/panel/objects/use_menu_path</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Use custom path for menu contents</short>
- <long>
- If true, the menu_path key is used as the path from which
- the menu contents should be constructed. If false, the
- menu_path key is ignored. This key is only relevant
- if the object_type key is "menu-object".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/menu_path</key>
- <owner>panel</owner>
- <type>string</type>
- <default>applications:/</default>
- <locale name="C">
- <short>Menu content path</short>
- <long>
- The path from which the menu contents is contructed. This
- key is only relevant if the use_menu_path key is true and
- the object_type key is "menu-object".
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/objects/has_arrow</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Draw arrow in menu button</short>
- <long>
- If true, an arrow is drawn over the menu button icon. If
- false, menu button has only the icon.
- </long>
- </locale>
- </schema>
-
- <!-- Applies to launchers -->
-
- <schema>
- <key>/schemas/apps/panel/objects/launcher_location</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Launcher location</short>
- <long>
- The location of the .desktop file describing the launcher.
- This key is only relevant if the object_type key is
- "launcher-object".
- </long>
- </locale>
- </schema>
-
- <!-- Applies to action buttons -->
-
- <schema>
- <key>/schemas/apps/panel/objects/action_type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>lock</default>
- <locale name="C">
- <short>Action button type</short>
- <long>
- The action type this button represents. Possible values are
- "lock", "logout", "run", "search" and "screenshot". This
- key is only relevant if the object_type key is "action-applet".
- </long>
- </locale>
- </schema>
-
- </schemalist>
-
-</mateconfschemafile>
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index 4f2fb931..300ce64c 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -25,21 +25,24 @@
#include <config.h>
#include "panel-profile.h"
+#include "panel-layout.h"
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <libpanel-util/panel-list.h>
+#include <libpanel-util/panel-dconf.h>
#include "applet.h"
-#include "panel-compatibility.h"
-#include "panel-mateconf.h"
#include "panel.h"
#include "panel-widget.h"
#include "panel-util.h"
#include "panel-multiscreen.h"
#include "panel-toplevel.h"
#include "panel-lockdown.h"
+#include "panel-gsettings.h"
+#include "panel-schemas.h"
typedef struct {
GdkScreen *screen;
@@ -67,145 +70,16 @@ typedef struct {
typedef const char *(*PanelProfileGetIdFunc) (gpointer object);
typedef gboolean (*PanelProfileOnLoadQueue) (const char *id);
-typedef void (*PanelProfileLoadFunc) (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *id);
+typedef void (*PanelProfileLoadFunc) (const char *id);
typedef void (*PanelProfileDestroyFunc) (const char *id);
-static MateConfEnumStringPair panel_orientation_map [] = {
- { PANEL_ORIENTATION_TOP, "top" },
- { PANEL_ORIENTATION_BOTTOM, "bottom" },
- { PANEL_ORIENTATION_LEFT, "left" },
- { PANEL_ORIENTATION_RIGHT, "right" },
- { 0, NULL }
-};
-
-static MateConfEnumStringPair panel_animation_speed_map [] = {
- { PANEL_ANIMATION_SLOW, "slow" },
- { PANEL_ANIMATION_MEDIUM, "medium" },
- { PANEL_ANIMATION_FAST, "fast" },
- { 0, NULL }
-};
-
-static MateConfEnumStringPair panel_background_type_map [] = {
- { PANEL_BACK_NONE, "gtk" },
- { PANEL_BACK_COLOR, "color" },
- { PANEL_BACK_IMAGE, "image" },
- { 0, NULL }
-};
-
-static MateConfEnumStringPair panel_object_type_map [] = {
- { PANEL_OBJECT_DRAWER, "drawer-object" },
- { PANEL_OBJECT_MENU, "menu-object" },
- { PANEL_OBJECT_LAUNCHER, "launcher-object" },
- { PANEL_OBJECT_APPLET, "external-applet" },
- { PANEL_OBJECT_ACTION, "action-applet" },
- { PANEL_OBJECT_MENU_BAR, "menu-bar" },
- { PANEL_OBJECT_SEPARATOR, "separator" },
- /* The following is for backwards compatibility with 2.30.x and earlier */
- { PANEL_OBJECT_APPLET, "matecomponent-applet" },
- /* The following two are for backwards compatibility with 2.0.x */
- { PANEL_OBJECT_LOCK, "lock-object" },
- { PANEL_OBJECT_LOGOUT, "logout-object" },
- { 0, NULL }
-};
+static GSettings *profile_settings = NULL;
static GQuark toplevel_id_quark = 0;
static GQuark queued_changes_quark = 0;
static GQuark commit_timeout_quark = 0;
-static void panel_profile_object_id_list_update (MateConfClient *client,
- MateConfValue *value,
- PanelMateConfKeyType type);
-
-gboolean
-panel_profile_map_orientation_string (const char *str,
- PanelOrientation *orientation)
-{
- int mapped;
-
- g_return_val_if_fail (orientation != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_orientation_map, str, &mapped))
- return FALSE;
-
- *orientation = mapped;
-
- return TRUE;
-}
-
-const char *
-panel_profile_map_orientation (PanelOrientation orientation)
-{
- return mateconf_enum_to_string (panel_orientation_map, orientation);
-}
-
-gboolean
-panel_profile_map_speed_string (const char *str,
- PanelAnimationSpeed *speed)
-{
- int mapped;
-
- g_return_val_if_fail (speed != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_animation_speed_map, str, &mapped))
- return FALSE;
-
- *speed = mapped;
-
- return TRUE;
-}
-
-gboolean
-panel_profile_map_background_type_string (const char *str,
- PanelBackgroundType *background_type)
-{
- int mapped;
-
- g_return_val_if_fail (background_type != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_background_type_map, str, &mapped))
- return FALSE;
-
- *background_type = mapped;
-
- return TRUE;
-}
-
-const char *
-panel_profile_map_background_type (PanelBackgroundType background_type)
-{
- return mateconf_enum_to_string (panel_background_type_map, background_type);
-}
-
-gboolean
-panel_profile_map_object_type_string (const char *str,
- PanelObjectType *object_type)
-{
- int mapped;
-
- g_return_val_if_fail (object_type != NULL, FALSE);
-
- if (!str)
- return FALSE;
-
- if (!mateconf_string_to_enum (panel_object_type_map, str, &mapped))
- return FALSE;
-
- *object_type = mapped;
-
- return TRUE;
-}
+static void panel_profile_object_id_list_update (gchar **objects);
static void
panel_profile_set_toplevel_id (PanelToplevel *toplevel,
@@ -246,83 +120,52 @@ panel_profile_get_toplevel_by_id (const char *toplevel_id)
}
char *
-panel_profile_find_new_id (PanelMateConfKeyType type)
+panel_profile_find_new_id (PanelGSettingsKeyType type)
{
- MateConfClient *client;
- GSList *l, *existing_ids;
- const char *key;
+ gchar **existing_ids;
char *retval = NULL;
char *prefix;
char *dir;
int i;
-
- client = panel_mateconf_get_client ();
+ int j;
switch (type) {
- case PANEL_MATECONF_TOPLEVELS:
- prefix = "panel";
- dir = "toplevels";
- break;
- case PANEL_MATECONF_OBJECTS:
- prefix = "object";
- dir = "objects";
- break;
- case PANEL_MATECONF_APPLETS:
- prefix = "applet";
- dir = "applets";
- break;
- default:
- prefix = dir = NULL;
- g_assert_not_reached ();
- break;
+ case PANEL_GSETTINGS_TOPLEVELS:
+ prefix = PANEL_TOPLEVEL_DEFAULT_PREFIX;
+ dir = PANEL_TOPLEVEL_PATH;
+ break;
+ case PANEL_GSETTINGS_OBJECTS:
+ prefix = PANEL_OBJECT_DEFAULT_PREFIX;
+ dir = PANEL_OBJECT_PATH;
+ break;
+ default:
+ prefix = dir = NULL;
+ g_assert_not_reached ();
+ break;
}
- key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/%s", dir);
- existing_ids = mateconf_client_all_dirs (client, key, NULL);
+ existing_ids = panel_dconf_list_subdirs (dir, TRUE);
for (i = 0; !retval; i++) {
retval = g_strdup_printf ("%s_%d", prefix, i);
- for (l = existing_ids; l; l = l->next)
- if (!strcmp (panel_mateconf_basename (l->data), retval)) {
+ for (j = 0; existing_ids[j] != NULL; j++) {
+ if (g_strcmp0 (existing_ids[j], retval) == 0) {
g_free (retval);
retval = NULL;
break;
}
+ }
}
+ if (existing_ids)
+ g_strfreev (existing_ids);
g_assert (retval != NULL);
- for (l = existing_ids; l; l = l->next)
- g_free (l->data);
- g_slist_free (existing_ids);
-
return retval;
}
static void
-panel_profile_set_queued_changes (PanelToplevel *toplevel,
- MateConfChangeSet *changes)
-{
- if (!queued_changes_quark)
- queued_changes_quark = g_quark_from_static_string ("panel-queued-changes");
-
- g_object_set_qdata_full (G_OBJECT (toplevel),
- queued_changes_quark,
- changes,
- (GDestroyNotify) mateconf_change_set_unref);
-}
-
-static MateConfChangeSet *
-panel_profile_get_queued_changes (GObject *object)
-{
- if (!queued_changes_quark)
- return NULL;
-
- return g_object_get_qdata (object, queued_changes_quark);
-}
-
-static void
panel_profile_remove_commit_timeout (guint timeout)
{
g_source_remove (timeout);
@@ -357,67 +200,34 @@ panel_profile_get_commit_timeout (GObject *object)
return GPOINTER_TO_UINT (g_object_get_qdata (object, commit_timeout_quark));
}
-static const char *
-panel_profile_get_toplevel_key (PanelToplevel *toplevel,
- const char *key)
-{
- const char *id;
-
- id = panel_profile_get_toplevel_id (toplevel);
-
- return panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, id, key);
+gboolean
+panel_profile_key_is_writable (PanelToplevel *toplevel, gchar *key) {
+ return g_settings_is_writable (toplevel->settings, key);
}
-#define TOPLEVEL_IS_WRITABLE_FUNC(k, p, s) \
- gboolean \
- panel_profile_is_writable_##p##_##s (PanelToplevel *toplevel) \
- { \
- MateConfClient *client; \
- const char *key; \
- client = panel_mateconf_get_client (); \
- key = panel_profile_get_toplevel_key (toplevel, k); \
- return mateconf_client_key_is_writable (client, key, NULL); \
- }
+gboolean
+panel_profile_background_key_is_writable (PanelToplevel *toplevel, gchar *key) {
+ return g_settings_is_writable (toplevel->background_settings, key);
+}
void
panel_profile_set_background_type (PanelToplevel *toplevel,
PanelBackgroundType background_type)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/type");
- mateconf_client_set_string (client,
- key,
- panel_profile_map_background_type (background_type),
- NULL);
+ g_settings_set_enum (toplevel->background_settings,
+ "type",
+ background_type);
}
PanelBackgroundType
panel_profile_get_background_type (PanelToplevel *toplevel)
{
PanelBackgroundType background_type;
- MateConfClient *client;
- const char *key;
- char *str;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/type");
- str = mateconf_client_get_string (client, key, NULL);
-
- if (!str || !panel_profile_map_background_type_string (str, &background_type))
- background_type = PANEL_BACK_NONE;
-
- g_free (str);
-
+ g_settings_get_enum (toplevel->background_settings,
+ "type");
return background_type;
}
-TOPLEVEL_IS_WRITABLE_FUNC ("background/type", background, type)
-
void
panel_profile_set_background_color (PanelToplevel *toplevel,
PanelColor *color)
@@ -434,25 +244,18 @@ panel_profile_get_background_color (PanelToplevel *toplevel,
color->alpha = panel_profile_get_background_opacity (toplevel);
}
-TOPLEVEL_IS_WRITABLE_FUNC ("background/color", background, color)
-
void
panel_profile_set_background_gdk_color (PanelToplevel *toplevel,
GdkColor *gdk_color)
{
- MateConfClient *client;
- const char *key;
char *color_str;
- client = panel_mateconf_get_client ();
-
color_str = g_strdup_printf ("#%02x%02x%02x",
gdk_color->red / 256,
gdk_color->green / 256,
gdk_color->blue / 256);
- key = panel_profile_get_toplevel_key (toplevel, "background/color");
- mateconf_client_set_string (client, key, color_str, NULL);
+ g_settings_set_string(toplevel->background_settings, "color", color_str);
g_free (color_str);
}
@@ -461,14 +264,9 @@ void
panel_profile_get_background_gdk_color (PanelToplevel *toplevel,
GdkColor *gdk_color)
{
- MateConfClient *client;
- const char *key;
char *color_str;
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/color");
- color_str = mateconf_client_get_string (client, key, NULL);
+ color_str = g_settings_get_string (toplevel->background_settings, "color");
if (!color_str || !gdk_color_parse (color_str, gdk_color)) {
gdk_color->red = 0;
gdk_color->green = 0;
@@ -482,177 +280,113 @@ void
panel_profile_set_background_opacity (PanelToplevel *toplevel,
guint16 opacity)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/opacity");
- mateconf_client_set_int (client, key, opacity, NULL);
+ g_settings_set_int (toplevel->background_settings, "opacity", opacity);
}
guint16
panel_profile_get_background_opacity (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
guint16 opacity;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/opacity");
- opacity = mateconf_client_get_int (client, key, NULL);
-
+ opacity = g_settings_get_int (toplevel->background_settings, "opacity");
return opacity;
}
-TOPLEVEL_IS_WRITABLE_FUNC ("background/opacity", background, opacity)
-
void
panel_profile_set_background_image (PanelToplevel *toplevel,
const char *image)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/image");
-
if (image && image [0])
- mateconf_client_set_string (client, key, image, NULL);
+ g_settings_set_string (toplevel->background_settings, "image", image);
else
- mateconf_client_unset (client, key, NULL);
+ g_settings_reset (toplevel->background_settings, "image");
}
char *
panel_profile_get_background_image (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
char *retval;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "background/image");
- retval = mateconf_client_get_string (client, key, NULL);
-
+ retval = g_settings_get_string (toplevel->background_settings, "image");
return retval;
}
-TOPLEVEL_IS_WRITABLE_FUNC ("background/image", background, image)
-
void
panel_profile_set_toplevel_name (PanelToplevel *toplevel,
const char *name)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "name");
-
if (name && name [0])
- mateconf_client_set_string (client, key, name, NULL);
+ g_settings_set_string (toplevel->settings, "name", name);
else
- mateconf_client_unset (client, key, NULL);
+ g_settings_reset (toplevel->settings, "name");
}
char *
panel_profile_get_toplevel_name (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
char *retval;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "name");
- retval = mateconf_client_get_string (client, key, NULL);
-
+ retval = g_settings_get_string (toplevel->settings, "name");
return retval;
}
-TOPLEVEL_IS_WRITABLE_FUNC ("name", toplevel, name)
-
void
panel_profile_set_toplevel_orientation (PanelToplevel *toplevel,
PanelOrientation orientation)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "orientation");
- mateconf_client_set_string (client,
- key,
- panel_profile_map_orientation (orientation),
- NULL);
+ g_settings_set_enum (toplevel->settings, "orientation", orientation);
}
PanelOrientation
panel_profile_get_toplevel_orientation (PanelToplevel *toplevel)
{
PanelOrientation orientation;
- MateConfClient *client;
- const char *key;
- char *str;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "orientation");
- str = mateconf_client_get_string (client, key, NULL);
-
- if (!panel_profile_map_orientation_string (str, &orientation))
- orientation = panel_toplevel_get_orientation (toplevel);
-
- g_free (str);
-
+ orientation = g_settings_get_enum (toplevel->settings, "orientation");
return orientation;
}
-TOPLEVEL_IS_WRITABLE_FUNC ("orientation", toplevel, orientation)
-
-#define TOPLEVEL_GET_SET_FUNCS(k, p, t, s, a) \
+#define TOPLEVEL_GET_SET_FUNCS(k, p, t, s, a) \
void \
panel_profile_set_##p##_##s (PanelToplevel *toplevel, a s) \
{ \
- MateConfClient *client; \
- const char *key; \
- client = panel_mateconf_get_client (); \
- key = panel_profile_get_toplevel_key (toplevel, k); \
- mateconf_client_set_##t (client, key, s, NULL); \
+ g_settings_set_##t (toplevel->settings, k, s); \
} \
a \
panel_profile_get_##p##_##s (PanelToplevel *toplevel) \
{ \
- MateConfClient *client; \
- const char *key; \
- a retval; \
- client = panel_mateconf_get_client (); \
- key = panel_profile_get_toplevel_key (toplevel, k); \
- retval = mateconf_client_get_##t (client, key, NULL); \
- return retval; \
+ a retval; \
+ retval = g_settings_get_##t (toplevel->settings, k); \
+ return retval; \
+ }
+
+TOPLEVEL_GET_SET_FUNCS ("size", toplevel, int, size, int)
+TOPLEVEL_GET_SET_FUNCS ("expand", toplevel, boolean, expand, gboolean)
+TOPLEVEL_GET_SET_FUNCS ("auto-hide", toplevel, boolean, auto_hide, gboolean)
+TOPLEVEL_GET_SET_FUNCS ("enable-buttons", toplevel, boolean, enable_buttons, gboolean)
+TOPLEVEL_GET_SET_FUNCS ("enable-arrows", toplevel, boolean, enable_arrows, gboolean)
+
+#define TOPLEVEL_GET_SET_BG_FUNCS(k, p, t, s, a) \
+ void \
+ panel_profile_set_##p##_##s (PanelToplevel *toplevel, a s) \
+ { \
+ g_settings_set_##t (toplevel->background_settings, k, s); \
} \
- TOPLEVEL_IS_WRITABLE_FUNC(k, p, s)
+ a \
+ panel_profile_get_##p##_##s (PanelToplevel *toplevel) \
+ { \
+ a retval; \
+ retval = g_settings_get_##t (toplevel->background_settings, k); \
+ return retval; \
+ }
-TOPLEVEL_GET_SET_FUNCS ("size", toplevel, int, size, int)
-TOPLEVEL_GET_SET_FUNCS ("expand", toplevel, bool, expand, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("auto_hide", toplevel, bool, auto_hide, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("enable_buttons", toplevel, bool, enable_buttons, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("enable_arrows", toplevel, bool, enable_arrows, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("background/fit", background, bool, fit, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("background/stretch", background, bool, stretch, gboolean)
-TOPLEVEL_GET_SET_FUNCS ("background/rotate", background, bool, rotate, gboolean)
+TOPLEVEL_GET_SET_BG_FUNCS ("fit", background, boolean, fit, gboolean)
+TOPLEVEL_GET_SET_BG_FUNCS ("stretch", background, boolean, stretch, gboolean)
+TOPLEVEL_GET_SET_BG_FUNCS ("rotate", background, boolean, rotate, gboolean)
-static const char *
-panel_profile_get_attached_object_key (PanelToplevel *toplevel,
- const char *key)
+GSettings*
+panel_profile_get_attached_object_settings (PanelToplevel *toplevel)
{
GtkWidget *attach_widget;
const char *id;
+ char *path;
+ GSettings *settings;
attach_widget = panel_toplevel_get_attach_widget (toplevel);
@@ -661,200 +395,134 @@ panel_profile_get_attached_object_key (PanelToplevel *toplevel,
if (!id)
return NULL;
- return panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, key);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ g_free (path);
+
+ return settings;
}
void
panel_profile_set_attached_custom_icon (PanelToplevel *toplevel,
const char *custom_icon)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
- key = panel_profile_get_attached_object_key (toplevel, "use_custom_icon");
- if (key)
- mateconf_client_set_bool (client, key, custom_icon != NULL, NULL);
+ g_settings_set_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY, custom_icon != NULL);
+ g_settings_set_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY, sure_string (custom_icon));
- key = panel_profile_get_attached_object_key (toplevel, "custom_icon");
- if (key)
- mateconf_client_set_string (client, key, sure_string (custom_icon), NULL);
+ g_object_unref (settings);
}
char *
panel_profile_get_attached_custom_icon (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
+ gchar *custom_icon = NULL;
+ if (panel_toplevel_get_is_attached (toplevel))
+ {
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
- key = panel_profile_get_attached_object_key (toplevel, "use_custom_icon");
- if (!key || !mateconf_client_get_bool (client, key, NULL))
- return NULL;
-
- key = panel_profile_get_attached_object_key (toplevel, "custom_icon");
+ if (!g_settings_get_boolean (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY))
+ {
+ g_object_unref (settings);
+ return NULL;
+ }
- return key ? mateconf_client_get_string (client, key, NULL) : NULL;
+ custom_icon = g_settings_get_string (settings, PANEL_OBJECT_CUSTOM_ICON_KEY);
+ g_object_unref (settings);
+ }
+ return custom_icon;
}
gboolean
panel_profile_is_writable_attached_custom_icon (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_attached_object_key (toplevel, "use_custom_icon");
- if (!key)
- return TRUE;
-
- if (!mateconf_client_key_is_writable (client, key, NULL))
- return FALSE;
+ gboolean is_writable = FALSE;
+ if (panel_toplevel_get_is_attached (toplevel))
+ {
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
- key = panel_profile_get_attached_object_key (toplevel, "custom_icon");
+ is_writable = g_settings_is_writable (settings, PANEL_OBJECT_USE_CUSTOM_ICON_KEY) &&
+ g_settings_is_writable (settings, PANEL_OBJECT_CUSTOM_ICON_KEY);
- return key ? mateconf_client_key_is_writable (client, key, NULL) : TRUE;
+ g_object_unref (settings);
+ }
+ return is_writable;
}
void
panel_profile_set_attached_tooltip (PanelToplevel *toplevel,
const char *tooltip)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_attached_object_key (toplevel, "tooltip");
- if (key)
- mateconf_client_set_string (client, key, tooltip, NULL);
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
+ g_settings_set_string (settings, PANEL_OBJECT_TOOLTIP_KEY, tooltip);
+ g_object_unref (settings);
}
char *
panel_profile_get_attached_tooltip (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_attached_object_key (toplevel, "tooltip");
-
- return key ? mateconf_client_get_string (client, key, NULL) : NULL;
+ gchar *tooltip = NULL;
+ if (panel_toplevel_get_is_attached (toplevel))
+ {
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
+ tooltip = g_settings_get_string (settings, PANEL_OBJECT_TOOLTIP_KEY);
+ g_object_unref (settings);
+ }
+ return tooltip;
}
gboolean
panel_profile_is_writable_attached_tooltip (PanelToplevel *toplevel)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_attached_object_key (toplevel, "tooltip");
-
- return key ? mateconf_client_key_is_writable (client, key, NULL) : TRUE;
-}
-
-static PanelBackgroundType
-get_background_type (MateConfClient *client,
- const char *toplevel_dir)
-{
- PanelBackgroundType background_type;
- GError *error = NULL;
- const char *key;
- char *type_str;
-
- key = panel_mateconf_sprintf ("%s/background/type", toplevel_dir);
- type_str = mateconf_client_get_string (client, key, &error);
- if (error) {
- g_warning (_("Error reading MateConf string value '%s': %s"),
- key, error->message);
- g_error_free (error);
- return PANEL_BACK_NONE;
+ gboolean is_writable = FALSE;
+ if (panel_toplevel_get_is_attached (toplevel))
+ {
+ GSettings *settings;
+ settings = panel_profile_get_attached_object_settings (toplevel);
+ is_writable = g_settings_is_writable (settings, PANEL_OBJECT_TOOLTIP_KEY);
+ g_object_unref (settings);
}
-
- if (!type_str || !panel_profile_map_background_type_string (type_str, &background_type))
- background_type = PANEL_BACK_NONE;
-
- g_free (type_str);
-
- return background_type;
+ return is_writable;
}
static void
-get_background_color (MateConfClient *client,
- const char *toplevel_dir,
- PanelColor *color)
+get_background_color (PanelToplevel *toplevel,
+ PanelColor *color)
{
- GError *error;
- const char *key;
char *color_str;
-
- error = NULL;
- key = panel_mateconf_sprintf ("%s/background/color", toplevel_dir);
- color_str = mateconf_client_get_string (client, key, &error);
- if (error) {
- g_warning (_("Error reading MateConf string value '%s': %s"),
- key, error->message);
- g_error_free (error);
- } else if (!color_str || !gdk_color_parse (color_str, &(color->gdk))) {
+ color_str = g_settings_get_string (toplevel->background_settings, "color");
+ if (!color_str || !gdk_color_parse (color_str, &(color->gdk))) {
color->gdk.red = 0;
color->gdk.green = 0;
color->gdk.blue = 0;
}
-
g_free (color_str);
- error = NULL;
- key = panel_mateconf_sprintf ("%s/background/opacity", toplevel_dir);
- color->alpha = mateconf_client_get_int (client, key, &error);
- if (error) {
- g_warning (_("Error reading MateConf integer value '%s': %s"),
- key, error->message);
- g_error_free (error);
- color->alpha = 65535; /* fallback to fully opaque */
- }
+ color->alpha = g_settings_get_int (toplevel->background_settings, "opacity");
}
static char *
-get_background_image (MateConfClient *client,
- const char *toplevel_dir,
+get_background_image (PanelToplevel *toplevel,
gboolean *fit,
gboolean *stretch,
gboolean *rotate)
{
- const char *key;
- GError *error = NULL;
char *image;
-
- key = panel_mateconf_sprintf ("%s/background/image", toplevel_dir);
- image = mateconf_client_get_string (client, key, &error);
- if (error) {
- g_warning (_("Error reading MateConf string value '%s': %s"),
- key, error->message);
- g_error_free (error);
- }
-
- key = panel_mateconf_sprintf ("%s/background/fit", toplevel_dir);
- *fit = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/background/stretch", toplevel_dir);
- *stretch = mateconf_client_get_bool (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/background/rotate", toplevel_dir);
- *rotate = mateconf_client_get_bool (client, key, NULL);
-
+ image = g_settings_get_string (toplevel->background_settings, "image");
+ *fit = g_settings_get_boolean (toplevel->background_settings, "fit");
+ *stretch = g_settings_get_boolean (toplevel->background_settings, "stretch");
+ *rotate = g_settings_get_boolean (toplevel->background_settings, "rotate");
return image;
}
static void
-panel_profile_load_background (PanelToplevel *toplevel,
- MateConfClient *client,
- const char *toplevel_dir)
+panel_profile_load_background (PanelToplevel *toplevel)
{
PanelWidget *panel_widget;
PanelBackground *background;
@@ -868,11 +536,11 @@ panel_profile_load_background (PanelToplevel *toplevel,
panel_widget = panel_toplevel_get_panel_widget (toplevel);
background = &panel_widget->background;
- background_type = get_background_type (client, toplevel_dir);
+ background_type = panel_profile_get_background_type (toplevel);
- get_background_color (client, toplevel_dir, &color);
+ get_background_color (toplevel, &color);
- image = get_background_image (client, toplevel_dir, &fit, &stretch, &rotate);
+ image = get_background_image (toplevel, &fit, &stretch, &rotate);
panel_background_set (background,
background_type,
@@ -888,15 +556,9 @@ panel_profile_load_background (PanelToplevel *toplevel,
static gboolean
panel_profile_commit_toplevel_changes (PanelToplevel *toplevel)
{
- MateConfChangeSet *queued_changes;
-
- queued_changes = panel_profile_get_queued_changes (G_OBJECT (toplevel));
- if (queued_changes)
- mateconf_client_commit_change_set (
- panel_mateconf_get_client (),
- queued_changes, FALSE, NULL);
+ if (g_settings_get_has_unapplied (toplevel->queued_settings))
+ g_settings_apply (toplevel->queued_settings);
- panel_profile_set_queued_changes (toplevel, NULL);
panel_profile_set_commit_timeout (toplevel, 0);
return FALSE;
@@ -906,75 +568,60 @@ static void
panel_profile_queue_toplevel_location_change (PanelToplevel *toplevel,
ToplevelLocationChange *change)
{
- MateConfChangeSet *queued_changes;
guint commit_timeout;
- queued_changes = panel_profile_get_queued_changes (G_OBJECT (toplevel));
- if (!queued_changes) {
- queued_changes = mateconf_change_set_new ();
- panel_profile_set_queued_changes (toplevel, queued_changes);
- }
+ g_settings_delay (toplevel->queued_settings);
if (change->screen_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "screen"),
- gdk_screen_get_number (change->screen));
+ g_settings_set_int (toplevel->queued_settings,
+ "screen",
+ gdk_screen_get_number (change->screen));
if (change->monitor_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "monitor"),
- change->monitor);
+ g_settings_set_int (toplevel->queued_settings,
+ "monitor",
+ change->monitor);
if (change->size_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "size"),
- change->size);
+ g_settings_set_int (toplevel->queued_settings,
+ "size",
+ change->size);
if (change->orientation_changed)
- mateconf_change_set_set_string (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "orientation"),
- mateconf_enum_to_string (panel_orientation_map, change->orientation));
+ g_settings_set_enum (toplevel->queued_settings,
+ "orientation",
+ change->orientation);
if (!panel_toplevel_get_expand (toplevel)) {
if (change->x_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "x"),
- change->x);
+ g_settings_set_int (toplevel->queued_settings,
+ "x",
+ change->x);
if (change->x_right_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "x_right"),
- change->x_right);
+ g_settings_set_int (toplevel->queued_settings,
+ "x-right",
+ change->x_right);
if (change->x_centered_changed)
- mateconf_change_set_set_bool (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "x_centered"),
- change->x_centered);
+ g_settings_set_boolean (toplevel->queued_settings,
+ "x-centered",
+ change->x_centered);
if (change->y_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "y"),
- change->y);
+ g_settings_set_int (toplevel->queued_settings,
+ "y",
+ change->y);
if (change->y_bottom_changed)
- mateconf_change_set_set_int (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "y_bottom"),
- change->y_bottom);
+ g_settings_set_int (toplevel->queued_settings,
+ "y-bottom",
+ change->y_bottom);
if (change->y_centered_changed)
- mateconf_change_set_set_bool (
- queued_changes,
- panel_profile_get_toplevel_key (toplevel, "y_centered"),
- change->y_centered);
+ g_settings_set_boolean (toplevel->queued_settings,
+ "y-centered",
+ change->y_centered);
}
commit_timeout = panel_profile_get_commit_timeout (G_OBJECT (toplevel));
@@ -1059,380 +706,202 @@ panel_profile_connect_to_toplevel (PanelToplevel *toplevel)
}
static void
-set_name_from_string (PanelToplevel *toplevel,
- const char *str)
-{
- if (!str)
- return;
-
- panel_toplevel_set_name (toplevel, str);
-}
-
-static void
-set_orientation_from_string (PanelToplevel *toplevel,
- const char *str)
+panel_profile_toplevel_change_notify (GSettings *settings,
+ gchar *key,
+ PanelToplevel *toplevel)
{
- PanelOrientation orientation;
-
- if (!str || !panel_profile_map_orientation_string (str, &orientation))
- return;
- panel_toplevel_set_orientation (toplevel, orientation);
-}
-
-static void
-set_animation_speed_from_string (PanelToplevel *toplevel,
- const char *str)
-{
- PanelAnimationSpeed animation_speed;
-
- if (!str || !panel_profile_map_speed_string (str, &animation_speed))
- return;
-
- panel_toplevel_set_animation_speed (toplevel, animation_speed);
-}
-
-static void
-panel_profile_toplevel_change_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- PanelToplevel *toplevel)
-{
- MateConfValue *value;
- const char *key;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
-
- if (!(value = mateconf_entry_get_value (entry)))
- return;
-
-#define UPDATE_STRING(k, n) \
+#define UPDATE_STRING(k, n) \
if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_STRING) \
- set_##n##_from_string (toplevel, \
- mateconf_value_get_string (value)); \
+ panel_toplevel_set_##n (toplevel, \
+ g_settings_get_string (settings, key)); \
}
-#define UPDATE_INT(k, n) \
+#define UPDATE_ENUM(k, n) \
if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_INT) \
- panel_toplevel_set_##n (toplevel, \
- mateconf_value_get_int (value)); \
+ panel_toplevel_set_##n (toplevel, \
+ g_settings_get_enum (settings, key)); \
}
-#define UPDATE_BOOL(k, n) \
+#define UPDATE_INT(k, n) \
if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_BOOL) \
- panel_toplevel_set_##n (toplevel, \
- mateconf_value_get_bool (value)); \
+ panel_toplevel_set_##n (toplevel, \
+ g_settings_get_int (settings, key)); \
}
-#define UPDATE_POS(k, n, n2) \
+#define UPDATE_BOOL(k, n) \
if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_INT) { \
- int x, x_right, y, y_bottom; \
- panel_toplevel_get_position (toplevel, &x, &x_right, \
- &y, &y_bottom); \
- panel_toplevel_set_##n ( \
- toplevel, \
- mateconf_value_get_int (value), \
- n2, \
- panel_toplevel_get_##n##_centered (toplevel)); \
- } \
+ panel_toplevel_set_##n (toplevel, \
+ g_settings_get_boolean (settings, key)); \
}
-#define UPDATE_POS2(k, n, n2) \
+#define UPDATE_POS(k, n, n2) \
if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_INT) { \
- int x, x_right, y, y_bottom; \
- panel_toplevel_get_position (toplevel, &x, &x_right, \
- &y, &y_bottom); \
- panel_toplevel_set_##n ( \
- toplevel, \
- n, \
- mateconf_value_get_int (value), \
- panel_toplevel_get_##n##_centered (toplevel)); \
- } \
+ int x, x_right, y, y_bottom; \
+ panel_toplevel_get_position (toplevel, &x, &x_right, \
+ &y, &y_bottom); \
+ panel_toplevel_set_##n ( \
+ toplevel, \
+ g_settings_get_int (settings, key), \
+ n2, \
+ panel_toplevel_get_##n##_centered (toplevel)); \
}
-#define UPDATE_CENTERED(k, n, n2) \
- if (!strcmp (key, k)) { \
- if (value->type == MATECONF_VALUE_BOOL) { \
- int x, x_right, y, y_bottom; \
- panel_toplevel_get_position (toplevel, &x, &x_right, \
- &y, &y_bottom); \
- panel_toplevel_set_##n ( \
- toplevel, n, n2, mateconf_value_get_bool (value)); \
- } \
+#define UPDATE_POS2(k, n, n2) \
+ if (!strcmp (key, k)) { \
+ int x, x_right, y, y_bottom; \
+ panel_toplevel_get_position (toplevel, &x, &x_right, \
+ &y, &y_bottom); \
+ panel_toplevel_set_##n ( \
+ toplevel, \
+ n, \
+ g_settings_get_int (settings, key), \
+ panel_toplevel_get_##n##_centered (toplevel)); \
}
- if (!strcmp (key, "screen")) {
- if (value->type == MATECONF_VALUE_INT) {
- GdkScreen *screen;
-
- screen = gdk_display_get_screen (
- gdk_display_get_default (),
- mateconf_value_get_int (value));
- if (screen)
- gtk_window_set_screen (GTK_WINDOW (toplevel), screen);
- else
- /* Make sure to set the key back to an actual
- * available screen so it will get loaded on
- * next startup.
- */
- panel_profile_toplevel_screen_changed (toplevel);
+#define UPDATE_CENTERED(k, n, n2) \
+ if (!strcmp (key, k)) { \
+ int x, x_right, y, y_bottom; \
+ panel_toplevel_get_position (toplevel, &x, &x_right, \
+ &y, &y_bottom); \
+ panel_toplevel_set_##n ( \
+ toplevel, n, n2, \
+ g_settings_get_boolean (settings, key)); \
}
-
+
+ if (!strcmp (key, "screen")) {
+ GdkScreen *screen;
+ screen = gdk_display_get_screen (
+ gdk_display_get_default (),
+ g_settings_get_int (settings, key));
+ if (screen)
+ gtk_window_set_screen (GTK_WINDOW (toplevel), screen);
+ else
+ /* Make sure to set the key back to an actual
+ * available screen so it will get loaded on
+ * next startup.
+ */
+ panel_profile_toplevel_screen_changed (toplevel);
}
else UPDATE_INT ("monitor", monitor)
else UPDATE_STRING ("name", name)
else UPDATE_BOOL ("expand", expand)
- else UPDATE_STRING ("orientation", orientation)
+ else UPDATE_ENUM ("orientation", orientation)
else UPDATE_INT ("size", size)
else UPDATE_POS ("x", x, x_right)
else UPDATE_POS ("y", y, y_bottom)
- else UPDATE_POS2 ("x_right", x, x_right)
- else UPDATE_POS2 ("y_bottom", y, y_bottom)
- else UPDATE_CENTERED ("x_centered", x, x_right)
- else UPDATE_CENTERED ("y_centered", y, y_bottom)
- else UPDATE_BOOL ("auto_hide", auto_hide)
- else UPDATE_BOOL ("enable_animations", animate)
- else UPDATE_BOOL ("enable_buttons", enable_buttons)
- else UPDATE_BOOL ("enable_arrows", enable_arrows)
- else UPDATE_INT ("hide_delay", hide_delay)
- else UPDATE_INT ("unhide_delay", unhide_delay)
- else UPDATE_INT ("auto_hide_size", auto_hide_size)
- else UPDATE_STRING ("animation_speed", animation_speed)
+ else UPDATE_POS2 ("x-right", x, x_right)
+ else UPDATE_POS2 ("y-bottom", y, y_bottom)
+ else UPDATE_CENTERED ("x-centered", x, x_right)
+ else UPDATE_CENTERED ("y-centered", y, y_bottom)
+ else UPDATE_BOOL ("auto-hide", auto_hide)
+ else UPDATE_BOOL ("enable-animations", animate)
+ else UPDATE_BOOL ("enable-buttons", enable_buttons)
+ else UPDATE_BOOL ("enable-arrows", enable_arrows)
+ else UPDATE_INT ("hide-delay", hide_delay)
+ else UPDATE_INT ("unhide-delay", unhide_delay)
+ else UPDATE_INT ("auto-hide-size", auto_hide_size)
+ else UPDATE_ENUM ("animation-speed", animation_speed)
}
static void
-panel_profile_background_change_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- PanelToplevel *toplevel)
+panel_profile_background_change_notify (GSettings *settings,
+ gchar *key,
+ PanelToplevel *toplevel)
{
PanelWidget *panel_widget;
PanelBackground *background;
- MateConfValue *value;
- const char *key;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
-
- if (!(value = mateconf_entry_get_value (entry)))
- return;
panel_widget = panel_toplevel_get_panel_widget (toplevel);
background = &panel_widget->background;
if (!strcmp (key, "type")) {
- if (value->type == MATECONF_VALUE_STRING) {
- PanelBackgroundType background_type;
-
- if (panel_profile_map_background_type_string (
- mateconf_value_get_string (value),
- &background_type)) {
- panel_background_set_type (background, background_type);
- panel_toplevel_update_edges (toplevel);
- }
- }
+ PanelBackgroundType background_type;
+ background_type = g_settings_get_enum (settings, key);
+ panel_background_set_type (background, background_type);
+ panel_toplevel_update_edges (toplevel);
} else if (!strcmp (key, "color")) {
- if (value->type == MATECONF_VALUE_STRING) {
- GdkColor gdk_color;
- const char *str;
-
- str = mateconf_value_get_string (value);
-
- if (gdk_color_parse (str, &gdk_color))
- panel_background_set_gdk_color (background, &gdk_color);
- }
+ GdkColor gdk_color;
+ const char *str;
+ str = g_settings_get_string (settings, key);
+ if (gdk_color_parse (str, &gdk_color))
+ panel_background_set_gdk_color (background, &gdk_color);
} else if (!strcmp (key, "opacity")) {
- if (value->type == MATECONF_VALUE_INT)
- panel_background_set_opacity (background,
- mateconf_value_get_int (value));
+ panel_background_set_opacity (background,
+ g_settings_get_int (settings, key));
} else if (!strcmp (key, "image")) {
- if (value->type == MATECONF_VALUE_STRING)
- panel_background_set_image (background,
- mateconf_value_get_string (value));
+ panel_background_set_image (background,
+ g_settings_get_string (settings, key));
} else if (!strcmp (key, "fit")) {
- if (value->type == MATECONF_VALUE_BOOL)
- panel_background_set_fit (background,
- mateconf_value_get_bool (value));
+ panel_background_set_fit (background,
+ g_settings_get_boolean (settings, key));
} else if (!strcmp (key, "stretch")) {
- if (value->type == MATECONF_VALUE_BOOL)
- panel_background_set_stretch (background,
- mateconf_value_get_bool (value));
+ panel_background_set_stretch (background,
+ g_settings_get_boolean (settings, key));
} else if (!strcmp (key, "rotate")) {
- if (value->type == MATECONF_VALUE_BOOL)
- panel_background_set_rotate (background,
- mateconf_value_get_bool (value));
- }
-}
-
-static void
-panel_profile_disconnect_toplevel (PanelToplevel *toplevel,
- gpointer data)
-{
- MateConfClient *client;
- guint notify_id = GPOINTER_TO_UINT (data);
-
- client = panel_mateconf_get_client ();
-
- mateconf_client_notify_remove (client, notify_id);
-}
-
-guint
-panel_profile_toplevel_notify_add (PanelToplevel *toplevel,
- const char *key,
- MateConfClientNotifyFunc func,
- gpointer data)
-{
- MateConfClient *client;
- const char *tmp;
- guint retval;
-
- client = panel_mateconf_get_client ();
-
- if (!key)
- tmp = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/toplevels/%s",
- panel_profile_get_toplevel_id (toplevel));
- else
- tmp = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/toplevels/%s/%s",
- panel_profile_get_toplevel_id (toplevel),
- key);
-
- retval = mateconf_client_notify_add (client, tmp, func, data, NULL, NULL);
-
- return retval;
-}
-
-static void
-panel_profile_save_id_list (PanelMateConfKeyType type,
- GSList *list,
- gboolean resave)
-{
- MateConfClient *client;
- const char *key;
- const char *id_list;
-
- g_assert (!(resave && list != NULL));
-
- client = panel_mateconf_get_client ();
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_general_key (id_list);
- if (resave)
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
- else {
- /* Make sure the elements in the list appear only once. We only
- * do it when we save a list with new elements. */
- list = panel_g_slist_make_unique (list,
- (GCompareFunc) strcmp,
- TRUE);
+ panel_background_set_rotate (background,
+ g_settings_get_boolean (settings, key));
}
-
- mateconf_client_set_list (client, key, MATECONF_VALUE_STRING, list, NULL);
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-}
-
-static inline void
-panel_profile_save_other_id_lists (PanelMateConfKeyType type)
-{
- if (type != PANEL_MATECONF_TOPLEVELS)
- panel_profile_save_id_list (PANEL_MATECONF_TOPLEVELS, NULL, TRUE);
-
- if (type != PANEL_MATECONF_OBJECTS)
- panel_profile_save_id_list (PANEL_MATECONF_OBJECTS, NULL, TRUE);
-
- if (type != PANEL_MATECONF_APPLETS)
- panel_profile_save_id_list (PANEL_MATECONF_APPLETS, NULL, TRUE);
}
void
-panel_profile_add_to_list (PanelMateConfKeyType type,
- const char *id)
+panel_profile_add_to_list (PanelGSettingsKeyType type,
+ const char *id)
{
- MateConfClient *client;
- GSList *list;
- const char *key;
- const char *id_list;
- char *new_id;
-
- client = panel_mateconf_get_client ();
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_general_key (id_list);
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
+ char *key;
+ char *new_id;
new_id = id ? g_strdup (id) : panel_profile_find_new_id (type);
- list = g_slist_append (list, new_id);
+ if (type == PANEL_GSETTINGS_TOPLEVELS)
+ key = g_strdup (PANEL_TOPLEVEL_ID_LIST_KEY);
+ else if (type == PANEL_GSETTINGS_OBJECTS)
+ key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
- panel_profile_save_id_list (type, list, FALSE);
- panel_profile_save_other_id_lists (type);
+ panel_gsettings_append_strv (profile_settings,
+ key,
+ new_id);
+
+ g_free (key);
+ g_free (new_id);
}
void
-panel_profile_remove_from_list (PanelMateConfKeyType type,
- const char *id)
-{
- MateConfClient *client;
- GSList *list, *l;
- const char *key;
- const char *id_list;
-
- client = panel_mateconf_get_client ();
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_general_key (id_list);
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- /* Remove all occurrence of id and not just the first. We're more solid
- * this way (see bug #137308 for example). */
- l = list;
- while (l) {
- GSList *next;
-
- next = l->next;
-
- if (!strcmp (id, l->data)) {
- g_free (l->data);
- list = g_slist_delete_link (list, l);
- }
-
- l = next;
- }
-
- panel_profile_save_id_list (type, list, FALSE);
- panel_profile_save_other_id_lists (type);
+panel_profile_remove_from_list (PanelGSettingsKeyType type,
+ const char *id)
+{
+ gchar *key;
+ if (type == PANEL_GSETTINGS_TOPLEVELS)
+ key = g_strdup (PANEL_TOPLEVEL_ID_LIST_KEY);
+ else if (type == PANEL_GSETTINGS_OBJECTS)
+ key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
+
+ panel_gsettings_remove_all_from_strv (profile_settings,
+ key,
+ id);
+ g_free (key);
}
static gboolean
-panel_profile_id_list_is_writable (PanelMateConfKeyType type)
+panel_profile_id_list_is_writable (PanelGSettingsKeyType type)
{
- MateConfClient *client;
- const char *key;
- const char *id_list;
-
- client = panel_mateconf_get_client ();
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_general_key (id_list);
- return mateconf_client_key_is_writable (client, key, NULL);
+ gboolean is_writable;
+ gchar *key;
+ if (type == PANEL_GSETTINGS_TOPLEVELS)
+ key = g_strdup (PANEL_TOPLEVEL_ID_LIST_KEY);
+ else if (type == PANEL_GSETTINGS_OBJECTS)
+ key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
+ is_writable = g_settings_is_writable (profile_settings, key);
+ g_free (key);
+ return is_writable;
}
gboolean
panel_profile_id_lists_are_writable (void)
{
return
- panel_profile_id_list_is_writable (PANEL_MATECONF_TOPLEVELS) &&
- panel_profile_id_list_is_writable (PANEL_MATECONF_APPLETS) &&
- panel_profile_id_list_is_writable (PANEL_MATECONF_OBJECTS);
+ panel_profile_id_list_is_writable (PANEL_GSETTINGS_TOPLEVELS) &&
+ panel_profile_id_list_is_writable (PANEL_GSETTINGS_OBJECTS);
}
static gboolean
@@ -1497,77 +966,68 @@ panel_profile_find_empty_spot (GdkScreen *screen,
void
panel_profile_create_toplevel (GdkScreen *screen)
{
- MateConfClient *client;
- const char *key;
char *id;
- char *dir;
+ char *path;
PanelOrientation orientation;
int monitor;
-
+ GSettings *settings;
+
g_return_if_fail (screen != NULL);
- client = panel_mateconf_get_client ();
+ id = panel_profile_find_new_id (PANEL_GSETTINGS_TOPLEVELS);
- id = panel_profile_find_new_id (PANEL_MATECONF_TOPLEVELS);
+ path = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/", id);
- dir = g_strdup_printf (PANEL_CONFIG_DIR "/toplevels/%s", id);
- panel_mateconf_associate_schemas_in_dir (client, dir, PANEL_SCHEMAS_DIR "/toplevels");
- g_free (dir);
+ settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, path);
+ g_free (path);
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, id, "screen");
- mateconf_client_set_int (client, key, gdk_screen_get_number (screen), NULL);
+ g_settings_set_int (settings, PANEL_TOPLEVEL_SCREEN_KEY, gdk_screen_get_number (screen));
if (panel_profile_find_empty_spot (screen, &orientation, &monitor)) {
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, id, "monitor");
- mateconf_client_set_int (client, key, monitor, NULL);
-
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS, id, "orientation");
- mateconf_client_set_string (client, key, panel_profile_map_orientation (orientation), NULL);
+ g_settings_set_int (settings, PANEL_TOPLEVEL_MONITOR_KEY, monitor);
+ g_settings_set_enum (settings, PANEL_TOPLEVEL_ORIENTATION_KEY, orientation);
}
- panel_profile_add_to_list (PANEL_MATECONF_TOPLEVELS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_TOPLEVELS, id);
+ g_object_unref (settings);
g_free (id);
}
static void
-panel_profile_delete_toplevel_objects (const char *toplevel_id,
- PanelMateConfKeyType key_type)
+panel_profile_delete_toplevel_objects (const char *toplevel_id)
{
- MateConfClient *client;
- const char *key;
- GSList *new_list = NULL,*list, *l;
+ gchar **list;
+ GArray *newlist;
+ int i;
- client = panel_mateconf_get_client ();
+ list = g_settings_get_strv (profile_settings, PANEL_OBJECT_ID_LIST_KEY);
+ newlist = g_array_new (TRUE, TRUE, sizeof (gchar *));
- key = panel_mateconf_general_key (panel_mateconf_key_type_to_id_list (key_type));
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- for (l = list; l; l = l->next) {
- char *id = l->data;
+ for (i = 0; list[i]; i++) {
+ char *path;
char *parent_toplevel_id;
+ GSettings *settings;
- key = panel_mateconf_full_key (key_type, id, "toplevel_id");
- parent_toplevel_id = mateconf_client_get_string (client, key, NULL);
+ path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", list[i]);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
+ parent_toplevel_id = g_settings_get_string (settings, PANEL_OBJECT_TOPLEVEL_ID_KEY);
+ g_free (path);
+ g_object_unref (settings);
if (parent_toplevel_id && !strcmp (toplevel_id, parent_toplevel_id)) {
- g_free (id);
g_free (parent_toplevel_id);
continue;
}
- new_list = g_slist_prepend (new_list, id);
+ newlist = g_array_append_val (newlist, list[i]);
g_free (parent_toplevel_id);
}
- g_slist_free (list);
-
- key = panel_mateconf_general_key (panel_mateconf_key_type_to_id_list (key_type));
- mateconf_client_set_list (client, key, MATECONF_VALUE_STRING, new_list, NULL);
- for (l = new_list; l; l = l->next)
- g_free (l->data);
- g_slist_free (new_list);
+ g_settings_set_strv (profile_settings, PANEL_OBJECT_ID_LIST_KEY, (const gchar **) newlist->data);
+ g_array_free (newlist, TRUE);
+ g_strfreev (list);
}
void
@@ -1577,29 +1037,22 @@ panel_profile_delete_toplevel (PanelToplevel *toplevel)
toplevel_id = panel_profile_get_toplevel_id (toplevel);
- panel_profile_delete_toplevel_objects (toplevel_id, PANEL_MATECONF_OBJECTS);
- panel_profile_delete_toplevel_objects (toplevel_id, PANEL_MATECONF_APPLETS);
+ panel_profile_delete_toplevel_objects (toplevel_id);
- panel_profile_remove_from_list (PANEL_MATECONF_TOPLEVELS, toplevel_id);
+ panel_profile_remove_from_list (PANEL_GSETTINGS_TOPLEVELS, toplevel_id);
}
static GdkScreen *
-get_toplevel_screen (MateConfClient *client,
- const char *toplevel_dir)
+get_toplevel_screen (char *toplevel_path)
{
- GError *error = NULL;
+
GdkDisplay *display;
- const char *key;
+ GSettings *settings;
int screen_n;
- key = panel_mateconf_sprintf ("%s/screen", toplevel_dir);
- screen_n = mateconf_client_get_int (client, key, &error);
- if (error) {
- g_warning (_("Error reading MateConf integer value '%s': %s"),
- key, error->message);
- g_error_free (error);
- return gdk_screen_get_default ();
- }
+ settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, toplevel_path);
+ screen_n = g_settings_get_int (settings, "screen");
+ g_object_unref (settings);
display = gdk_display_get_default ();
@@ -1616,42 +1069,20 @@ get_toplevel_screen (MateConfClient *client,
}
PanelToplevel *
-panel_profile_load_toplevel (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *toplevel_id)
+panel_profile_load_toplevel (char *toplevel_id)
{
PanelToplevel *toplevel;
GdkScreen *screen;
- GError *error;
- const char *key;
- char *toplevel_dir;
- guint notify_id;
+ char *toplevel_path;
+ char *toplevel_background_path;
if (!toplevel_id || !toplevel_id [0])
return NULL;
- toplevel_dir = g_strdup_printf ("%s/toplevels/%s", profile_dir, toplevel_id);
+ toplevel_path = g_strdup_printf ("%s%s/", PANEL_TOPLEVEL_PATH, toplevel_id);
- if (!mateconf_client_dir_exists (client, toplevel_dir, NULL))
- panel_mateconf_associate_schemas_in_dir (
- client, toplevel_dir, PANEL_SCHEMAS_DIR "/toplevels");
-
- mateconf_client_add_dir (client,
- toplevel_dir,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
-
- key = panel_mateconf_sprintf ("%s/background", toplevel_dir);
- mateconf_client_add_dir (client,
- key,
- MATECONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
-
- if (!(screen = get_toplevel_screen (client, toplevel_dir))) {
- mateconf_client_remove_dir (client, key, NULL);
- mateconf_client_remove_dir (client, toplevel_dir, NULL);
- g_free (toplevel_dir);
+ if (!(screen = get_toplevel_screen (toplevel_path))) {
+ g_free (toplevel_path);
return NULL;
}
@@ -1659,131 +1090,86 @@ panel_profile_load_toplevel (MateConfClient *client,
"screen", screen,
NULL);
-#define GET_INT(k, fn) \
- { \
- int val; \
- error = NULL; \
- key = panel_mateconf_sprintf ("%s/" k, toplevel_dir); \
- val = mateconf_client_get_int (client, key, &error); \
- if (!error) \
- panel_toplevel_set_##fn (toplevel, val); \
- else { \
- g_warning (_("Error reading MateConf integer value '%s': %s"), \
- key, error->message); \
- g_error_free (error); \
- } \
+ panel_toplevel_set_settings_path (toplevel, toplevel_path);
+ toplevel->settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, toplevel_path);
+ toplevel->queued_settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, toplevel_path);
+
+ toplevel_background_path = g_strdup_printf ("%sbackground/", toplevel_path);
+ toplevel->background_settings = g_settings_new_with_path (PANEL_TOPLEVEL_BACKGROUND_SCHEMA, toplevel_background_path);
+
+#define GET_INT(k, fn) \
+ { \
+ int val; \
+ val = g_settings_get_int (toplevel->settings, k); \
+ panel_toplevel_set_##fn (toplevel, val); \
+ }
+
+#define GET_BOOL(k, fn) \
+ { \
+ gboolean val; \
+ val = g_settings_get_boolean (toplevel->settings, k); \
+ panel_toplevel_set_##fn (toplevel, val); \
}
-#define GET_BOOL(k, fn) \
- { \
- gboolean val; \
- error = NULL; \
- key = panel_mateconf_sprintf ("%s/" k, toplevel_dir); \
- val = mateconf_client_get_bool (client, key, &error); \
- if (!error) \
- panel_toplevel_set_##fn (toplevel, val); \
- else { \
- g_warning (_("Error reading MateConf boolean value '%s': %s"), \
- key, error->message); \
- g_error_free (error); \
- } \
+#define GET_STRING(k, fn) \
+ { \
+ char *val; \
+ val = g_settings_get_string (toplevel->settings, k); \
+ panel_toplevel_set_##fn (toplevel, val); \
+ g_free (val); \
}
-#define GET_STRING(k, fn) \
- { \
- char *val; \
- error = NULL; \
- key = panel_mateconf_sprintf ("%s/" k, toplevel_dir); \
- val = mateconf_client_get_string (client, key, &error); \
- if (!error && val) { \
- set_##fn##_from_string (toplevel, val); \
- g_free (val); \
- } else if (error) { \
- g_warning (_("Error reading MateConf string value '%s': %s"), \
- key, error->message); \
- g_error_free (error); \
- } \
+#define GET_ENUM(k, fn) \
+ { \
+ int val; \
+ val = g_settings_get_enum (toplevel->settings, k); \
+ panel_toplevel_set_##fn (toplevel, val); \
}
GET_STRING ("name", name);
GET_INT ("monitor", monitor);
GET_BOOL ("expand", expand);
- GET_STRING ("orientation", orientation);
+ GET_ENUM ("orientation", orientation);
GET_INT ("size", size);
- GET_BOOL ("auto_hide", auto_hide);
- GET_BOOL ("enable_animations", animate);
- GET_BOOL ("enable_buttons", enable_buttons);
- GET_BOOL ("enable_arrows", enable_arrows);
- GET_INT ("hide_delay", hide_delay);
- GET_INT ("unhide_delay", unhide_delay);
- GET_INT ("auto_hide_size", auto_hide_size);
- GET_STRING ("animation_speed", animation_speed);
-
-#define GET_POSITION(a, b, c, fn) \
- { \
- gboolean centered; \
- int position; \
- int position2; \
- key = panel_mateconf_sprintf ("%s/" c, toplevel_dir); \
- centered = mateconf_client_get_bool (client, key, &error); \
- if (!error) { \
- key = panel_mateconf_sprintf ("%s/" a, toplevel_dir); \
- position = mateconf_client_get_int (client, key, &error); \
- } \
- if (!error) { \
- MateConfValue *value; \
- key = panel_mateconf_sprintf ("%s/" b, toplevel_dir); \
- /* we need to do this since the key was added in 2.19 and \
- * the default value returned when the key is not set \
- * (for people coming from older versions) is 0, which \
- * is not what we want. */ \
- value = mateconf_client_get_without_default (client, key, &error);\
- if (value && value->type == MATECONF_VALUE_INT) \
- position2 = mateconf_value_get_int (value); \
- else \
- position2 = -1; \
- \
- if (value) \
- mateconf_value_free (value); \
- } \
- if (!error) \
- panel_toplevel_set_##fn (toplevel, position, position2, \
- centered); \
- else { \
- g_warning (_("Error reading MateConf integer value '%s': %s"), \
- key, error->message); \
- g_error_free (error); \
- } \
+ GET_BOOL ("auto-hide", auto_hide);
+ GET_BOOL ("enable-animations", animate);
+ GET_BOOL ("enable-buttons", enable_buttons);
+ GET_BOOL ("enable-arrows", enable_arrows);
+ GET_INT ("hide-delay", hide_delay);
+ GET_INT ("unhide-delay", unhide_delay);
+ GET_INT ("auto-hide-size", auto_hide_size);
+ GET_ENUM ("animation-speed", animation_speed);
+
+#define GET_POSITION(a, b, c, fn) \
+ { \
+ gboolean centered; \
+ int position; \
+ int position2; \
+ centered = g_settings_get_boolean (toplevel->settings, c); \
+ position = g_settings_get_int (toplevel->settings, a); \
+ position2 = g_settings_get_int (toplevel->settings, b); \
+ panel_toplevel_set_##fn (toplevel, position, position2, centered); \
}
- GET_POSITION ("x", "x_right", "x_centered", x);
- GET_POSITION ("y", "y_bottom", "y_centered", y);
+ GET_POSITION ("x", "x-right", "x-centered", x);
+ GET_POSITION ("y", "y-bottom", "y-centered", y);
- panel_profile_load_background (toplevel, client, toplevel_dir);
+ panel_profile_load_background (toplevel);
panel_profile_set_toplevel_id (toplevel, toplevel_id);
panel_profile_connect_to_toplevel (toplevel);
- notify_id = panel_profile_toplevel_notify_add (
- toplevel,
- NULL,
- (MateConfClientNotifyFunc) panel_profile_toplevel_change_notify,
- toplevel);
- g_signal_connect (toplevel, "destroy",
- G_CALLBACK (panel_profile_disconnect_toplevel),
- GUINT_TO_POINTER (notify_id));
-
- notify_id = panel_profile_toplevel_notify_add (
- toplevel,
- "background",
- (MateConfClientNotifyFunc) panel_profile_background_change_notify,
- toplevel);
- g_signal_connect (toplevel, "destroy",
- G_CALLBACK (panel_profile_disconnect_toplevel),
- GUINT_TO_POINTER (notify_id));
-
- g_free (toplevel_dir);
+ g_signal_connect (toplevel->settings,
+ "changed",
+ G_CALLBACK (panel_profile_toplevel_change_notify),
+ toplevel);
+ g_signal_connect (toplevel->background_settings,
+ "changed",
+ G_CALLBACK (panel_profile_background_change_notify),
+ toplevel);
+
+ g_free (toplevel_background_path);
panel_setup (toplevel);
@@ -1791,18 +1177,13 @@ panel_profile_load_toplevel (MateConfClient *client,
}
static void
-panel_profile_load_and_show_toplevel (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *toplevel_id)
+panel_profile_load_and_show_toplevel (char *toplevel_id)
{
- PanelToplevel *toplevel;
- const char *id_list;
- const char *key;
- MateConfValue *value;
- gboolean loading_queued_applets;
+ PanelToplevel *toplevel;
+ gchar **objects;
+ gboolean loading_queued_applets;
- toplevel = panel_profile_load_toplevel (client, profile_dir, type, toplevel_id);
+ toplevel = panel_profile_load_toplevel (toplevel_id);
if (!toplevel)
return;
@@ -1812,39 +1193,27 @@ panel_profile_load_and_show_toplevel (MateConfClient *client,
/* reload list of objects to get those that might be on the new
* toplevel */
- id_list = panel_mateconf_key_type_to_id_list (PANEL_MATECONF_OBJECTS);
- key = panel_mateconf_sprintf ("%s/general/%s", profile_dir, id_list);
- value = mateconf_client_get (client, key, NULL);
- if (value) {
- panel_profile_object_id_list_update (client, value,
- PANEL_MATECONF_OBJECTS);
- loading_queued_applets = TRUE;
- mateconf_value_free (value);
- }
-
- id_list = panel_mateconf_key_type_to_id_list (PANEL_MATECONF_APPLETS);
- key = panel_mateconf_sprintf ("%s/general/%s", profile_dir, id_list);
- value = mateconf_client_get (client, key, NULL);
- if (value) {
- panel_profile_object_id_list_update (client, value,
- PANEL_MATECONF_APPLETS);
+ GSettings *panel_settings;
+ panel_settings = g_settings_new (PANEL_SCHEMA);
+ objects = g_settings_get_strv (panel_settings, PANEL_OBJECT_ID_LIST_KEY);
+
+ if (objects) {
+ panel_profile_object_id_list_update (objects);
loading_queued_applets = TRUE;
- mateconf_value_free (value);
}
if (!loading_queued_applets)
mate_panel_applet_load_queued_applets (FALSE);
+
+ g_strfreev (objects);
+ g_object_unref (panel_settings);
}
static void
-panel_profile_load_and_show_toplevel_startup (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *toplevel_id)
+panel_profile_load_and_show_toplevel_startup (const char *toplevel_id)
{
PanelToplevel *toplevel;
-
- toplevel = panel_profile_load_toplevel (client, profile_dir, type, toplevel_id);
+ toplevel = panel_profile_load_toplevel (toplevel_id);
if (toplevel)
gtk_widget_show (GTK_WIDGET (toplevel));
}
@@ -1866,39 +1235,26 @@ panel_profile_prepare_object_with_id (PanelObjectType object_type,
int position,
gboolean right_stick)
{
- PanelMateConfKeyType key_type;
- MateConfClient *client;
+ PanelGSettingsKeyType key_type;
const char *key;
char *id;
- char *dir;
-
- key_type = (object_type == PANEL_OBJECT_APPLET) ? PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS;
-
- client = panel_mateconf_get_client ();
+ char *settings_path;
+ GSettings *settings;
+ key_type = PANEL_GSETTINGS_OBJECTS;
id = panel_profile_find_new_id (key_type);
- dir = g_strdup_printf (PANEL_CONFIG_DIR "/%s/%s",
- (key_type == PANEL_MATECONF_APPLETS) ? "applets" : "objects",
- id);
- panel_mateconf_associate_schemas_in_dir (client, dir, PANEL_SCHEMAS_DIR "/objects");
-
- key = panel_mateconf_full_key (key_type, id, "object_type");
- mateconf_client_set_string (client,
- key,
- mateconf_enum_to_string (panel_object_type_map, object_type),
- NULL);
+ settings_path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
- key = panel_mateconf_full_key (key_type, id, "toplevel_id");
- mateconf_client_set_string (client, key, toplevel_id, NULL);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, settings_path);
- key = panel_mateconf_full_key (key_type, id, "position");
- mateconf_client_set_int (client, key, position, NULL);
+ g_settings_set_enum (settings, PANEL_OBJECT_TYPE_KEY, object_type);
+ g_settings_set_string (settings, PANEL_OBJECT_TOPLEVEL_ID_KEY, toplevel_id);
+ g_settings_set_int (settings, PANEL_OBJECT_POSITION_KEY, position);
+ g_settings_set_boolean (settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY, right_stick);
- key = panel_mateconf_full_key (key_type, id, "panel_right_stick");
- mateconf_client_set_bool (client, key, right_stick, NULL);
-
- g_free (dir);
+ g_free (settings_path);
+ g_object_unref (settings);
return id;
}
@@ -1918,59 +1274,34 @@ panel_profile_prepare_object (PanelObjectType object_type,
void
panel_profile_delete_object (AppletInfo *applet_info)
{
- PanelMateConfKeyType type;
+ PanelGSettingsKeyType type;
const char *id;
- type = (applet_info->type) == PANEL_OBJECT_APPLET ? PANEL_MATECONF_APPLETS :
- PANEL_MATECONF_OBJECTS;
+ type = PANEL_GSETTINGS_OBJECTS;
id = mate_panel_applet_get_id (applet_info);
panel_profile_remove_from_list (type, id);
}
static void
-panel_profile_load_object (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *id)
+panel_profile_load_object (char *id)
{
PanelObjectType object_type;
- char *object_dir;
- const char *key;
- char *type_string;
+ char *object_path;
char *toplevel_id;
int position;
gboolean right_stick;
gboolean locked;
+ GSettings *settings;
- object_dir = g_strdup_printf ("%s/%s/%s",
- profile_dir,
- type == PANEL_MATECONF_OBJECTS ? "objects" : "applets",
- id);
-
- mateconf_client_add_dir (client, object_dir, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = panel_mateconf_sprintf ("%s/object_type", object_dir);
- type_string = mateconf_client_get_string (client, key, NULL);
-
- if (!panel_profile_map_object_type_string (type_string, &object_type)) {
- g_free (type_string);
- mateconf_client_remove_dir (client, object_dir, NULL);
- g_free (object_dir);
- return;
- }
-
- key = panel_mateconf_sprintf ("%s/position", object_dir);
- position = mateconf_client_get_int (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/toplevel_id", object_dir);
- toplevel_id = mateconf_client_get_string (client, key, NULL);
-
- key = panel_mateconf_sprintf ("%s/panel_right_stick", object_dir);
- right_stick = mateconf_client_get_bool (client, key, NULL);
+ object_path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, object_path);
- key = panel_mateconf_sprintf ("%s/locked", object_dir);
- locked = mateconf_client_get_bool (client, key, NULL);
+ object_type = g_settings_get_enum (settings, PANEL_OBJECT_TYPE_KEY);
+ position = g_settings_get_int (settings, PANEL_OBJECT_POSITION_KEY);
+ toplevel_id = g_settings_get_string (settings, PANEL_OBJECT_TOPLEVEL_ID_KEY);
+ right_stick = g_settings_get_boolean (settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY);
+ locked = g_settings_get_boolean (settings, PANEL_OBJECT_LOCKED_KEY);
mate_panel_applet_queue_applet_to_load (id,
object_type,
@@ -1980,8 +1311,8 @@ panel_profile_load_object (MateConfClient *client,
locked);
g_free (toplevel_id);
- g_free (type_string);
- g_free (object_dir);
+ g_free (object_path);
+ g_object_unref (settings);
}
static void
@@ -1995,43 +1326,36 @@ panel_profile_destroy_object (const char *id)
}
static void
-panel_profile_delete_dir (MateConfClient *client,
- PanelMateConfKeyType type,
- const char *id)
+panel_profile_delete_dir (PanelGSettingsKeyType type,
+ const char *id)
{
- const char *key;
- char *type_str;
+ gchar *dir;
switch (type) {
- case PANEL_MATECONF_TOPLEVELS:
- type_str = "toplevels";
- break;
- case PANEL_MATECONF_OBJECTS:
- type_str = "objects";
- break;
- case PANEL_MATECONF_APPLETS:
- type_str = "applets";
- break;
- default:
- type_str = NULL;
- g_assert_not_reached ();
- break;
+ case PANEL_GSETTINGS_TOPLEVELS:
+ dir = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/", id);
+ break;
+ case PANEL_GSETTINGS_OBJECTS:
+ dir = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
+ break;
}
- if (type == PANEL_MATECONF_TOPLEVELS) {
- key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/%s/%s/background",
- type_str, id);
- mateconf_client_remove_dir (client, key, NULL);
+ if (type == PANEL_GSETTINGS_TOPLEVELS) {
+ gchar *subdir;
+ subdir = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/background/", id);
+ panel_dconf_recursive_reset (subdir, NULL);
+ g_free (subdir);
+ }
+ else if (type == PANEL_GSETTINGS_OBJECTS) {
+ gchar *subdir;
+ subdir = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/prefs/", id);
+ panel_dconf_recursive_reset (subdir, NULL);
+ g_free (subdir);
}
- key = panel_mateconf_sprintf (PANEL_CONFIG_DIR "/%s/%s",
- type_str, id);
- mateconf_client_remove_dir (client, key, NULL);
+ panel_dconf_recursive_reset (dir, NULL);
- mateconf_client_recursive_unset (client,
- key,
- MATECONF_UNSET_INCLUDING_SCHEMA_NAMES,
- NULL);
+ g_free (dir);
}
static gboolean
@@ -2067,7 +1391,7 @@ panel_profile_id_exists (GSList *id_list,
return FALSE;
for (l = id_list; l; l = l->next) {
- const char *check_id = mateconf_value_get_string (l->data);
+ const char *check_id = l->data;
if (!strcmp (id, check_id))
return TRUE;
@@ -2077,19 +1401,17 @@ panel_profile_id_exists (GSList *id_list,
}
static void
-panel_profile_load_added_ids (MateConfClient *client,
- PanelMateConfKeyType type,
- GSList *list,
- GSList *id_list,
- PanelProfileGetIdFunc get_id_func,
- PanelProfileLoadFunc load_handler,
- PanelProfileOnLoadQueue on_load_queue)
+panel_profile_load_added_ids (GSList *list,
+ GSList *id_list,
+ PanelProfileGetIdFunc get_id_func,
+ PanelProfileLoadFunc load_handler,
+ PanelProfileOnLoadQueue on_load_queue)
{
GSList *added_ids = NULL;
GSList *l;
for (l = id_list; l; l = l->next) {
- const char *id = mateconf_value_get_string (l->data);
+ const char *id = l->data;
if (!panel_profile_object_exists (list, id, get_id_func) &&
(on_load_queue == NULL || !on_load_queue (id)))
@@ -2101,7 +1423,7 @@ panel_profile_load_added_ids (MateConfClient *client,
id = (char *) l->data;
if (id && id[0])
- load_handler (client, PANEL_CONFIG_DIR, type, id);
+ load_handler (id);
g_free (l->data);
l->data = NULL;
@@ -2111,12 +1433,11 @@ panel_profile_load_added_ids (MateConfClient *client,
}
static void
-panel_profile_delete_removed_ids (MateConfClient *client,
- PanelMateConfKeyType type,
- GSList *list,
- GSList *id_list,
- PanelProfileGetIdFunc get_id_func,
- PanelProfileDestroyFunc destroy_handler)
+panel_profile_delete_removed_ids (PanelGSettingsKeyType type,
+ GSList *list,
+ GSList *id_list,
+ PanelProfileGetIdFunc get_id_func,
+ PanelProfileDestroyFunc destroy_handler)
{
GSList *removed_ids = NULL;
GSList *l;
@@ -2133,7 +1454,7 @@ panel_profile_delete_removed_ids (MateConfClient *client,
for (l = removed_ids; l; l = l->next) {
const char *id = l->data;
- panel_profile_delete_dir (client, type, id);
+ panel_profile_delete_dir (type, id);
destroy_handler (id);
g_free (l->data);
@@ -2143,27 +1464,21 @@ panel_profile_delete_removed_ids (MateConfClient *client,
}
static void
-panel_profile_toplevel_id_list_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry)
+panel_profile_toplevel_id_list_notify (GSettings *settings,
+ gchar *key,
+ gpointer user_data)
{
- MateConfValue *value;
GSList *l, *existing_toplevels;
GSList *toplevel_ids;
+ gchar **toplevel_ids_strv;
- if (!(value = mateconf_entry_get_value (entry)))
- return;
+ toplevel_ids_strv = g_settings_get_strv (settings, key);
- if (value->type != MATECONF_VALUE_LIST ||
- mateconf_value_get_list_type (value) != MATECONF_VALUE_STRING) {
- mateconf_value_free (value);
- return;
- }
-
- toplevel_ids = g_slist_copy (mateconf_value_get_list (value));
+ toplevel_ids = panel_gsettings_strv_to_gslist (toplevel_ids_strv);
toplevel_ids = panel_g_slist_make_unique (toplevel_ids,
- panel_mateconf_value_strcmp,
+ g_strcmp0,
FALSE);
+ g_strfreev (toplevel_ids_strv);
existing_toplevels = NULL;
for (l = panel_toplevel_list_toplevels (); l; l = l->next) {
@@ -2176,69 +1491,52 @@ panel_profile_toplevel_id_list_notify (MateConfClient *client,
existing_toplevels = g_slist_prepend (existing_toplevels, toplevel);
}
- panel_profile_load_added_ids (client,
- PANEL_MATECONF_TOPLEVELS,
- existing_toplevels,
- toplevel_ids,
- (PanelProfileGetIdFunc) panel_profile_get_toplevel_id,
- (PanelProfileLoadFunc) panel_profile_load_and_show_toplevel,
- (PanelProfileOnLoadQueue) NULL);
-
- panel_profile_delete_removed_ids (client,
- PANEL_MATECONF_TOPLEVELS,
- existing_toplevels,
- toplevel_ids,
- (PanelProfileGetIdFunc) panel_profile_get_toplevel_id,
- (PanelProfileDestroyFunc) panel_profile_destroy_toplevel);
+ panel_profile_load_added_ids (existing_toplevels,
+ toplevel_ids,
+ (PanelProfileGetIdFunc) panel_profile_get_toplevel_id,
+ (PanelProfileLoadFunc) panel_profile_load_and_show_toplevel,
+ (PanelProfileOnLoadQueue) NULL);
+
+ panel_profile_delete_removed_ids (PANEL_GSETTINGS_TOPLEVELS,
+ existing_toplevels,
+ toplevel_ids,
+ (PanelProfileGetIdFunc) panel_profile_get_toplevel_id,
+ (PanelProfileDestroyFunc) panel_profile_destroy_toplevel);
g_slist_free (existing_toplevels);
g_slist_free (toplevel_ids);
}
static void
-panel_profile_object_id_list_update (MateConfClient *client,
- MateConfValue *value,
- PanelMateConfKeyType type)
+panel_profile_object_id_list_update (gchar **objects)
{
GSList *existing_applets;
GSList *sublist = NULL, *l;
GSList *object_ids;
- if (value->type != MATECONF_VALUE_LIST ||
- mateconf_value_get_list_type (value) != MATECONF_VALUE_STRING) {
- mateconf_value_free (value);
- return;
- }
-
- object_ids = g_slist_copy (mateconf_value_get_list (value));
+ object_ids = panel_gsettings_strv_to_gslist (objects);
object_ids = panel_g_slist_make_unique (object_ids,
- panel_mateconf_value_strcmp,
+ g_strcmp0,
FALSE);
existing_applets = mate_panel_applet_list_applets ();
for (l = existing_applets; l; l = l->next) {
AppletInfo *info = l->data;
-
- if ((type == PANEL_MATECONF_APPLETS && info->type == PANEL_OBJECT_APPLET) ||
- (type == PANEL_MATECONF_OBJECTS && info->type != PANEL_OBJECT_APPLET))
- sublist = g_slist_prepend (sublist, info);
+ sublist = g_slist_prepend (sublist, info);
}
- panel_profile_load_added_ids (client,
- type,
- sublist,
- object_ids,
- (PanelProfileGetIdFunc) mate_panel_applet_get_id,
- (PanelProfileLoadFunc) panel_profile_load_object,
- (PanelProfileOnLoadQueue) mate_panel_applet_on_load_queue);
-
- panel_profile_delete_removed_ids (client,
- type,
- sublist,
- object_ids,
- (PanelProfileGetIdFunc) mate_panel_applet_get_id,
- (PanelProfileDestroyFunc) panel_profile_destroy_object);
+ panel_profile_load_added_ids (sublist,
+ object_ids,
+ (PanelProfileGetIdFunc) mate_panel_applet_get_id,
+ (PanelProfileLoadFunc) panel_profile_load_object,
+ (PanelProfileOnLoadQueue) mate_panel_applet_on_load_queue);
+
+ panel_profile_delete_removed_ids (PANEL_GSETTINGS_OBJECTS,
+ sublist,
+ object_ids,
+ (PanelProfileGetIdFunc) mate_panel_applet_get_id,
+ (PanelProfileDestroyFunc) panel_profile_destroy_object);
g_slist_free (sublist);
g_slist_free (object_ids);
@@ -2247,237 +1545,50 @@ panel_profile_object_id_list_update (MateConfClient *client,
}
static void
-panel_profile_object_id_list_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer data)
-{
- MateConfValue *value;
- PanelMateConfKeyType type = GPOINTER_TO_INT (data);
-
- if (!(value = mateconf_entry_get_value (entry)))
- return;
-
- panel_profile_object_id_list_update (client, value, type);
-}
-
-static void
-panel_profile_load_list (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- PanelProfileLoadFunc load_handler,
- MateConfClientNotifyFunc notify_handler)
-{
-
- const char *key;
- GSList *list;
- GSList *l;
- const char *id_list;
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_sprintf ("%s/general/%s", profile_dir, id_list);
-
- mateconf_client_notify_add (client, key, notify_handler,
- GINT_TO_POINTER (type),
- NULL, NULL);
-
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
- list = panel_g_slist_make_unique (list,
- (GCompareFunc) strcmp,
- TRUE);
-
- for (l = list; l; l = l->next) {
- char *id;
- id = (char *) l->data;
-
- if (id && id[0])
- load_handler (client, profile_dir, type, id);
-
- g_free (l->data);
- l->data = NULL;
- }
- g_slist_free (list);
-}
-
-static GSList *
-panel_profile_copy_defaults_for_screen (MateConfClient *client,
- const char *profile_dir,
- int screen_n,
- PanelMateConfKeyType type)
-{
- GSList *default_ids, *l;
- GSList *new_ids = NULL;
- const char *key;
- const char *id_list, *type_str;
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- switch (type) {
- case PANEL_MATECONF_TOPLEVELS:
- type_str = "toplevels";
- break;
- case PANEL_MATECONF_OBJECTS:
- type_str = "objects";
- break;
- case PANEL_MATECONF_APPLETS:
- type_str = "applets";
- break;
- default:
- type_str = NULL;
- g_assert_not_reached ();
- break;
- }
-
- key = panel_mateconf_sprintf (PANEL_DEFAULTS_DIR "/general/%s", id_list);
- default_ids = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- for (l = default_ids; l; l = l->next) {
- char *default_id = l->data;
- char *new_id;
- char *src_dir;
- char *dest_dir;
-
- new_id = g_strdup_printf ("%s_screen%d", default_id, screen_n);
-
- src_dir = g_strdup_printf (PANEL_DEFAULTS_DIR "/%s/%s", type_str, default_id);
- dest_dir = g_strdup_printf ("%s/%s/%s", profile_dir, type_str, new_id);
-
- panel_mateconf_copy_dir (client, src_dir, dest_dir);
-
- new_ids = g_slist_prepend (new_ids, new_id);
-
- g_free (src_dir);
- g_free (dest_dir);
- g_free (l->data);
- }
- g_slist_free (default_ids);
-
- return new_ids;
-}
-
-static void
-panel_profile_append_new_ids (MateConfClient *client,
- PanelMateConfKeyType type,
- GSList *new_ids)
+panel_profile_object_id_list_notify (GSettings *settings,
+ gchar *key,
+ gpointer data)
{
- GSList *list, *l;
- const char *key;
- const char *id_list;
-
- id_list = panel_mateconf_key_type_to_id_list (type);
-
- key = panel_mateconf_general_key (id_list);
- list = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, NULL);
-
- for (l = new_ids; l; l = l->next)
- list = g_slist_append (list, l->data);
-
- g_slist_free (new_ids);
-
- mateconf_client_set_list (client, key, MATECONF_VALUE_STRING, list, NULL);
-
- for (l = list; l; l = l->next)
- g_free (l->data);
- g_slist_free (list);
+ gchar **objects;
+ objects = g_settings_get_strv (settings, key);
+ panel_profile_object_id_list_update (objects);
+ g_strfreev (objects);
}
static void
-panel_profile_copy_default_objects_for_screen (MateConfClient *client,
- const char *profile_dir,
- int screen_n,
- PanelMateConfKeyType type)
-{
- GSList *new_objects, *l, *next;
-
- new_objects = panel_profile_copy_defaults_for_screen (client, profile_dir, screen_n, type);
-
- for (l = new_objects; l; l = next) {
- char *object_id = l->data;
- const char *key;
- char *toplevel_id;
- char *new_toplevel_id;
-
- next = l->next;
-
- key = panel_mateconf_full_key (type, object_id, "toplevel_id");
- toplevel_id = mateconf_client_get_string (client, key, NULL);
- if (!toplevel_id) {
- new_objects = g_slist_remove_link (new_objects, l);
- g_free (l->data);
- g_slist_free_1 (l);
- continue;
- }
-
- new_toplevel_id = g_strdup_printf ("%s_screen%d", toplevel_id, screen_n);
- mateconf_client_set_string (client, key, new_toplevel_id, NULL);
-
- g_free (toplevel_id);
- g_free (new_toplevel_id);
- }
-
- panel_profile_append_new_ids (client, type, new_objects);
-}
-
-/* FIXME:
- * We might want to do something more sophisticated like hardcode
- * the default panel setup as the fallback panels.
- */
-static GSList *
-panel_profile_create_fallback_toplevel_list (MateConfClient *client,
- const char *profile_dir)
+panel_profile_load_list (GSettings *settings,
+ PanelGSettingsKeyType type,
+ PanelProfileLoadFunc load_handler,
+ GCallback notify_handler)
{
- char *id;
- char *dir;
- id = panel_profile_find_new_id (PANEL_MATECONF_TOPLEVELS);
+ gchar *key;
+ gchar *changed_signal;
+ gchar **list;
+ gint i;
- dir = g_strdup_printf ("%s/toplevels/%s", profile_dir, id);
- panel_mateconf_associate_schemas_in_dir (client, dir, PANEL_SCHEMAS_DIR "/toplevels");
- g_free (dir);
+ if (type == PANEL_GSETTINGS_TOPLEVELS)
+ key = g_strdup (PANEL_TOPLEVEL_ID_LIST_KEY);
+ else if (type == PANEL_GSETTINGS_OBJECTS)
+ key = g_strdup (PANEL_OBJECT_ID_LIST_KEY);
- return g_slist_prepend (NULL, id);
-}
+ changed_signal = g_strdup_printf ("changed::%s", key);
-static void
-panel_profile_load_defaults_on_screen (MateConfClient *client,
- const char *profile_dir,
- GdkScreen *screen)
-{
- GSList *new_toplevels, *l;
- int screen_n;
+ g_signal_connect (settings, changed_signal, G_CALLBACK (notify_handler), NULL);
- screen_n = gdk_screen_get_number (screen);
+ list = g_settings_get_strv (settings, key);
- new_toplevels = panel_profile_copy_defaults_for_screen (
- client, profile_dir, screen_n, PANEL_MATECONF_TOPLEVELS);
- if (!new_toplevels) {
- g_warning ("Failed to load default panel configuration. panel-default-setup.entries "
- "hasn't been installed using mateconftool-2 --load ?\n");
- new_toplevels = panel_profile_create_fallback_toplevel_list (client, profile_dir);
+ for (i = 0; list[i]; i++) {
+ load_handler (list[i]);
}
-
- for (l = new_toplevels; l; l = l->next) {
- char *toplevel_id = l->data;
- const char *key;
-
- key = panel_mateconf_full_key (PANEL_MATECONF_TOPLEVELS,
- toplevel_id,
- "screen");
- mateconf_client_set_int (client, key, screen_n, NULL);
- }
-
- panel_profile_append_new_ids (client, PANEL_MATECONF_TOPLEVELS, new_toplevels);
-
- panel_profile_copy_default_objects_for_screen (
- client, profile_dir, screen_n, PANEL_MATECONF_OBJECTS);
- panel_profile_copy_default_objects_for_screen (
- client, profile_dir, screen_n, PANEL_MATECONF_APPLETS);
+ if (list)
+ g_strfreev (list);
+ g_free (changed_signal);
+ g_free (key);
}
static void
-panel_profile_ensure_toplevel_per_screen (MateConfClient *client,
- const char *profile_dir)
+panel_profile_ensure_toplevel_per_screen ()
{
GSList *toplevels;
GSList *empty_screens = NULL;
@@ -2504,7 +1615,7 @@ panel_profile_ensure_toplevel_per_screen (MateConfClient *client,
}
for (l = empty_screens; l; l = l->next)
- panel_profile_load_defaults_on_screen (client, profile_dir, l->data);
+ panel_layout_apply_default_from_gkeyfile (l->data);
g_slist_free (empty_screens);
}
@@ -2512,112 +1623,71 @@ panel_profile_ensure_toplevel_per_screen (MateConfClient *client,
void
panel_profile_load (void)
{
- MateConfClient *client;
-
- client = panel_mateconf_get_client ();
-
- mateconf_client_add_dir (client, PANEL_CONFIG_DIR "/general", MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ profile_settings = g_settings_new ("org.mate.panel");
- panel_compatibility_maybe_copy_old_config (client);
-
- panel_compatibility_migrate_panel_id_list (client);
-
- panel_profile_load_list (client,
- PANEL_CONFIG_DIR,
- PANEL_MATECONF_TOPLEVELS,
+ panel_profile_load_list (profile_settings,
+ PANEL_GSETTINGS_TOPLEVELS,
panel_profile_load_and_show_toplevel_startup,
- (MateConfClientNotifyFunc) panel_profile_toplevel_id_list_notify);
- panel_profile_load_list (client,
- PANEL_CONFIG_DIR,
- PANEL_MATECONF_OBJECTS,
- panel_profile_load_object,
- (MateConfClientNotifyFunc) panel_profile_object_id_list_notify);
- panel_profile_load_list (client,
- PANEL_CONFIG_DIR,
- PANEL_MATECONF_APPLETS,
+ G_CALLBACK (panel_profile_toplevel_id_list_notify));
+ panel_profile_load_list (profile_settings,
+ PANEL_GSETTINGS_OBJECTS,
panel_profile_load_object,
- (MateConfClientNotifyFunc) panel_profile_object_id_list_notify);
+ G_CALLBACK (panel_profile_object_id_list_notify));
- panel_profile_ensure_toplevel_per_screen (client, PANEL_CONFIG_DIR);
+ panel_profile_ensure_toplevel_per_screen ();
mate_panel_applet_load_queued_applets (TRUE);
}
static gboolean
-get_program_listing_setting (const char *setting)
+get_program_listing_setting (const char *key)
{
- MateConfClient *client;
- const char *key;
- gboolean retval;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_general_key (setting);
- retval = mateconf_client_get_bool (client, key, NULL);
-
+ gboolean retval;
+ retval = g_settings_get_boolean (profile_settings, key);
return retval;
}
gboolean
panel_profile_get_show_program_list (void)
{
- return get_program_listing_setting ("show_program_list");
+ return get_program_listing_setting ("show-program-list");
}
gboolean
panel_profile_get_enable_program_list (void)
{
- return get_program_listing_setting ("enable_program_list");
+ return get_program_listing_setting ("enable-program-list");
}
gboolean
panel_profile_get_enable_autocompletion (void)
{
- return get_program_listing_setting ("enable_autocompletion");
+ return get_program_listing_setting ("enable-autocompletion");
}
void
panel_profile_set_show_program_list (gboolean show_program_list)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_general_key ("show_program_list");
- mateconf_client_set_bool (client, key, show_program_list, NULL);
+ g_settings_set_boolean (profile_settings, "show-program-list", show_program_list);
}
gboolean
panel_profile_is_writable_show_program_list (void)
{
- MateConfClient *client;
- const char *key;
-
- client = panel_mateconf_get_client ();
-
- key = panel_mateconf_general_key ("show_program_list");
- return mateconf_client_key_is_writable (client, key, NULL);
+ return g_settings_is_writable (profile_settings, "show-program-list");
}
gboolean
panel_profile_can_be_moved_freely (PanelToplevel *toplevel)
{
- const char *key;
- MateConfClient *client;
-
if (panel_lockdown_get_locked_down () ||
- !panel_profile_is_writable_toplevel_orientation (toplevel))
+ !g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_ORIENTATION_KEY))
return FALSE;
- client = panel_mateconf_get_client ();
-
- key = panel_profile_get_toplevel_key (toplevel, "screen");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_SCREEN_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "monitor");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_MONITOR_KEY))
return FALSE;
/* For expanded panels we don't really have to check
@@ -2625,24 +1695,18 @@ panel_profile_can_be_moved_freely (PanelToplevel *toplevel)
if (panel_toplevel_get_expand (toplevel))
return TRUE;
- key = panel_profile_get_toplevel_key (toplevel, "x");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_X_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "x_right");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_X_RIGHT_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "x_centered");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_X_CENTERED_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "y");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_Y_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "y_bottom");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_Y_BOTTOM_KEY))
return FALSE;
- key = panel_profile_get_toplevel_key (toplevel, "y_centered");
- if (!mateconf_client_key_is_writable (client, key, NULL))
+ if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_Y_CENTERED_KEY))
return FALSE;
return TRUE;
diff --git a/mate-panel/panel-profile.h b/mate-panel/panel-profile.h
index 4191ef67..bd16f615 100644
--- a/mate-panel/panel-profile.h
+++ b/mate-panel/panel-profile.h
@@ -27,22 +27,20 @@
#include <glib.h>
#include <gdk/gdk.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "panel-toplevel.h"
#include "panel-enums.h"
#include "panel-types.h"
#include "applet.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
void panel_profile_load (void);
const char *panel_profile_get_toplevel_id (PanelToplevel *toplevel);
PanelToplevel *panel_profile_get_toplevel_by_id (const char *toplevel_id);
-char *panel_profile_find_new_id (PanelMateConfKeyType type);
+char *panel_profile_find_new_id (PanelGSettingsKeyType type);
gboolean panel_profile_get_show_program_list (void);
@@ -52,16 +50,13 @@ gboolean panel_profile_get_enable_program_list (void);
gboolean panel_profile_get_enable_autocompletion (void);
-void panel_profile_add_to_list (PanelMateConfKeyType type,
+void panel_profile_add_to_list (PanelGSettingsKeyType type,
const char *id);
-void panel_profile_remove_from_list (PanelMateConfKeyType type,
+void panel_profile_remove_from_list (PanelGSettingsKeyType type,
const char *id);
gboolean panel_profile_id_lists_are_writable (void);
void panel_profile_create_toplevel (GdkScreen *screen);
-PanelToplevel *panel_profile_load_toplevel (MateConfClient *client,
- const char *profile_dir,
- PanelMateConfKeyType type,
- const char *toplevel_id);
+PanelToplevel *panel_profile_load_toplevel (char *toplevel_id);
void panel_profile_delete_toplevel (PanelToplevel *toplevel);
char *panel_profile_prepare_object (PanelObjectType object_type,
PanelToplevel *toplevel,
@@ -73,55 +68,50 @@ char *panel_profile_prepare_object_with_id (PanelObjectType object_t
gboolean right_stick);
void panel_profile_delete_object (AppletInfo *applet_info);
+gboolean panel_profile_key_is_writable (PanelToplevel *toplevel,
+ gchar *key);
+gboolean panel_profile_background_key_is_writable (PanelToplevel *toplevel,
+ gchar *key);
void panel_profile_set_toplevel_name (PanelToplevel *toplevel,
const char *name);
char *panel_profile_get_toplevel_name (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_name (PanelToplevel *toplevel);
void panel_profile_set_toplevel_orientation (PanelToplevel *toplevel,
PanelOrientation orientation);
PanelOrientation
panel_profile_get_toplevel_orientation (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_orientation (PanelToplevel *toplevel);
void panel_profile_set_toplevel_size (PanelToplevel *toplevel,
int size);
int panel_profile_get_toplevel_size (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_size (PanelToplevel *toplevel);
void panel_profile_set_toplevel_expand (PanelToplevel *toplevel,
gboolean expand);
gboolean panel_profile_get_toplevel_expand (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_expand (PanelToplevel *toplevel);
void panel_profile_set_toplevel_auto_hide (PanelToplevel *toplevel,
gboolean auto_hide);
gboolean panel_profile_get_toplevel_auto_hide (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_auto_hide (PanelToplevel *toplevel);
void panel_profile_set_toplevel_enable_buttons (PanelToplevel *toplevel,
gboolean enable_buttons);
gboolean panel_profile_get_toplevel_enable_buttons (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_enable_buttons (PanelToplevel *toplevel);
void panel_profile_set_toplevel_enable_arrows (PanelToplevel *toplevel,
gboolean enable_arrows);
gboolean panel_profile_get_toplevel_enable_arrows (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_toplevel_enable_arrows (PanelToplevel *toplevel);
/* We don't set this in the panel, so there is no set accessor */
void panel_profile_set_background_type (PanelToplevel *toplevel,
PanelBackgroundType background_type);
PanelBackgroundType
panel_profile_get_background_type (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_type (PanelToplevel *toplevel);
void panel_profile_set_background_color (PanelToplevel *toplevel,
PanelColor *color);
void panel_profile_get_background_color (PanelToplevel *toplevel,
PanelColor *color);
-gboolean panel_profile_is_writable_background_color (PanelToplevel *toplevel);
void panel_profile_set_background_gdk_color (PanelToplevel *toplevel,
GdkColor *gdk_color);
@@ -131,58 +121,38 @@ void panel_profile_get_background_gdk_color (PanelToplevel *topl
void panel_profile_set_background_opacity (PanelToplevel *toplevel,
guint16 opacity);
guint16 panel_profile_get_background_opacity (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_opacity (PanelToplevel *toplevel);
void panel_profile_set_background_image (PanelToplevel *toplevel,
const char *image);
char *panel_profile_get_background_image (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_image (PanelToplevel *toplevel);
void panel_profile_set_background_fit (PanelToplevel *toplevel,
gboolean fit);
gboolean panel_profile_get_background_fit (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_fit (PanelToplevel *toplevel);
void panel_profile_set_background_stretch (PanelToplevel *toplevel,
gboolean stretch);
gboolean panel_profile_get_background_stretch (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_stretch (PanelToplevel *toplevel);
void panel_profile_set_background_rotate (PanelToplevel *toplevel,
gboolean rotate);
gboolean panel_profile_get_background_rotate (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_background_rotate (PanelToplevel *toplevel);
void panel_profile_set_attached_custom_icon (PanelToplevel *toplevel,
const char *custom_icon);
char *panel_profile_get_attached_custom_icon (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_attached_custom_icon (PanelToplevel *toplevel);
+gboolean panel_profile_is_writable_attached_custom_icon (PanelToplevel *toplevel);
+
void panel_profile_set_attached_tooltip (PanelToplevel *toplevel,
const char *custom_icon);
char *panel_profile_get_attached_tooltip (PanelToplevel *toplevel);
-gboolean panel_profile_is_writable_attached_tooltip (PanelToplevel *toplevel);
-
-guint panel_profile_toplevel_notify_add (PanelToplevel *toplevel,
- const char *key,
- MateConfClientNotifyFunc func,
- gpointer data);
-
-const char *panel_profile_map_orientation (PanelOrientation orientation);
-const char *panel_profile_map_background_type (PanelBackgroundType background_type);
-gboolean panel_profile_map_orientation_string (const char *str,
- PanelOrientation *orientation);
-gboolean panel_profile_map_speed_string (const char *str,
- PanelAnimationSpeed *speed);
-gboolean panel_profile_map_background_type_string (const char *str,
- PanelBackgroundType *background_type);
-gboolean panel_profile_map_object_type_string (const char *str,
- PanelObjectType *object_type);
+gboolean panel_profile_is_writable_attached_tooltip (PanelToplevel *toplevel);
/* all keys relevant to moving are writable */
gboolean panel_profile_can_be_moved_freely (PanelToplevel *toplevel);
-#ifdef __cplusplus
-}
-#endif
+GSettings* panel_profile_get_attached_object_settings (PanelToplevel *toplevel);
+
+G_END_DECLS
#endif /* __PANEL_PROFILE_H__ */
diff --git a/mate-panel/panel-properties-dialog.c b/mate-panel/panel-properties-dialog.c
index 0a5df0a1..8247f04a 100644
--- a/mate-panel/panel-properties-dialog.c
+++ b/mate-panel/panel-properties-dialog.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <libpanel-util/panel-error.h>
#include <libpanel-util/panel-glib.h>
@@ -37,13 +38,15 @@
#include "nothing.h"
#include "panel-profile.h"
-#include "panel-mateconf.h"
+#include "panel-schemas.h"
#include "panel-util.h"
#include "panel-globals.h"
#include "panel-icon-names.h"
typedef struct {
PanelToplevel *toplevel;
+ GSettings *settings;
+ GSettings *background_settings;
GtkWidget *properties_dialog;
@@ -77,9 +80,6 @@ typedef struct {
GtkWidget *writability_warn_general;
GtkWidget *writability_warn_background;
- guint toplevel_notify;
- guint background_notify;
-
/* FIXME: This is a workaround for GTK+ bug #327243 */
int selection_emitted;
} PanelPropertiesDialog;
@@ -89,17 +89,13 @@ static GQuark panel_properties_dialog_quark = 0;
static void
panel_properties_dialog_free (PanelPropertiesDialog *dialog)
{
- MateConfClient *client;
-
- client = panel_mateconf_get_client ();
-
- if (dialog->toplevel_notify)
- mateconf_client_notify_remove (client, dialog->toplevel_notify);
- dialog->toplevel_notify = 0;
+ if (dialog->settings)
+ g_object_unref (dialog->settings);
+ dialog->settings = NULL;
- if (dialog->background_notify)
- mateconf_client_notify_remove (client, dialog->background_notify);
- dialog->background_notify = 0;
+ if (dialog->background_settings)
+ g_object_unref (dialog->background_settings);
+ dialog->background_settings = NULL;
if (dialog->properties_dialog)
gtk_widget_destroy (dialog->properties_dialog);
@@ -193,7 +189,7 @@ panel_properties_dialog_setup_orientation_combo (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_orientation_changed),
dialog);
- if (! panel_profile_is_writable_toplevel_orientation (dialog->toplevel)) {
+ if (! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ORIENTATION_KEY)) {
gtk_widget_set_sensitive (dialog->orientation_combo, FALSE);
gtk_widget_set_sensitive (dialog->orientation_label, FALSE);
gtk_widget_show (dialog->writability_warn_general);
@@ -232,7 +228,7 @@ panel_properties_dialog_setup_size_spin (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_size_changed),
dialog);
- if ( ! panel_profile_is_writable_toplevel_size (dialog->toplevel)) {
+ if ( ! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_SIZE_KEY)) {
gtk_widget_set_sensitive (dialog->size_spin, FALSE);
gtk_widget_set_sensitive (dialog->size_label, FALSE);
gtk_widget_set_sensitive (dialog->size_label_pixels, FALSE);
@@ -278,13 +274,14 @@ panel_properties_dialog_setup_icon_chooser (PanelPropertiesDialog *dialog,
if (!panel_profile_is_writable_attached_custom_icon (dialog->toplevel)) {
gtk_widget_set_sensitive (dialog->icon_chooser, FALSE);
gtk_widget_set_sensitive (dialog->icon_label, FALSE);
- gtk_widget_show (dialog->writability_warn_general);
+ if (panel_toplevel_get_is_attached (dialog->toplevel))
+ gtk_widget_show (dialog->writability_warn_general);
}
}
/* Note: this is only for toggle buttons on the general page, if needed for togglebuttons
elsewhere you must make this respect the writability warning thing for the right page */
-#define SETUP_TOGGLE_BUTTON(wid, n, p) \
+#define SETUP_TOGGLE_BUTTON(wid, n, p, key) \
static void \
panel_properties_dialog_##n (PanelPropertiesDialog *dialog, \
GtkToggleButton *n) \
@@ -301,16 +298,16 @@ panel_properties_dialog_setup_icon_chooser (PanelPropertiesDialog *dialog,
panel_profile_get_toplevel_##p (dialog->toplevel)); \
g_signal_connect_swapped (dialog->n, "toggled", \
G_CALLBACK (panel_properties_dialog_##n), dialog); \
- if ( ! panel_profile_is_writable_toplevel_##p (dialog->toplevel)) { \
+ if ( ! panel_profile_key_is_writable (dialog->toplevel, key)) { \
gtk_widget_set_sensitive (dialog->n, FALSE); \
gtk_widget_show (dialog->writability_warn_general); \
} \
}
-SETUP_TOGGLE_BUTTON ("expand_toggle", expand_toggle, expand)
-SETUP_TOGGLE_BUTTON ("autohide_toggle", autohide_toggle, auto_hide)
-SETUP_TOGGLE_BUTTON ("hidebuttons_toggle", hidebuttons_toggle, enable_buttons)
-SETUP_TOGGLE_BUTTON ("arrows_toggle", arrows_toggle, enable_arrows)
+SETUP_TOGGLE_BUTTON ("expand_toggle", expand_toggle, expand, PANEL_TOPLEVEL_EXPAND_KEY)
+SETUP_TOGGLE_BUTTON ("autohide_toggle", autohide_toggle, auto_hide, PANEL_TOPLEVEL_AUTO_HIDE_KEY)
+SETUP_TOGGLE_BUTTON ("hidebuttons_toggle", hidebuttons_toggle, enable_buttons, PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY)
+SETUP_TOGGLE_BUTTON ("arrows_toggle", arrows_toggle, enable_arrows, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY)
static void
panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog,
@@ -344,7 +341,7 @@ panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_color_changed),
dialog);
- if ( ! panel_profile_is_writable_background_color (dialog->toplevel)) {
+ if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "color")) {
gtk_widget_set_sensitive (dialog->color_button, FALSE);
gtk_widget_set_sensitive (dialog->color_label, FALSE);
gtk_widget_show (dialog->writability_warn_background);
@@ -394,7 +391,7 @@ panel_properties_dialog_setup_image_chooser (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_image_changed),
dialog);
- if ( ! panel_profile_is_writable_background_image (dialog->toplevel)) {
+ if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "image")) {
gtk_widget_set_sensitive (dialog->image_chooser, FALSE);
gtk_widget_show (dialog->writability_warn_background);
}
@@ -442,7 +439,7 @@ panel_properties_dialog_setup_opacity_scale (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_opacity_changed),
dialog);
- if ( ! panel_profile_is_writable_background_opacity (dialog->toplevel)) {
+ if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "opacity")) {
gtk_widget_set_sensitive (dialog->opacity_scale, FALSE);
gtk_widget_set_sensitive (dialog->opacity_label, FALSE);
gtk_widget_set_sensitive (dialog->opacity_legend, FALSE);
@@ -526,7 +523,7 @@ panel_properties_dialog_setup_background_radios (PanelPropertiesDialog *dialog,
G_CALLBACK (panel_properties_dialog_background_toggled),
dialog);
- if ( ! panel_profile_is_writable_background_type (dialog->toplevel)) {
+ if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "type")) {
gtk_widget_set_sensitive (dialog->default_radio, FALSE);
gtk_widget_set_sensitive (dialog->color_radio, FALSE);
gtk_widget_set_sensitive (dialog->image_radio, FALSE);
@@ -540,7 +537,7 @@ panel_properties_update_arrows_toggle_visible (PanelPropertiesDialog *dialog,
{
if (gtk_toggle_button_get_active (toggle))
gtk_widget_set_sensitive (dialog->arrows_toggle,
- panel_profile_is_writable_toplevel_enable_arrows (dialog->toplevel));
+ panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY));
else
gtk_widget_set_sensitive (dialog->arrows_toggle, FALSE);
}
@@ -581,9 +578,8 @@ panel_properties_dialog_destroy (PanelPropertiesDialog *dialog)
static void
panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ PanelOrientation orientation)
{
- PanelOrientation orientation;
GtkTreeModel *model;
GtkTreeIter iter;
OrientationComboItem *item;
@@ -591,12 +587,6 @@ panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog,
int spin_size;
int profile_size;
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- if (!panel_profile_map_orientation_string (mateconf_value_get_string (value), &orientation))
- return;
-
/* change the maximum size of the panel */
//TODO: we should also do this when the monitor size changes
max_size = panel_toplevel_get_maximum_size (dialog->toplevel);
@@ -632,63 +622,40 @@ panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog,
static void
panel_properties_dialog_update_size (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ int size)
{
- if (!value || value->type != MATECONF_VALUE_INT)
- return;
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin),
- mateconf_value_get_int (value));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spin), size);
}
static void
-panel_properties_dialog_toplevel_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_properties_dialog_toplevel_notify (GSettings *settings,
+ gchar *key,
PanelPropertiesDialog *dialog)
{
- MateConfValue *value;
- const char *key;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
- if (!key)
- return;
-
- value = mateconf_entry_get_value (entry);
-#define UPDATE_TOGGLE(p, n) \
- if (!strcmp (key, p)) { \
- if (value && value->type == MATECONF_VALUE_BOOL) { \
- gboolean val = mateconf_value_get_bool (value); \
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->n)) != val) \
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->n), val); \
- } \
+#define UPDATE_TOGGLE(p, n) \
+ if (!strcmp (key, p)) { \
+ gboolean val = g_settings_get_boolean (settings, key); \
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->n)) != val) \
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->n), val); \
}
if (!strcmp (key, "orientation"))
- panel_properties_dialog_update_orientation (dialog, value);
+ panel_properties_dialog_update_orientation (dialog, g_settings_get_enum (settings, key));
else if (!strcmp (key, "size"))
- panel_properties_dialog_update_size (dialog, value);
+ panel_properties_dialog_update_size (dialog, g_settings_get_int (settings, key));
else UPDATE_TOGGLE ("expand", expand_toggle)
- else UPDATE_TOGGLE ("auto_hide", autohide_toggle)
- else UPDATE_TOGGLE ("enable_buttons", hidebuttons_toggle)
- else UPDATE_TOGGLE ("enable_arrows", arrows_toggle)
+ else UPDATE_TOGGLE ("auto-hide", autohide_toggle)
+ else UPDATE_TOGGLE ("enable-buttons", hidebuttons_toggle)
+ else UPDATE_TOGGLE ("enable-arrows", arrows_toggle)
}
static void
panel_properties_dialog_update_background_type (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ PanelBackgroundType background_type)
{
- PanelBackgroundType background_type;
GtkWidget *active_radio;
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- if (!panel_profile_map_background_type_string (mateconf_value_get_string (value),
- &background_type))
- return;
-
switch (background_type) {
case PANEL_BACK_NONE:
active_radio = dialog->default_radio;
@@ -710,15 +677,12 @@ panel_properties_dialog_update_background_type (PanelPropertiesDialog *dialog,
static void
panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ gchar *str_color)
{
GdkColor new_color = { 0, };
GdkColor old_color;
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- if (!gdk_color_parse (mateconf_value_get_string (value), &new_color))
+ if (!gdk_color_parse (str_color, &new_color))
return;
gtk_color_button_get_color (GTK_COLOR_BUTTON (dialog->color_button),
@@ -733,14 +697,11 @@ panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog,
static void
panel_properties_dialog_update_background_opacity (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ gint opacity)
{
gdouble percentage;
- if (!value || value->type != MATECONF_VALUE_INT)
- return;
-
- percentage = ((gdouble) (mateconf_value_get_int (value) * 100)) / 65535;
+ percentage = ((gdouble) (opacity * 100)) / 65535;
if ((int) gtk_range_get_value (GTK_RANGE (dialog->opacity_scale)) != (int) percentage)
gtk_range_set_value (GTK_RANGE (dialog->opacity_scale), percentage);
@@ -748,15 +709,10 @@ panel_properties_dialog_update_background_opacity (PanelPropertiesDialog *dialog
static void
panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog,
- MateConfValue *value)
+ gchar *text)
{
- const char *text;
char *old_text;
- if (!value || value->type != MATECONF_VALUE_STRING)
- return;
-
- text = mateconf_value_get_string (value);
old_text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog->image_chooser));
if (PANEL_GLIB_STR_EMPTY (text) && old_text)
@@ -771,28 +727,32 @@ panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog,
}
static void
-panel_properties_dialog_background_notify (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
+panel_properties_dialog_background_notify (GSettings *settings,
+ gchar *key,
PanelPropertiesDialog *dialog)
{
- MateConfValue *value;
- const char *key;
-
- key = panel_mateconf_basename (mateconf_entry_get_key (entry));
- if (!key)
- return;
-
- value = mateconf_entry_get_value (entry);
-
if (!strcmp (key, "type"))
- panel_properties_dialog_update_background_type (dialog, value);
+ {
+ PanelBackgroundType type = g_settings_get_enum (settings, key);
+ panel_properties_dialog_update_background_type (dialog, type);
+ }
else if (!strcmp (key, "color"))
- panel_properties_dialog_update_background_color (dialog, value);
+ {
+ char *color = g_settings_get_string (settings, key);
+ panel_properties_dialog_update_background_color (dialog, color);
+ g_free (color);
+ }
else if (!strcmp (key, "opacity"))
- panel_properties_dialog_update_background_opacity (dialog, value);
+ {
+ gint opacity = g_settings_get_int (settings, key);
+ panel_properties_dialog_update_background_opacity (dialog, opacity);
+ }
else if (!strcmp (key, "image"))
- panel_properties_dialog_update_background_image (dialog, value);
+ {
+ char *image = g_settings_get_string (settings, key);
+ panel_properties_dialog_update_background_image (dialog, image);
+ g_free (image);
+ }
}
static void
@@ -874,6 +834,7 @@ panel_properties_dialog_new (PanelToplevel *toplevel,
GtkBuilder *gui)
{
PanelPropertiesDialog *dialog;
+ char *toplevel_settings_path;
dialog = g_new0 (PanelPropertiesDialog, 1);
@@ -913,24 +874,29 @@ panel_properties_dialog_new (PanelToplevel *toplevel,
G_CALLBACK (panel_properties_update_arrows_toggle_visible),
dialog);
- dialog->toplevel_notify =
- panel_profile_toplevel_notify_add (
- dialog->toplevel,
- NULL,
- (MateConfClientNotifyFunc) panel_properties_dialog_toplevel_notify,
- dialog);
+ g_object_get (toplevel, "settings-path", &toplevel_settings_path, NULL);
+ dialog->settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA,
+ toplevel_settings_path);
+ gchar *toplevel_background_path;
+ toplevel_background_path = g_strdup_printf ("%sbackground/", toplevel_settings_path);
+ dialog->background_settings = g_settings_new_with_path (PANEL_TOPLEVEL_BACKGROUND_SCHEMA,
+ toplevel_background_path);
+ g_free (toplevel_background_path);
+
+ g_signal_connect (dialog->settings,
+ "changed",
+ G_CALLBACK (panel_properties_dialog_toplevel_notify),
+ dialog);
panel_properties_dialog_setup_color_button (dialog, gui);
panel_properties_dialog_setup_image_chooser (dialog, gui);
panel_properties_dialog_setup_opacity_scale (dialog, gui);
panel_properties_dialog_setup_background_radios (dialog, gui);
- dialog->background_notify =
- panel_profile_toplevel_notify_add (
- dialog->toplevel,
- "background",
- (MateConfClientNotifyFunc) panel_properties_dialog_background_notify,
- dialog);
+ g_signal_connect (dialog->background_settings,
+ "changed",
+ G_CALLBACK (panel_properties_dialog_background_notify),
+ dialog);
panel_properties_dialog_update_for_attached (dialog,
panel_toplevel_get_is_attached (dialog->toplevel));
diff --git a/mate-panel/panel-reset.c b/mate-panel/panel-reset.c
index 9c53c458..22532da4 100644
--- a/mate-panel/panel-reset.c
+++ b/mate-panel/panel-reset.c
@@ -17,27 +17,26 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Perberos <[email protected]>
+ * Stefano Karapetsas <[email protected]>
*/
#ifndef __PANEL_RESET_C__
#define __PANEL_RESET_C__
#include <stdlib.h>
+#include <glib.h>
#include "panel-reset.h"
+#include "panel-schemas.h"
+#include <libpanel-util/panel-dconf.h>
void panel_reset()
{
- /* En teoria, al hacer `mate-panel --reset` se podria correr este comando
- * para que se reestablesca la configuracion por defecto del panel. O se
- * borre para que pueda elegir una nueva. Esto ultimo solo si se desarrolla
- * el dialogo de seleccion de configuracion inicial.
- *
- * La configuracion no se borra a travez de los archivos, por que hacer esto
- * no hace que el demonio de configuracion se actualice. Obligando que se
- * deba cerrar sesion antes de volver a abrir el panel.
- * Es por eso que se eliminan las entradas a travez de mate-conf.
- */
- system("mateconftool-2 --recursive-unset /apps/panel"); // unix like
+ panel_dconf_recursive_reset (PANEL_GENERAL_PATH, NULL);
+ panel_dconf_recursive_reset (PANEL_TOPLEVEL_PATH, NULL);
+ panel_dconf_recursive_reset (PANEL_OBJECT_PATH, NULL);
/* TODO: send a dbus message to mate-panel, if active, to reload the panel
* configuration */
diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c
index 866751da..23da2a7b 100644
--- a/mate-panel/panel-run-dialog.c
+++ b/mate-panel/panel-run-dialog.c
@@ -40,7 +40,6 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gdk/gdkkeysyms.h>
-#include <mateconf/mateconf-client.h>
#include <matemenu-tree.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
@@ -53,7 +52,6 @@
#include <libpanel-util/panel-show.h>
#include "nothing.h"
-#include "panel-mateconf.h"
#include "panel-util.h"
#include "panel-globals.h"
#include "panel-enums.h"
@@ -93,13 +91,14 @@ typedef struct {
int add_icons_idle_id;
int add_items_idle_id;
int find_command_idle_id;
- int content_notify_id;
gboolean use_program_list;
gboolean completion_started;
char *icon_path;
char *desktop_path;
char *item_name;
+
+ GSettings *settings;
} PanelRunDialog;
enum {
@@ -117,72 +116,67 @@ static PanelRunDialog *static_dialog = NULL;
static void panel_run_dialog_disconnect_pixmap (PanelRunDialog *dialog);
-#define PANEL_RUN_HISTORY_KEY "/apps/mate-settings/mate-panel/history-mate-run"
+#define PANEL_RUN_SCHEMA "org.mate.panel"
+#define PANEL_RUN_HISTORY_KEY "history-mate-run"
+#define PANEL_RUN_SHOW_PROGRAM_LIST_KEY "show-program-list"
#define PANEL_RUN_MAX_HISTORY 10
static GtkTreeModel *
-_panel_run_get_recent_programs_list (void)
+_panel_run_get_recent_programs_list (PanelRunDialog *dialog)
{
GtkListStore *list;
- GSList *mateconf_items;
- GSList *command;
+ gchar **items;
int i = 0;
list = gtk_list_store_new (1, G_TYPE_STRING);
- mateconf_items = mateconf_client_get_list (panel_mateconf_get_client (),
- PANEL_RUN_HISTORY_KEY,
- MATECONF_VALUE_STRING, NULL);
+ items = g_settings_get_strv (dialog->settings, PANEL_RUN_HISTORY_KEY);
- for (command = mateconf_items;
- command && i < PANEL_RUN_MAX_HISTORY;
- command = command->next) {
+ for (i = 0;
+ items[i] && i < PANEL_RUN_MAX_HISTORY;
+ i++) {
GtkTreeIter iter;
gtk_list_store_prepend (list, &iter);
- gtk_list_store_set (list, &iter, 0, command->data, -1);
- i++;
+ gtk_list_store_set (list, &iter, 0, items[i], -1);
}
- g_slist_free (mateconf_items);
+ g_strfreev (items);
return GTK_TREE_MODEL (list);
}
static void
-_panel_run_save_recent_programs_list (GtkComboBoxEntry *entry,
+_panel_run_save_recent_programs_list (PanelRunDialog *dialog,
+ GtkComboBoxEntry *entry,
char *lastcommand)
{
GtkTreeModel *model;
GtkTreeIter iter;
- GSList *mateconf_items = NULL;
- int i = 0;
+ GArray *items;
+ gint i = 0;
- mateconf_items = g_slist_prepend (mateconf_items, lastcommand);
+ items = g_array_new (TRUE, TRUE, sizeof (gchar *));
+ g_array_append_val (items, lastcommand);
i++;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (entry));
if (gtk_tree_model_get_iter_first (model, &iter)) {
char *command;
-
do {
gtk_tree_model_get (model, &iter, 0, &command, -1);
-
- if (strcmp (command, lastcommand) == 0)
+ if (g_strcmp0 (command, lastcommand) == 0)
continue;
-
- mateconf_items = g_slist_prepend (mateconf_items, command);
+ g_array_append_val (items, command);
i++;
} while (gtk_tree_model_iter_next (model, &iter) &&
i < PANEL_RUN_MAX_HISTORY);
}
- mateconf_client_set_list (panel_mateconf_get_client (),
- PANEL_RUN_HISTORY_KEY,
- MATECONF_VALUE_STRING, mateconf_items,
- NULL);
+ g_settings_set_strv (dialog->settings, PANEL_RUN_HISTORY_KEY,
+ (const gchar **) items->data);
- g_slist_free (mateconf_items);
+ g_array_free (items, TRUE);
}
static void
@@ -217,10 +211,9 @@ panel_run_dialog_destroy (PanelRunDialog *dialog)
g_source_remove (dialog->find_command_idle_id);
dialog->find_command_idle_id = 0;
- if (dialog->content_notify_id)
- mateconf_client_notify_remove (panel_mateconf_get_client (),
- dialog->content_notify_id);
- dialog->content_notify_id = 0;
+ if (dialog->settings != NULL)
+ g_object_unref (dialog->settings);
+ dialog->settings = NULL;
if (dialog->dir_hash)
g_hash_table_destroy (dialog->dir_hash);
@@ -479,7 +472,7 @@ panel_run_dialog_execute (PanelRunDialog *dialog)
if (result) {
/* only save working commands in history */
_panel_run_save_recent_programs_list
- (GTK_COMBO_BOX_ENTRY (dialog->combobox), command);
+ (dialog, GTK_COMBO_BOX_ENTRY (dialog->combobox), command);
/* only close the dialog if we successfully showed or launched
* something */
@@ -1181,12 +1174,11 @@ panel_run_dialog_update_content (PanelRunDialog *dialog,
}
static void
-panel_run_dialog_content_notify (MateConfClient *client,
- int notify_id,
- MateConfEntry *entry,
+panel_run_dialog_content_notify (GSettings *settings,
+ gchar *key,
PanelRunDialog *dialog)
{
- panel_run_dialog_update_content (dialog, mateconf_value_get_bool (entry->value));
+ panel_run_dialog_update_content (dialog, g_settings_get_boolean (settings, key));
}
static void
@@ -1201,9 +1193,6 @@ static void
panel_run_dialog_setup_list_expander (PanelRunDialog *dialog,
GtkBuilder *gui)
{
- MateConfClient *client;
- const char *key;
-
dialog->list_expander = PANEL_GTK_BUILDER_GET (gui, "list_expander");
if (panel_profile_get_enable_program_list ()) {
@@ -1217,16 +1206,10 @@ panel_run_dialog_setup_list_expander (PanelRunDialog *dialog,
G_CALLBACK (list_expander_toggled),
dialog);
- client = panel_mateconf_get_client ();
- key = panel_mateconf_general_key ("show_program_list");
-
- dialog->content_notify_id =
- mateconf_client_notify_add (client, key,
- (MateConfClientNotifyFunc) panel_run_dialog_content_notify,
- dialog, NULL, NULL);
-
- if (!dialog->content_notify_id)
- g_warning ("error setting up content change notification");
+ g_signal_connect (dialog->settings,
+ "changed::" PANEL_RUN_SHOW_PROGRAM_LIST_KEY,
+ G_CALLBACK (panel_run_dialog_content_notify),
+ dialog);
}
}
@@ -1748,7 +1731,7 @@ panel_run_dialog_setup_entry (PanelRunDialog *dialog,
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->combobox),
- _panel_run_get_recent_programs_list ());
+ _panel_run_get_recent_programs_list (dialog));
gtk_combo_box_entry_set_text_column
(GTK_COMBO_BOX_ENTRY (dialog->combobox), 0);
@@ -1944,6 +1927,8 @@ panel_run_dialog_new (GdkScreen *screen,
dialog->run_button = PANEL_GTK_BUILDER_GET (gui, "run_button");
dialog->terminal_checkbox = PANEL_GTK_BUILDER_GET (gui, "terminal_checkbox");
+ dialog->settings = g_settings_new (PANEL_RUN_SCHEMA);
+
panel_run_dialog_setup_pixmap (dialog, gui);
panel_run_dialog_setup_entry (dialog, gui);
panel_run_dialog_setup_file_button (dialog, gui);
diff --git a/mate-panel/panel-schemas.h b/mate-panel/panel-schemas.h
new file mode 100644
index 00000000..b57a4063
--- /dev/null
+++ b/mate-panel/panel-schemas.h
@@ -0,0 +1,90 @@
+#ifndef __PANEL_SCHEMAS_H__
+#define __PANEL_SCHEMAS_H__
+
+#define PANEL_RESOURCE_PATH "/org/mate/panel/"
+#define PANEL_GENERAL_PATH "/org/mate/panel/general/"
+
+#define PANEL_TOPLEVEL_PATH "/org/mate/panel/toplevels/"
+#define PANEL_TOPLEVEL_DEFAULT_PREFIX "toplevel"
+#define PANEL_OBJECT_PATH "/org/mate/panel/objects/"
+#define PANEL_OBJECT_DEFAULT_PREFIX "object"
+
+#define PANEL_SCHEMA "org.mate.panel"
+#define PANEL_TOPLEVEL_ID_LIST_KEY "toplevel-id-list"
+#define PANEL_OBJECT_ID_LIST_KEY "object-id-list"
+#define PANEL_LOCKED_DOWN_KEY "locked-down"
+#define PANEL_DISABLE_LOG_OUT_KEY "disable-log-out"
+#define PANEL_DISABLE_FORCE_QUIT_KEY "disable-force-quit"
+#define PANEL_DISABLED_APPLETS_KEY "disabled-applets"
+
+#define PANEL_TOPLEVEL_SCHEMA "org.mate.panel.toplevel"
+#define PANEL_TOPLEVEL_NAME_KEY "name"
+#define PANEL_TOPLEVEL_SCREEN_KEY "screen"
+#define PANEL_TOPLEVEL_MONITOR_KEY "monitor"
+#define PANEL_TOPLEVEL_EXPAND_KEY "expand"
+#define PANEL_TOPLEVEL_ORIENTATION_KEY "orientation"
+#define PANEL_TOPLEVEL_SIZE_KEY "size"
+#define PANEL_TOPLEVEL_X_KEY "x"
+#define PANEL_TOPLEVEL_Y_KEY "y"
+#define PANEL_TOPLEVEL_X_RIGHT_KEY "x-right"
+#define PANEL_TOPLEVEL_Y_BOTTOM_KEY "y-bottom"
+#define PANEL_TOPLEVEL_X_CENTERED_KEY "x-centered"
+#define PANEL_TOPLEVEL_Y_CENTERED_KEY "y-centered"
+#define PANEL_TOPLEVEL_AUTO_HIDE_KEY "auto-hide"
+#define PANEL_TOPLEVEL_ENABLE_ANIMATIONS_KEY "enable-animations"
+#define PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY "enable-buttons"
+#define PANEL_TOPLEVEL_ENABLE_ARROWS_KEY "enable-arrows"
+#define PANEL_TOPLEVEL_HIDE_DELAY_KEY "hide-delay"
+#define PANEL_TOPLEVEL_UNHIDE_DELAY_KEY "unhide-delay"
+#define PANEL_TOPLEVEL_AUTO_HIDE_SIZE_KEY "auto-hide-size"
+#define PANEL_TOPLEVEL_ANIMATION_SPEED_KEY "animation-speed"
+
+#define PANEL_TOPLEVEL_BACKGROUND_SCHEMA "org.mate.panel.toplevel.background"
+#define PANEL_TOPLEVEL_BACKGROUND_SCHEMA_CHILD "background"
+
+#define PANEL_OBJECT_SCHEMA "org.mate.panel.object"
+#define PANEL_OBJECT_TYPE_KEY "object-type"
+#define PANEL_OBJECT_TOPLEVEL_ID_KEY "toplevel-id"
+#define PANEL_OBJECT_POSITION_KEY "position"
+#define PANEL_OBJECT_PANEL_RIGHT_STICK_KEY "panel-right-stick"
+#define PANEL_OBJECT_LOCKED_KEY "locked"
+#define PANEL_OBJECT_APPLET_IID_KEY "applet-iid"
+#define PANEL_OBJECT_ATTACHED_TOPLEVEL_ID_KEY "attached-toplevel-id"
+#define PANEL_OBJECT_TOOLTIP_KEY "tooltip"
+#define PANEL_OBJECT_USE_CUSTOM_ICON_KEY "use-custom-icon"
+#define PANEL_OBJECT_CUSTOM_ICON_KEY "custom-icon"
+#define PANEL_OBJECT_USE_MENU_PATH_KEY "use-menu-path"
+#define PANEL_OBJECT_MENU_PATH_KEY "menu-path"
+#define PANEL_OBJECT_HAS_ARROW_KEY "has-arrow"
+#define PANEL_OBJECT_LAUNCHER_LOCATION_KEY "launcher-location"
+#define PANEL_OBJECT_ACTION_TYPE_KEY "action-type"
+
+/* external schemas */
+
+#define CAJA_DESKTOP_SCHEMA "org.mate.caja.desktop"
+#define CAJA_DESKTOP_HOME_ICON_NAME_KEY "home-icon-name"
+#define CAJA_DESKTOP_COMPUTER_ICON_NAME_KEY "computer-icon-name"
+
+#define CAJA_PREFS_SCHEMA "org.mate.caja.preferences"
+#define CAJA_PREFS_DESKTOP_IS_HOME_DIR_KEY "desktop-is-home-dir"
+
+#define MATE_SESSION_SCHEMA "org.mate.session"
+#define MATE_SESSION_LOGOUT_PROMPT_KEY "logout-prompt"
+
+#define LOCKDOWN_SCHEMA "org.mate.lockdown"
+#define LOCKDOWN_DISABLE_COMMAND_LINE_KEY "disable-command-line"
+#define LOCKDOWN_DISABLE_LOCK_SCREEN_KEY "disable-lock-screen"
+
+#define MARCO_SCHEMA "org.mate.Marco.general"
+#define MARCO_MOUSE_BUTTON_MODIFIER_KEY "mouse-button-modifier"
+
+#define MARCO_KEYBINDINGS_SCHEMA "org.mate.Marco.window-keybindings"
+#define MARCO_ACTIVATE_WINDOW_MENU_KEY "activate-window-menu"
+#define MARCO_TOGGLE_MAXIMIZED_KEY "toggle-maximized"
+#define MARCO_MAXIMIZE_KEY "maximize"
+#define MARCO_UNMAXIMIZE_KEY "unmaximize"
+#define MARCO_TOGGLE_SHADED_KEY "toggle-shaded"
+#define MARCO_BEGIN_MOVE_KEY "begin-move"
+#define MARCO_BEGIN_RESIZE_KEY "begin-resize"
+
+#endif /* __PANEL_SCHEMAS_H__ */
diff --git a/mate-panel/panel-separator.c b/mate-panel/panel-separator.c
index 9a8e7186..b7122c15 100644
--- a/mate-panel/panel-separator.c
+++ b/mate-panel/panel-separator.c
@@ -203,7 +203,7 @@ panel_separator_set_orientation (PanelSeparator *separator,
}
void
-panel_separator_load_from_mateconf (PanelWidget *panel,
+panel_separator_load_from_gsettings (PanelWidget *panel,
gboolean locked,
int position,
const char *id)
@@ -238,7 +238,7 @@ panel_separator_create (PanelToplevel *toplevel,
id = panel_profile_prepare_object (PANEL_OBJECT_SEPARATOR,
toplevel, position, FALSE);
- panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id);
+ panel_profile_add_to_list (PANEL_GSETTINGS_OBJECTS, id);
g_free (id);
}
diff --git a/mate-panel/panel-separator.h b/mate-panel/panel-separator.h
index a7c699b8..8dcd5980 100644
--- a/mate-panel/panel-separator.h
+++ b/mate-panel/panel-separator.h
@@ -56,7 +56,7 @@ struct _PanelSeparatorClass {
GType panel_separator_get_type (void) G_GNUC_CONST;
void panel_separator_create (PanelToplevel *toplevel,
int position);
-void panel_separator_load_from_mateconf (PanelWidget *panel_widget,
+void panel_separator_load_from_gsettings (PanelWidget *panel_widget,
gboolean locked,
gint position,
const char *id);
diff --git a/mate-panel/panel-test-applets.c b/mate-panel/panel-test-applets.c
index f17ad8d1..96d0554d 100644
--- a/mate-panel/panel-test-applets.c
+++ b/mate-panel/panel-test-applets.c
@@ -3,16 +3,19 @@
*
* Authors:
* Mark McLoughlin <[email protected]>
+ * Stefano Karapetsas <[email protected]>
*
* Copyright 2002 Sun Microsystems, Inc.
+ * 2012 Stefano Karapetsas
*/
#include <config.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <mateconf/mateconf.h>
+#include <gio/gio.h>
#include <libpanel-util/panel-cleanup.h>
+#include <libpanel-util/panel-dconf.h>
#include <libmate-panel-applet-private/mate-panel-applet-container.h>
#include <libmate-panel-applet-private/mate-panel-applets-manager-dbus.h>
@@ -23,18 +26,18 @@ G_GNUC_UNUSED void on_execute_button_clicked (GtkButton *button, gpointer dummy)
static GtkWidget *win = NULL;
static GtkWidget *applet_combo = NULL;
-static GtkWidget *prefs_dir_entry = NULL;
+static GtkWidget *prefs_path_entry = NULL;
static GtkWidget *orient_combo = NULL;
static GtkWidget *size_combo = NULL;
static char *cli_iid = NULL;
-static char *cli_prefs_dir = NULL;
+static char *cli_prefs_path = NULL;
static char *cli_size = NULL;
static char *cli_orient = NULL;
static const GOptionEntry options [] = {
{ "iid", 0, 0, G_OPTION_ARG_STRING, &cli_iid, N_("Specify an applet IID to load"), NULL},
- { "prefs-dir", 0, 0, G_OPTION_ARG_STRING, &cli_prefs_dir, N_("Specify a mateconf location in which the applet preferences should be stored"), NULL},
+ { "prefs-path", 0, 0, G_OPTION_ARG_STRING, &cli_prefs_path, N_("Specify a gsettings path in which the applet preferences should be stored"), NULL},
{ "size", 0, 0, G_OPTION_ARG_STRING, &cli_size, N_("Specify the initial size of the applet (xx-small, medium, large etc.)"), NULL},
{ "orient", 0, 0, G_OPTION_ARG_STRING, &cli_orient, N_("Specify the initial orientation of the applet (top, bottom, left or right)"), NULL},
{ NULL}
@@ -136,7 +139,7 @@ applet_activated_cb (GObject *source_object,
static void
load_applet_into_window (const char *title,
- const char *prefs_key,
+ const char *prefs_path,
guint size,
guint orientation)
{
@@ -158,7 +161,7 @@ load_applet_into_window (const char *title,
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&builder, "{sv}",
- "prefs-key", g_variant_new_string (prefs_key));
+ "prefs-path", g_variant_new_string (prefs_path));
g_variant_builder_add (&builder, "{sv}",
"size", g_variant_new_uint32 (size));
g_variant_builder_add (&builder, "{sv}",
@@ -201,7 +204,7 @@ load_applet_from_command_line (void)
g_print ("Loading %s\n", cli_iid);
- load_applet_into_window (cli_iid, cli_prefs_dir, size, orient);
+ load_applet_into_window (cli_iid, cli_prefs_path, size, orient);
}
G_GNUC_UNUSED void
@@ -213,7 +216,7 @@ on_execute_button_clicked (GtkButton *button,
title = get_combo_applet_id (applet_combo);
load_applet_into_window (title,
- gtk_entry_get_text (GTK_ENTRY (prefs_dir_entry)),
+ gtk_entry_get_text (GTK_ENTRY (prefs_path_entry)),
get_combo_value (size_combo),
get_combo_value (orient_combo));
g_free (title);
@@ -261,8 +264,11 @@ setup_options (void)
MatePanelAppletsManager *manager;
GList *applet_list, *l;
int i;
- char *prefs_dir;
- char *unique_key;
+ int j;
+ char *prefs_path = NULL;
+ char *unique_key = NULL;
+ gboolean *unique_key_found = FALSE;
+ gchar **dconf_paths;
GtkListStore *model;
GtkTreeIter iter;
GtkCellRenderer *renderer;
@@ -301,11 +307,27 @@ setup_options (void)
setup_combo (orient_combo, orient_items, "Orientation",
G_N_ELEMENTS (orient_items));
- unique_key = mateconf_unique_key ();
- prefs_dir = g_strdup_printf ("/tmp/%s", unique_key);
- g_free (unique_key);
- gtk_entry_set_text (GTK_ENTRY (prefs_dir_entry), prefs_dir);
- g_free (prefs_dir);
+ for (i = 0; !unique_key_found; i++)
+ {
+ unique_key = g_strdup_printf ("mate-panel-test-applet-%d", i);
+ unique_key_found = TRUE;
+ dconf_paths = panel_dconf_list_subdirs ("/tmp/", TRUE);
+ for (j = 0; dconf_paths[j] != NULL; j++)
+ {
+ if (g_strcmp0(unique_key, dconf_paths[j]) == 0) {
+ unique_key_found = FALSE;
+ break;
+ }
+ }
+ if (dconf_paths)
+ g_strfreev (dconf_paths);
+ }
+
+ prefs_path = g_strdup_printf ("/tmp/%s/", unique_key);
+ if (unique_key)
+ g_free (unique_key);
+ gtk_entry_set_text (GTK_ENTRY (prefs_path_entry), prefs_path);
+ g_free (prefs_path);
}
int
@@ -369,8 +391,8 @@ main (int argc, char **argv)
"toplevel"));
applet_combo = GTK_WIDGET (gtk_builder_get_object (builder,
"applet-combo"));
- prefs_dir_entry = GTK_WIDGET (gtk_builder_get_object (builder,
- "prefs-dir-entry"));
+ prefs_path_entry = GTK_WIDGET (gtk_builder_get_object (builder,
+ "prefs-path-entry"));
orient_combo = GTK_WIDGET (gtk_builder_get_object (builder,
"orient-combo"));
size_combo = GTK_WIDGET (gtk_builder_get_object (builder,
diff --git a/mate-panel/panel-test-applets.ui b/mate-panel/panel-test-applets.ui
index 05916cf5..a5a092c8 100644
--- a/mate-panel/panel-test-applets.ui
+++ b/mate-panel/panel-test-applets.ui
@@ -72,10 +72,10 @@
<object class="GtkLabel" id="prefs-label">
<property name="visible">True</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">_Prefs Dir:</property>
+ <property name="label" translatable="yes">_Prefs Path:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
- <property name="mnemonic_widget">prefs-dir-entry</property>
+ <property name="mnemonic_widget">prefs-path-entry</property>
</object>
<packing>
<property name="top_attach">2</property>
@@ -85,7 +85,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="prefs-dir-entry">
+ <object class="GtkEntry" id="prefs-path-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c
index 043e2e26..ed396980 100644
--- a/mate-panel/panel-toplevel.c
+++ b/mate-panel/panel-toplevel.c
@@ -47,6 +47,7 @@
#include "panel-struts.h"
#include "panel-config-global.h"
#include "panel-lockdown.h"
+#include "panel-schemas.h"
G_DEFINE_TYPE (PanelToplevel, panel_toplevel, GTK_TYPE_WINDOW)
@@ -76,6 +77,8 @@ typedef enum {
} PanelGrabOpType;
struct _PanelToplevelPrivate {
+ gchar *settings_path;
+
gboolean expand;
PanelOrientation orientation;
int size;
@@ -212,6 +215,7 @@ enum {
enum {
PROP_0,
PROP_NAME,
+ PROP_SETTINGS_PATH,
PROP_EXPAND,
PROP_ORIENTATION,
PROP_SIZE,
@@ -454,7 +458,7 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp
op_type == PANEL_GRAB_OP_RESIZE_DOWN ||
op_type == PANEL_GRAB_OP_RESIZE_LEFT ||
op_type == PANEL_GRAB_OP_RESIZE_RIGHT) &&
- ! panel_profile_is_writable_toplevel_size (toplevel))
+ ! panel_profile_key_is_writable (toplevel, PANEL_TOPLEVEL_SIZE_KEY))
return;
if (toplevel->priv->attached && op_type == PANEL_GRAB_OP_MOVE) {
@@ -3819,6 +3823,9 @@ panel_toplevel_set_property (GObject *object,
case PROP_NAME:
panel_toplevel_set_name (toplevel, g_value_get_string (value));
break;
+ case PROP_SETTINGS_PATH:
+ panel_toplevel_set_settings_path (toplevel, g_value_get_string (value));
+ break;
case PROP_EXPAND:
panel_toplevel_set_expand (toplevel, g_value_get_boolean (value));
break;
@@ -3913,6 +3920,9 @@ panel_toplevel_get_property (GObject *object,
case PROP_NAME:
g_value_set_string (value, panel_toplevel_get_name (toplevel));
break;
+ case PROP_SETTINGS_PATH:
+ g_value_set_string (value, toplevel->priv->settings_path);
+ break;
case PROP_EXPAND:
g_value_set_boolean (value, toplevel->priv->expand);
break;
@@ -3982,6 +3992,21 @@ panel_toplevel_finalize (GObject *object)
toplevel_list = g_slist_remove (toplevel_list, toplevel);
+ if (toplevel->priv->settings_path) {
+ g_free (toplevel->priv->settings_path);
+ toplevel->priv->settings_path = NULL;
+ }
+
+ if (toplevel->settings) {
+ g_object_unref (toplevel->settings);
+ toplevel->settings = NULL;
+ }
+
+ if (toplevel->background_settings) {
+ g_object_unref (toplevel->background_settings);
+ toplevel->background_settings = NULL;
+ }
+
if (toplevel->priv->gtk_settings) {
g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings,
G_CALLBACK (panel_toplevel_drag_threshold_changed),
@@ -4068,6 +4093,16 @@ panel_toplevel_class_init (PanelToplevelClass *klass)
g_object_class_install_property (
gobject_class,
+ PROP_SETTINGS_PATH,
+ g_param_spec_string (
+ "settings-path",
+ "GSettings path",
+ "The GSettings path used for this panel",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ gobject_class,
PROP_EXPAND,
g_param_spec_boolean (
"expand",
@@ -4598,6 +4633,13 @@ panel_toplevel_set_name (PanelToplevel *toplevel,
g_object_notify (G_OBJECT (toplevel), "name");
}
+void
+panel_toplevel_set_settings_path (PanelToplevel *toplevel,
+ const char *settings_path)
+{
+ toplevel->priv->settings_path = g_strdup (settings_path);
+}
+
const char* panel_toplevel_get_name(PanelToplevel* toplevel)
{
g_return_val_if_fail(PANEL_IS_TOPLEVEL(toplevel), NULL);
diff --git a/mate-panel/panel-toplevel.h b/mate-panel/panel-toplevel.h
index 2c08a4aa..78be8393 100644
--- a/mate-panel/panel-toplevel.h
+++ b/mate-panel/panel-toplevel.h
@@ -53,6 +53,9 @@ typedef struct _PanelToplevelPrivate PanelToplevelPrivate;
struct _PanelToplevel {
GtkWindow window_instance;
+ GSettings *settings;
+ GSettings *queued_settings;
+ GSettings *background_settings;
PanelToplevelPrivate *priv;
};
@@ -81,6 +84,8 @@ PanelWidget *panel_toplevel_get_panel_widget (PanelToplevel
void panel_toplevel_set_name (PanelToplevel *toplevel,
const char *name);
const char* panel_toplevel_get_name(PanelToplevel* toplevel);
+void panel_toplevel_set_settings_path (PanelToplevel *toplevel,
+ const char *settings_path);
const char* panel_toplevel_get_description(PanelToplevel* toplevel);
void panel_toplevel_set_expand (PanelToplevel *toplevel,
gboolean expand);
diff --git a/mate-panel/panel-toplevel.schemas.in b/mate-panel/panel-toplevel.schemas.in
deleted file mode 100644
index 90d3ca3f..00000000
--- a/mate-panel/panel-toplevel.schemas.in
+++ /dev/null
@@ -1,434 +0,0 @@
-<?xml version="1.0"?>
-<mateconfschemafile>
-
- <schemalist>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/name</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Name to identify panel</short>
- <long>
- This is a human readable name which you can use to identify
- a panel. Its main purpose is to serve as the panel's window
- title which is useful when navigating between panels.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/screen</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>X screen where the panel is displayed</short>
- <long>
- With a multi-screen setup, you may have panels on each
- individual screen. This key identifies the current screen
- the panel is displayed on.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/monitor</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>Xinerama monitor where the panel is displayed</short>
- <long>
- In a Xinerama setup, you may have panels on each individual
- monitor. This key identifies the current monitor the panel
- is displayed on.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/expand</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Expand to occupy entire screen width</short>
- <long>
- If true, the panel will occupy the entire screen width
- (height if this is a vertical panel). In this mode the panel
- can only be placed at a screen edge. If false, the panel
- will only be large enough to accommodate the applets,
- launchers and buttons on the panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/orientation</key>
- <owner>panel</owner>
- <type>string</type>
- <default>top</default>
- <locale name="C">
- <short>Panel orientation</short>
- <long>
- The orientation of the panel. Possible values are "top",
- "bottom", "left", "right". In expanded mode the key
- specifies which screen edge the panel is on. In un-expanded
- mode the difference between "top" and "bottom" is less
- important - both indicate that this is a horizontal panel -
- but still give a useful hint as to how some panel objects
- should behave. For example, on a "top" panel a menu button
- will pop up its menu below the panel, whereas on a "bottom"
- panel the menu will be popped up above the panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/size</key>
- <owner>panel</owner>
- <type>int</type>
- <default>24</default>
- <locale name="C">
- <short>Panel size</short>
- <long>
- The height (width for a vertical panel) of the panel. The
- panel will determine at runtime a minimum size based on
- the font size and other indicators. The maximum size is
- fixed at one quarter of the screen height (or width).
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/x</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>X co-ordinate of panel</short>
- <long>
- The location of the panel along the x-axis. This key is
- only relevant in un-expanded mode. In expanded mode this
- key is ignored and the panel is placed at the screen edge
- specified by the orientation key.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/y</key>
- <owner>panel</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>Y co-ordinate of panel</short>
- <long>
- The location of the panel along the y-axis. This key is
- only relevant in un-expanded mode. In expanded mode this
- key is ignored and the panel is placed at the screen edge
- specified by the orientation key.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/x_right</key>
- <owner>panel</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>X co-ordinate of panel, starting from the right of the screen</short>
- <long>
- The location of the panel along the x-axis, starting from the right of
- the screen. If set to -1, the value is ignored and the value of the x
- key is used. If the value is greater than 0, then the value of the x
- key is ignored.
- This key is only relevant in un-expanded mode. In expanded mode this
- key is ignored and the panel is placed at the screen edge
- specified by the orientation key.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/y_bottom</key>
- <owner>panel</owner>
- <type>int</type>
- <default>-1</default>
- <locale name="C">
- <short>Y co-ordinate of panel, starting from the bottom of the screen</short>
- <long>
- The location of the panel along the y-axis, starting from the bottom of
- the screen. If set to -1, the value is ignored and the value of the y
- key is used. If the value is greater than 0, then the value of the y
- key is ignored.
- This key is only relevant in un-expanded mode. In expanded mode this
- key is ignored and the panel is placed at the screen edge
- specified by the orientation key.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/x_centered</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Center panel on x-axis</short>
- <long>
- If true, the x and x_right keys are ignored and the panel is placed at
- the center of the x-axis of the screen. If the panel is
- resized it will remain at that position - i.e. the panel
- will grow on both sides. If false, the x and x_right keys specify
- the location of the panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/y_centered</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Center panel on y-axis</short>
- <long>
- If true, the y and y_bottom keys are ignored and the panel is placed at
- the center of the y-axis of the screen. If the panel is
- resized it will remain at that position - i.e. the panel
- will grow on both sides. If false, the y and y_bottom keys specify
- the location of the panel.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/auto_hide</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Automatically hide panel into corner</short>
- <long>
- If true, the panel is automatically hidden into a corner
- of the screen when the pointer leaves the panel area. Moving the
- pointer to that corner again will cause the panel to re-appear.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/enable_animations</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable animations</short>
- <long>
- If true, hiding and un-hiding of this panel will be animated
- rather than happening instantly.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/enable_buttons</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable hide buttons</short>
- <long>
- If true, buttons will be placed on each side of the panel
- which may be used to move the panel to edge of the screen,
- leaving only a button showing.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/enable_arrows</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable arrows on hide buttons</short>
- <long>
- If true, arrows will be placed on the hide buttons. This
- key is only relevant if the enable_buttons key is true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/hide_delay</key>
- <owner>panel</owner>
- <type>int</type>
- <default>300</default>
- <locale name="C">
- <short>Panel autohide delay</short>
- <long>
- Specifies the number of milliseconds delay after the pointer
- leaves the panel area before the panel is automatically hidden.
- This key is only relevant if the auto_hide key is true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/unhide_delay</key>
- <owner>panel</owner>
- <type>int</type>
- <default>100</default>
- <locale name="C">
- <short>Panel autounhide delay</short>
- <long>
- Specifies the number of milliseconds delay after the pointer
- enters the panel area before the panel is automatically
- re-shown. This key is only relevant if the auto_hide key is
- true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/auto_hide_size</key>
- <owner>panel</owner>
- <type>int</type>
- <default>1</default>
- <locale name="C">
- <short>Visible pixels when hidden</short>
- <long>
- Specifies the number of pixels visible when the panel is
- automatically hidden into a corner. This key is only
- relevant if the auto_hide key is true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/animation_speed</key>
- <owner>panel</owner>
- <type>string</type>
- <default>fast</default>
- <locale name="C">
- <short>Animation speed</short>
- <long>
- The speed in which panel animations should occur. Possible
- values are "slow", "medium" and "fast". This key is only
- relevant if the enable_animations key is true.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/type</key>
- <owner>panel</owner>
- <type>string</type>
- <default>gtk</default>
- <locale name="C">
- <short>Background type</short>
- <long>
- Which type of background should be used for this panel.
- Possible values are "gtk" - the default GTK+ widget
- background will be used, "color" - the color key will
- be used as background color or "image" - the image
- specified by the image key will be used as background.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/color</key>
- <owner>panel</owner>
- <type>string</type>
- <default>#ffffff</default>
- <locale name="C">
- <short>Background color</short>
- <long>
- Specifies the background color for the panel in #RGB
- format.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/opacity</key>
- <owner>panel</owner>
- <type>int</type>
- <default>6000</default>
- <locale name="C">
- <short>Background color opacity</short>
- <long>
- Specifies the opacity of the background color format. If the
- color is not completely opaque (a value of less than 65535),
- the color will be composited onto the desktop background
- image.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/image</key>
- <owner>panel</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Background image</short>
- <long>
- Specifies the file to be used for the background image. If
- the image contains an alpha channel it will be composited
- onto the desktop background image.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/fit</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Fit image to panel</short>
- <long>
- If true, the image will be scaled (retaining the aspect
- ratio of the image) to the panel height (if horizontal).
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/stretch</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Stretch image to panel</short>
- <long>
- If true, the image will be scaled to the panel dimensions.
- The aspect ratio of the image will not be maintained.
- </long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/panel/toplevels/background/rotate</key>
- <owner>panel</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Rotate image on vertical panels</short>
- <long>
- If true, the background image will be rotated when the panel
- is oriented vertically.
- </long>
- </locale>
- </schema>
-
- </schemalist>
-
-</mateconfschemafile>
diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c
index f8713611..4f081a4b 100644
--- a/mate-panel/panel-util.c
+++ b/mate-panel/panel-util.c
@@ -38,7 +38,7 @@
#include "nothing.h"
#include "xstuff.h"
#include "panel-config-global.h"
-#include "panel-mateconf.h"
+#include "panel-schemas.h"
#include "panel-globals.h"
#include "launcher.h"
#include "panel-icon-names.h"
@@ -822,7 +822,6 @@ panel_util_get_file_display_name_if_mount (GFile *file)
return ret;
}
-#define HOME_NAME_KEY "/apps/caja/desktop/home_icon_name"
static char *
panel_util_get_file_display_for_common_files (GFile *file)
{
@@ -830,18 +829,20 @@ panel_util_get_file_display_for_common_files (GFile *file)
compare = g_file_new_for_path (g_get_home_dir ());
if (g_file_equal (file, compare)) {
- char *mateconf_name;
+ GSettings *caja_desktop_settings;
+ char *caja_home_icon_name;
g_object_unref (compare);
- mateconf_name = mateconf_client_get_string (panel_mateconf_get_client (),
- HOME_NAME_KEY,
- NULL);
- if (PANEL_GLIB_STR_EMPTY (mateconf_name)) {
- g_free (mateconf_name);
+ caja_desktop_settings = g_settings_new (CAJA_DESKTOP_SCHEMA);
+ caja_home_icon_name = g_settings_get_string (caja_desktop_settings,
+ CAJA_DESKTOP_HOME_ICON_NAME_KEY);
+ g_object_unref (caja_desktop_settings);
+ if (PANEL_GLIB_STR_EMPTY (caja_home_icon_name)) {
+ g_free (caja_home_icon_name);
return g_strdup (_("Home Folder"));
} else {
- return mateconf_name;
+ return caja_home_icon_name;
}
}
g_object_unref (compare);
diff --git a/mate-panel/panel.c b/mate-panel/panel.c
index 5f2a9666..c3a5a8ab 100644
--- a/mate-panel/panel.c
+++ b/mate-panel/panel.c
@@ -30,13 +30,11 @@
#include "panel-context-menu.h"
#include "panel-util.h"
#include "panel-config-global.h"
-#include "panel-mateconf.h"
#include "panel-profile.h"
#include "mate-panel-applet-frame.h"
#include "panel-action-button.h"
#include "panel-menu-bar.h"
#include "panel-separator.h"
-#include "panel-compatibility.h"
#include "panel-multiscreen.h"
#include "panel-toplevel.h"
#include "panel-menu-button.h"
@@ -407,8 +405,8 @@ set_background_image_from_uri (PanelToplevel *toplevel,
{
char *image;
- if ( ! panel_profile_is_writable_background_type (toplevel) ||
- ! panel_profile_is_writable_background_image (toplevel))
+ if ( ! panel_profile_background_key_is_writable (toplevel, "type") ||
+ ! panel_profile_background_key_is_writable (toplevel, "image"))
return FALSE;
if (!(image = g_filename_from_uri (uri, NULL, NULL)))
@@ -431,8 +429,8 @@ set_background_color (PanelToplevel *toplevel,
if (!dropped)
return FALSE;
- if ( ! panel_profile_is_writable_background_type (toplevel) ||
- ! panel_profile_is_writable_background_color (toplevel))
+ if ( ! panel_profile_background_key_is_writable (toplevel, "color") ||
+ ! panel_profile_background_key_is_writable (toplevel, "type"))
return FALSE;
color.gdk.red = dropped [0];
@@ -1086,7 +1084,7 @@ panel_receive_dnd_data (PanelWidget *panel,
success = set_background_image_from_uri (panel->toplevel, (char *) data);
break;
case TARGET_BACKGROUND_RESET:
- if (panel_profile_is_writable_background_type (panel->toplevel)) {
+ if (panel_profile_background_key_is_writable (panel->toplevel, "type")) {
panel_profile_set_background_type (panel->toplevel, PANEL_BACK_NONE);
success = TRUE;
} else {