summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-02-18 16:23:48 +0100
committerStefano Karapetsas <[email protected]>2014-02-18 16:23:48 +0100
commit33c1874fbb17ed83c6d24103eff09c83297e0c4d (patch)
treebb314fc4831721be0e3da08d6fd07251137087e6
parent453154a00f0f17e20340e408055e224ea57cc4e8 (diff)
downloadmate-panel-33c1874fbb17ed83c6d24103eff09c83297e0c4d.tar.bz2
mate-panel-33c1874fbb17ed83c6d24103eff09c83297e0c4d.tar.xz
Allow to have multiple panel layouts
-rw-r--r--data/Makefile.am6
-rw-r--r--data/default.layout (renamed from data/panel-default-layout.mate)0
-rw-r--r--data/org.mate.panel.gschema.xml.in.in5
-rw-r--r--mate-panel/panel-layout.c27
-rw-r--r--mate-panel/panel-schemas.h1
5 files changed, 26 insertions, 13 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 7b7d3721..cca1600c 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,5 +1,5 @@
-default_layoutdir = $(datadir)/mate-panel
-default_layout_DATA = panel-default-layout.mate
+layoutdir = $(datadir)/mate-panel/layouts
+layout_DATA = default.layout
@INTLTOOL_XML_NOMERGE_RULE@
@@ -26,7 +26,7 @@ convert_DATA = mate-panel.convert
EXTRA_DIST = \
$(convert_DATA) \
$(panel_gschemas_in_in) \
- panel-default-layout.mate
+ $(layout_DATA)
CLEANFILES = \
$(panel_gschemas_in) \
diff --git a/data/panel-default-layout.mate b/data/default.layout
index 77923b42..77923b42 100644
--- a/data/panel-default-layout.mate
+++ b/data/default.layout
diff --git a/data/org.mate.panel.gschema.xml.in.in b/data/org.mate.panel.gschema.xml.in.in
index 53c32b86..ec613941 100644
--- a/data/org.mate.panel.gschema.xml.in.in
+++ b/data/org.mate.panel.gschema.xml.in.in
@@ -1,5 +1,10 @@
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
<schema id="org.mate.panel" path="/org/mate/panel/general/">
+ <key name="default-layout" type="s">
+ <default>'default'</default>
+ <_summary>Default panel layout</_summary>
+ <_description>The default panels layout to use when panels are created or resetted.</_description>
+ </key>
<key name="enable-program-list" type="b">
<default>true</default>
<_summary>Enable program list in "Run Application" dialog</_summary>
diff --git a/mate-panel/panel-layout.c b/mate-panel/panel-layout.c
index 47324208..f7554990 100644
--- a/mate-panel/panel-layout.c
+++ b/mate-panel/panel-layout.c
@@ -37,8 +37,7 @@
#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"
+#define PANEL_LAYOUTS_DIR PANELDATADIR "/layouts/"
typedef struct {
const char *name;
@@ -91,15 +90,23 @@ static PanelLayoutKeyDefinition panel_layout_object_keys[] = {
* 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);
+panel_layout_filename ()
+{
+ GSettings *settings;
+ gchar *layout;
+ gchar *filename;
+
+ settings = g_settings_new (PANEL_SCHEMA);
+ layout = g_settings_get_string (settings, PANEL_DEFAULT_LAYOUT);
+ filename = g_strdup_printf (PANEL_LAYOUTS_DIR "%s.layout", layout);
+ g_free (layout);
+ g_object_unref (settings);
+
+ if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ return filename;
}
else {
+ g_free (filename);
return NULL;
}
}
@@ -341,7 +348,7 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen)
}
else {
- g_warning ("Cant find a default layout file!");
+ g_warning ("Cant find the layout file!");
/* FIXME implement a fallback panel */
}
diff --git a/mate-panel/panel-schemas.h b/mate-panel/panel-schemas.h
index c21a8464..ee7c894b 100644
--- a/mate-panel/panel-schemas.h
+++ b/mate-panel/panel-schemas.h
@@ -10,6 +10,7 @@
#define PANEL_OBJECT_DEFAULT_PREFIX "object"
#define PANEL_SCHEMA "org.mate.panel"
+#define PANEL_DEFAULT_LAYOUT "default-layout"
#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"