summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-02-18 16:24:25 +0100
committerStefano Karapetsas <[email protected]>2014-02-18 16:24:25 +0100
commit8f566ae05581e987378b790570ab4d66d6e1b071 (patch)
treef2f30f73b36c77f0e052cb17b5d89b9a1273cc56
parent33c1874fbb17ed83c6d24103eff09c83297e0c4d (diff)
downloadmate-panel-8f566ae05581e987378b790570ab4d66d6e1b071.tar.bz2
mate-panel-8f566ae05581e987378b790570ab4d66d6e1b071.tar.xz
Allow to set default layout with --layout
-rw-r--r--mate-panel/main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mate-panel/main.c b/mate-panel/main.c
index 500d624e..bde5ec13 100644
--- a/mate-panel/main.c
+++ b/mate-panel/main.c
@@ -25,6 +25,7 @@
#include "panel-shell.h"
#include "panel-multiscreen.h"
#include "panel-session.h"
+#include "panel-schemas.h"
#include "panel-stock-icons.h"
#include "panel-action-protocol.h"
#include "panel-lockdown.h"
@@ -40,6 +41,7 @@ GSList *panels = NULL;
GSList *panel_list = NULL;
static char* deprecated_profile;
+static char* layout;
static gboolean replace = FALSE;
static gboolean reset = FALSE;
static gboolean run_dialog = FALSE;
@@ -52,6 +54,8 @@ static const GOptionEntry options[] = {
{ "reset", 0, 0, G_OPTION_ARG_NONE, &reset, N_("Reset the panel configuration to default"), NULL },
/* open run dialog */
{ "run-dialog", 0, 0, G_OPTION_ARG_NONE, &run_dialog, N_("Execute the run dialog"), NULL },
+ /* default panels layout */
+ { "layout", 0, 0, G_OPTION_ARG_STRING, &layout, N_("Set the default panel layout"), NULL },
{ NULL }
};
@@ -96,6 +100,19 @@ main (int argc, char **argv)
g_option_context_free (context);
+ /* set the default layout */
+ if (layout != NULL && layout[0] != 0)
+ {
+ GSettings *settings;
+ settings = g_settings_new (PANEL_SCHEMA);
+ g_settings_set_string (settings, PANEL_DEFAULT_LAYOUT, layout);
+ g_object_unref (settings);
+ g_message ("Panel layout set to '%s'", layout);
+ /* exit, except if reset argument is given */
+ if (!reset)
+ return 0;
+ }
+
/* reset the configuration and exit. */
if (reset == TRUE)
{