[Xfce4-commits] r26798 - in xfce-mcs-plugins/branches/xfce-plugins-stephan: . plugins plugins/appearance-plugin
Stephan Arts
stephan at xfce.org
Tue Apr 8 21:02:20 CEST 2008
Author: stephan
Date: 2008-04-08 19:02:20 +0000 (Tue, 08 Apr 2008)
New Revision: 26798
Added:
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/Makefile.am
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.h
Modified:
xfce-mcs-plugins/branches/xfce-plugins-stephan/configure.ac.in
xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/Makefile.am
Log:
Import source-code
Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/configure.ac.in
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/configure.ac.in 2008-04-08 18:15:11 UTC (rev 26797)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/configure.ac.in 2008-04-08 19:02:20 UTC (rev 26798)
@@ -66,6 +66,7 @@
Makefile
po/Makefile.in
plugins/Makefile
+plugins/appearance-plugin/Makefile
])
echo "----------------------------------------"
Modified: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/Makefile.am
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/Makefile.am 2008-04-08 18:15:11 UTC (rev 26797)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/Makefile.am 2008-04-08 19:02:20 UTC (rev 26798)
@@ -0,0 +1,2 @@
+SUBDIRS = \
+ appearance-plugin
Added: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/Makefile.am
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/Makefile.am (rev 0)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/Makefile.am 2008-04-08 19:02:20 UTC (rev 26798)
@@ -0,0 +1,25 @@
+bin_PROGRAMS = xfce4-appearance-settings
+
+xfce4_appearance_settings_SOURCES = \
+ main.c \
+ ui-dialog.c ui-dialog.h
+
+xfce4_appearance_settings_CFLAGS = \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(DBUS_GLIB_CFLAGS) \
+ $(LIBXFCEGUI4_CFLAGS) \
+ $(XFCONF_CFLAGS) \
+ -DDATADIR=\"$(datadir)\" \
+ -DSRCDIR=\"$(top_srcdir)\" \
+ -DLOCALEDIR=\"$(localedir)\"
+
+xfce4_appearance_settings_LDADD = \
+ $(GTK_LIBS) \
+ $(GLIB_LIBS) \
+ $(DBUS_GLIB_LIBS) \
+ $(LIBXFCEGUI4_LIBS) \
+ $(XFCONF_LIBS)
+
+INCLUDES = \
+ -I${top_srcdir}
Added: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c (rev 0)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/main.c 2008-04-08 19:02:20 UTC (rev 26798)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2008 Stephan Arts <stephan at 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 <glib.h>
+
+#if defined(GETTEXT_PACKAGE)
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <libxfcegui4/libxfcegui4.h>
+#include <xfconf/xfconf.h>
+
+#include "ui-dialog.h"
+
+gboolean version = FALSE;
+
+static GOptionEntry entries[] =
+{
+ { "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
+ N_("Version information"),
+ NULL
+ },
+ { NULL }
+};
+
+
+int
+main(int argc, char **argv)
+{
+ 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);
+ GtkWidget *ui_dialog = g_object_new(UI_TYPE_DIALOG, NULL);
+ gtk_widget_show_all(ui_dialog);
+
+ ui_dialog_load_settings(UI_DIALOG(ui_dialog));
+ gint result = gtk_dialog_run(ui_dialog);
+ if (result == GTK_RESPONSE_CLOSE)
+ {
+ ui_dialog_save_settings(UI_DIALOG(ui_dialog));
+ }
+
+ xfconf_shutdown();
+}
Added: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c (rev 0)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.c 2008-04-08 19:02:20 UTC (rev 26798)
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) Stephan Arts 2006-2008 <stephan at 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 <glib.h>
+
+#if defined(GETTEXT_PACKAGE)
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <libxfcegui4/libxfcegui4.h>
+#include <xfconf/xfconf.h>
+
+#include "ui-dialog.h"
+
+struct _UIDialogPriv
+{
+ GtkWidget *heading;
+ GtkWidget *close_button;
+ GtkWidget *separator;
+ GtkWidget *notebook;
+
+ struct {
+ XfconfChannel *xsettings;
+ } channels;
+
+ struct {
+ GtkWidget *themes_label;
+ GtkWidget *themes_box;
+ } themes;
+
+ struct {
+ GtkWidget *font_label;
+ GtkWidget *font_box;
+ } font;
+
+ struct {
+ GtkWidget *behaviour_label;
+ GtkWidget *behaviour_box;
+
+ GtkWidget *toolbar_box;
+ GtkWidget *toolbar_frame;
+ GtkWidget *toolbar_style_combo;
+
+ GtkWidget *menu_accel_box;
+ GtkWidget *menu_accel_frame;
+ GtkWidget *menu_accel_check;
+ } behaviour;
+
+ struct {
+ GtkWidget *desktop_label;
+ GtkWidget *desktop_box;
+ } desktop;
+};
+
+G_DEFINE_TYPE (UIDialog, ui_dialog, GTK_TYPE_DIALOG);
+
+#define GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), UI_TYPE_DIALOG, UIDialogPriv))
+
+static void
+ui_dialog_init(UIDialog *ui_dialog)
+{
+ UIDialogPriv *priv = GET_PRIVATE(ui_dialog);
+
+ priv->heading = xfce_heading_new();
+ priv->separator = gtk_hseparator_new();
+ priv->notebook = gtk_notebook_new();
+
+ priv->channels.xsettings = xfconf_channel_new("xsettings");
+
+ xfce_heading_set_icon_name(XFCE_HEADING(priv->heading), "preferences-desktop-theme");
+ xfce_heading_set_title(XFCE_HEADING(priv->heading), _("Appearance Settings"));
+ xfce_heading_set_subtitle(XFCE_HEADING(priv->heading), _("Change the looks of your xfce-desktop"));
+
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(ui_dialog)->vbox), priv->heading, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(ui_dialog)->vbox), priv->separator,FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(ui_dialog)->vbox), priv->notebook,TRUE, TRUE, 0);
+
+ priv->themes.themes_label = gtk_label_new_with_mnemonic(_("_Themes"));
+ priv->themes.themes_box = gtk_vbox_new(FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->themes.themes_box, priv->themes.themes_label);
+ gtk_container_set_border_width(GTK_CONTAINER(priv->themes.themes_box), 3);
+
+
+ priv->font.font_label = gtk_label_new_with_mnemonic(_("_Font"));
+ priv->font.font_box = gtk_vbox_new(FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->font.font_box, priv->font.font_label);
+ gtk_container_set_border_width(GTK_CONTAINER(priv->font.font_box), 3);
+
+ priv->behaviour.behaviour_label = gtk_label_new_with_mnemonic(_("_Behaviour"));
+ priv->behaviour.behaviour_box = gtk_vbox_new(FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->behaviour.behaviour_box, priv->behaviour.behaviour_label);
+ gtk_container_set_border_width(GTK_CONTAINER(priv->behaviour.behaviour_box), 3);
+
+ priv->behaviour.toolbar_box = gtk_vbox_new (FALSE, 0);
+ priv->behaviour.toolbar_frame = xfce_create_framebox_with_content(_("Toolbar"), priv->behaviour.toolbar_box);
+ gtk_box_pack_start(GTK_BOX(priv->behaviour.behaviour_box), priv->behaviour.toolbar_frame, FALSE, FALSE, 0);
+
+ priv->behaviour.toolbar_style_combo = gtk_combo_box_new_text();
+ gtk_box_pack_start(GTK_BOX(priv->behaviour.toolbar_box),
+ priv->behaviour.toolbar_style_combo,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_combo_box_append_text(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ _("Icons"));
+ gtk_combo_box_append_text(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ _("Text"));
+ gtk_combo_box_append_text(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ _("Both"));
+ gtk_combo_box_append_text(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ _("Both horizontal"));
+ priv->behaviour.menu_accel_box = gtk_vbox_new(FALSE, 0);
+ priv->behaviour.menu_accel_frame = xfce_create_framebox_with_content(_("Menu accelerators"), priv->behaviour.menu_accel_box);
+ gtk_box_pack_start(
+ GTK_BOX(priv->behaviour.behaviour_box),
+ priv->behaviour.menu_accel_frame,
+ FALSE,
+ FALSE,
+ 0);
+
+ priv->behaviour.menu_accel_check = gtk_check_button_new_with_mnemonic(_("_Enable editable menu accelerators"));
+ gtk_box_pack_start(
+ GTK_BOX(priv->behaviour.menu_accel_box),
+ priv->behaviour.menu_accel_check,
+ FALSE,
+ FALSE,
+ 0);
+
+ priv->desktop.desktop_label = gtk_label_new_with_mnemonic(_("_Desktop"));
+ priv->desktop.desktop_box = gtk_vbox_new(FALSE, 0);
+ gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), priv->desktop.desktop_box, priv->desktop.desktop_label);
+ gtk_container_set_border_width(GTK_CONTAINER(priv->desktop.desktop_box), 3);
+
+ priv->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+ gtk_dialog_add_action_widget(GTK_DIALOG(ui_dialog), priv->close_button, GTK_RESPONSE_CLOSE);
+}
+
+static void
+ui_dialog_class_init(UIDialogClass *ui_dialog_class)
+{
+ g_type_class_add_private(ui_dialog_class, sizeof(UIDialogPriv));
+}
+
+gboolean
+ui_dialog_load_settings(UIDialog *ui_dialog)
+{
+ UIDialogPriv *priv = GET_PRIVATE(ui_dialog);
+
+ const gchar *toolbar_style = xfconf_channel_get_string(priv->channels.xsettings, "/Gtk/ToolbarStyle", "icons");
+ if (!g_strcasecmp(toolbar_style, "icons"))
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ GTK_TOOLBAR_ICONS);
+ if (!g_strcasecmp(toolbar_style, "text"))
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ GTK_TOOLBAR_TEXT);
+ if (!g_strcasecmp(toolbar_style, "both"))
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ GTK_TOOLBAR_BOTH);
+ if (!g_strcasecmp(toolbar_style, "both-horiz"))
+ gtk_combo_box_set_active(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo),
+ GTK_TOOLBAR_BOTH_HORIZ);
+
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(priv->behaviour.menu_accel_check),
+ xfconf_channel_get_bool(priv->channels.xsettings, "/Gtk/CanChangeAccels", FALSE));
+
+
+ return FALSE;
+};
+
+gboolean
+ui_dialog_save_settings(UIDialog *ui_dialog)
+{
+ UIDialogPriv *priv = GET_PRIVATE(ui_dialog);
+
+ switch(gtk_combo_box_get_active(
+ GTK_COMBO_BOX(priv->behaviour.toolbar_style_combo)))
+ {
+ case GTK_TOOLBAR_ICONS:
+ xfconf_channel_set_string(priv->channels.xsettings, "/Gtk/ToolbarStyle", "icons");
+ break;
+ case GTK_TOOLBAR_TEXT:
+ xfconf_channel_set_string(priv->channels.xsettings, "/Gtk/ToolbarStyle", "text");
+ break;
+ case GTK_TOOLBAR_BOTH:
+ xfconf_channel_set_string(priv->channels.xsettings, "/Gtk/ToolbarStyle", "both");
+ break;
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ xfconf_channel_set_string(priv->channels.xsettings, "/Gtk/ToolbarStyle", "both-horiz");
+ break;
+
+ }
+ xfconf_channel_set_bool(
+ priv->channels.xsettings,
+ "/Gtk/CanChangeAccels",
+ gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(priv->behaviour.menu_accel_check)));
+ return FALSE;
+};
Added: xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.h
===================================================================
--- xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.h (rev 0)
+++ xfce-mcs-plugins/branches/xfce-plugins-stephan/plugins/appearance-plugin/ui-dialog.h 2008-04-08 19:02:20 UTC (rev 26798)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) Stephan Arts 2006-2008 <stephan at 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.
+ */
+
+#ifndef __UI_DIALOG_H__
+#define __UI_DIALOG_H__
+
+#define UI_TYPE_DIALOG (ui_dialog_get_type())
+#define UI_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_DIALOG, UIDialog))
+#define UI_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UI_TYPE_DIALOG, UIDialogClass))
+#define UI_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UI_TYPE_DIALOG))
+#define UI_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UI_TYPE_DIALOG))
+#define UI_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UI_TYPE_DIALOG, UIDialogClass))
+
+typedef struct _UIDialogPriv UIDialogPriv;
+
+typedef struct _UIDialog UIDialog;
+
+struct _UIDialog
+{
+ GtkDialog parent;
+ UIDialogPriv *priv;
+};
+
+typedef struct _UIDialogClass UIDialogClass;
+
+struct _UIDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
+GType
+ui_dialog_get_type();
+gboolean
+ui_dialog_save_settings(UIDialog *ui_dialog);
+gboolean
+ui_dialog_load_settings(UIDialog *ui_dialog);
+
+#endif /* __UI_DIALOG_H__ */
More information about the Xfce4-commits
mailing list