summaryrefslogtreecommitdiff
path: root/settings-dialogs/workspace-settings.c
diff options
context:
space:
mode:
authorOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-08-04 20:28:44 +0000
committerOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-08-04 20:28:44 +0000
commit0aaa41b226d7cb756408d8eaf0b413d402ca7763 (patch)
tree22405617a613e8d16921a621bc3af933b5716cbc /settings-dialogs/workspace-settings.c
parent0622985fd160ce7fae4622ae40c2b8bd48f24552 (diff)
downloadxfwm4-0aaa41b226d7cb756408d8eaf0b413d402ca7763.tar.gz
Merge work from Stephan Arts <stephan@xfce.org> (Bug #4065)
(Old svn revision: 27421)
Diffstat (limited to 'settings-dialogs/workspace-settings.c')
-rw-r--r--settings-dialogs/workspace-settings.c116
1 files changed, 116 insertions, 0 deletions
diff --git a/settings-dialogs/workspace-settings.c b/settings-dialogs/workspace-settings.c
new file mode 100644
index 000000000..88039ee0c
--- /dev/null
+++ b/settings-dialogs/workspace-settings.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2008 Stephan Arts <stephan@xfce.org>
+ *
+ * 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 Library 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.
+ */
+
+
+#include <config.h>
+#include <string.h>
+
+#include <glib.h>
+
+#if defined(GETTEXT_PACKAGE)
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+#include <libxfcegui4/libxfcegui4.h>
+#include <xfconf/xfconf.h>
+#include "xfwm4-workspace-dialog_glade.h"
+
+static gboolean version = FALSE;
+
+GtkWidget *
+workspace_dialog_new_from_xml (GladeXML *gxml)
+{
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+ XfconfChannel *xfwm4_channel = xfconf_channel_new("xfwm4");
+
+ GtkWidget *workspace_count_spinbutton = glade_xml_get_widget (gxml, "workspace_count_spinbutton");
+
+ /* Bind easy properties */
+ xfconf_g_property_bind (xfwm4_channel,
+ "/general/workspace_count",
+ G_TYPE_INT,
+ (GObject *)workspace_count_spinbutton, "value");
+
+ vbox = glade_xml_get_widget (gxml, "main-vbox");
+ dialog = glade_xml_get_widget (gxml, "main-dialog");
+
+ gtk_widget_show_all(vbox);
+
+ return dialog;
+}
+
+
+static GOptionEntry entries[] =
+{
+ { "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
+ N_("Version information"),
+ NULL
+ },
+ { NULL }
+};
+
+
+int
+main(int argc, gchar **argv)
+{
+ GladeXML *gxml;
+ GtkWidget *dialog;
+ GError *cli_error = NULL;
+
+ #ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+ #endif
+
+ if(!gtk_init_with_args(&argc, &argv, _("."), entries, PACKAGE, &cli_error))
+ {
+ if (cli_error != NULL)
+ {
+ g_print (_("%s: %s\nTry %s --help to see a full list of available command line options.\n"), PACKAGE, cli_error->message, PACKAGE_NAME);
+ g_error_free (cli_error);
+ return 1;
+ }
+ }
+
+ if(version)
+ {
+ g_print("%s\n", PACKAGE_STRING);
+ return 0;
+ }
+
+ xfconf_init(NULL);
+
+ gxml = glade_xml_new_from_buffer (workspace_dialog_glade,
+ workspace_dialog_glade_length,
+ NULL, NULL);
+
+ dialog = workspace_dialog_new_from_xml (gxml);
+
+ gtk_dialog_run(GTK_DIALOG(dialog));
+
+ xfconf_shutdown();
+
+ return 0;
+}