summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-10-22 16:39:08 +0200
committerStefano Karapetsas <[email protected]>2012-10-22 16:39:08 +0200
commit78bd678462f2f5cc78b8986e4d17d98e5286819d (patch)
tree56e28b4877c08afe81ce8ebb9cc7b77cdf4d40d0 /shell
parent9b69f6561dab8a2669d65b67636ea07e171c60b5 (diff)
downloadmate-control-center-78bd678462f2f5cc78b8986e4d17d98e5286819d.tar.bz2
mate-control-center-78bd678462f2f5cc78b8986e4d17d98e5286819d.tar.xz
migrate control-center to gsettings
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile.am17
-rw-r--r--shell/control-center.c36
-rw-r--r--shell/control-center.schemas.in71
3 files changed, 26 insertions, 98 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am
index db58a1f4..9ce991ba 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -33,24 +33,11 @@ directory_in_files = matecc.directory.in
directory_DATA = $(directory_in_files:.directory.in=.directory)
@INTLTOOL_DIRECTORY_RULE@
-schemasdir = @MATECONF_SCHEMA_FILE_DIR@
-schemas_DATA = control-center.schemas
-@INTLTOOL_SCHEMAS_RULE@
-
-install-data-local: $(schema_DATA)
-if MATECONF_SCHEMAS_INSTALL
- if test -z "$(DESTDIR)" ; then \
- for p in $^ ; do \
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $$p 2>&1 > /dev/null; \
- done \
- fi
-endif
-
menudir = $(sysconfdir)/xdg/menus
menu_DATA = matecc.menu
-EXTRA_DIST = matecc.desktop.in.in matecc.directory.in matecc.menu $(schemas_DATA).in
+EXTRA_DIST = matecc.desktop.in.in matecc.directory.in matecc.menu
-DISTCLEANFILES = matecc.desktop matecc.desktop.in matecc.directory $(schemas_DATA)
+DISTCLEANFILES = matecc.desktop matecc.desktop.in matecc.directory
-include $(top_srcdir)/git.mk
diff --git a/shell/control-center.c b/shell/control-center.c
index b25f42d7..79dd4a5f 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libmate/mate-desktop-item.h>
#include <unique/unique.h>
@@ -30,23 +31,34 @@
void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data);
static GSList* get_actions_list();
-#define CONTROL_CENTER_PREFIX "/apps/control-center/cc_"
-#define CONTROL_CENTER_ACTIONS_LIST_KEY (CONTROL_CENTER_PREFIX "actions_list")
+#define CONTROL_CENTER_SCHEMA "org.mate.control-center"
+#define CONTROL_CENTER_ACTIONS_LIST_KEY "cc-actions-list"
#define CONTROL_CENTER_ACTIONS_SEPARATOR ";"
-#define EXIT_SHELL_ON_STATIC_ACTION "exit_shell_on_static_action"
+#define EXIT_SHELL_ON_STATIC_ACTION "cc-exit-shell-on-static-action"
static GSList* get_actions_list(void)
{
+ GSettings *settings;
GSList* l;
- GSList* key_list;
+ GSList* key_list = NULL;
GSList* actions_list = NULL;
AppAction* action;
-
- key_list = get_slab_mateconf_slist(CONTROL_CENTER_ACTIONS_LIST_KEY);
+ gchar **array;
+ gint i;
+
+ settings = g_settings_new (CONTROL_CENTER_SCHEMA);
+ array = g_settings_get_strv (settings, CONTROL_CENTER_ACTIONS_LIST_KEY);
+ if (array != NULL) {
+ for (i = 0; array[i]; i++) {
+ key_list = g_slist_append (key_list, g_strdup (array[i]));
+ }
+ }
+ g_strfreev (array);
+ g_object_unref (settings);
if (!key_list)
{
- g_warning(_("key not found [%s]\n"), CONTROL_CENTER_ACTIONS_LIST_KEY);
+ g_warning(_("%s key is empty\n"), CONTROL_CENTER_ACTIONS_LIST_KEY);
return NULL;
}
@@ -79,9 +91,9 @@ static GSList* get_actions_list(void)
void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
{
- gchar* temp;
AppShellData* app_data = (AppShellData*) data;
MateDesktopItem* item = (MateDesktopItem*) g_object_get_data(G_OBJECT(tile), APP_ACTION_KEY);
+ GSettings *settings;
if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
{
@@ -90,9 +102,9 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
open_desktop_item_exec(item);
- temp = g_strdup_printf("%s%s", app_data->mateconf_prefix, EXIT_SHELL_ON_STATIC_ACTION);
+ settings = g_settings_new (CONTROL_CENTER_SCHEMA);
- if (get_slab_mateconf_bool(temp))
+ if (g_settings_get_boolean(settings, EXIT_SHELL_ON_STATIC_ACTION))
{
if (app_data->exit_on_close)
{
@@ -104,7 +116,7 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
}
}
- g_free(temp);
+ g_object_unref(settings);
}
static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command, UniqueMessageData* message, guint time, gpointer user_data)
@@ -182,7 +194,7 @@ int main(int argc, char* argv[])
return retval;
}
- app_data = appshelldata_new("matecc.menu", NULL, CONTROL_CENTER_PREFIX, GTK_ICON_SIZE_DND, FALSE, TRUE);
+ app_data = appshelldata_new("matecc.menu", GTK_ICON_SIZE_DND, FALSE, TRUE);
generate_categories(app_data);
actions = get_actions_list();
diff --git a/shell/control-center.schemas.in b/shell/control-center.schemas.in
deleted file mode 100644
index c7dce99b..00000000
--- a/shell/control-center.schemas.in
+++ /dev/null
@@ -1,71 +0,0 @@
-<mateconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/control-center/cc_actions_list</key>
- <applyto>/apps/control-center/cc_actions_list</applyto>
- <owner>control-center</owner>
- <type>list</type>
- <list_type>string</list_type>
- <locale name="C">
- <default><!-- Translators: The format of this string is the task name to be displayed (translate that part) followed by a ";" separator then the filename (DONT translate the file name) of a .desktop file to launch. Multiple entries are separated by a "," -->[Change Theme;gtk-theme-selector.desktop,Set Preferred Applications;default-applications.desktop,Add Printer;mate-cups-manager.desktop]</default>
- <short>Task names and associated .desktop files</short>
- <long>The task name to be displayed in the control-center followed by a ";" separator then the filename of an associated .desktop file to launch for that task.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/control-center/cc_exit_shell_on_static_action</key>
- <applyto>/apps/control-center/cc_exit_shell_on_static_action</applyto>
- <owner>control-center</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Close the control-center when a task is activated</short>
- <long>if true, the control-center will close when a "Common Task" is activated.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/control-center/cc_exit_shell_on_action_start</key>
- <applyto>/apps/control-center/cc_exit_shell_on_action_start</applyto>
- <owner>control-center</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Exit shell on start action performed</short>
- <long>Indicates whether to close the shell when a start action is performed.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/control-center/cc_exit_shell_on_action_help</key>
- <applyto>/apps/control-center/cc_exit_shell_on_action_help</applyto>
- <owner>control-center</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Exit shell on help action performed</short>
- <long>Indicates whether to close the shell when a help action is performed.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/control-center/cc_exit_shell_on_action_add_remove</key>
- <applyto>/apps/control-center/cc_exit_shell_on_action_add_remove</applyto>
- <owner>control-center</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Exit shell on add or remove action performed</short>
- <long>Indicates whether to close the shell when an add or remove action is performed.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/control-center/cc_exit_shell_on_action_upgrade_uninstall</key>
- <applyto>/apps/control-center/cc_exit_shell_on_action_upgrade_uninstall</applyto>
- <owner>control-center</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Exit shell on upgrade or uninstall action performed</short>
- <long>Indicates whether to close the shell when an upgrade or uninstall action is performed.</long>
- </locale>
- </schema>
- </schemalist>
-</mateconfschemafile>