[Xfce4-commits] <xfce4-panel:devel> * Move separator code too.
Nick Schermer
nick at xfce.org
Tue Aug 11 20:22:53 CEST 2009
Updating branch refs/heads/devel
to 0696fee17c91fb782b9bdf0f0f1d99e0ccb2e05c (commit)
from e3b8c5561b51382f2ce1fb1a775ff149bf89af44 (commit)
commit 0696fee17c91fb782b9bdf0f0f1d99e0ccb2e05c
Author: Nick Schermer <nick at xfce.org>
Date: Sat Aug 9 23:04:11 2008 +0200
* Move separator code too.
plugins/{tasklist.new => separator}/Makefile.am | 28 ++--
plugins/separator/separator.c | 181 ++++++++++++++++++++
.../separator.desktop.in.in} | 6 +-
3 files changed, 197 insertions(+), 18 deletions(-)
diff --git a/plugins/tasklist.new/Makefile.am b/plugins/separator/Makefile.am
similarity index 71%
copy from plugins/tasklist.new/Makefile.am
copy to plugins/separator/Makefile.am
index bd7ad92..882c602 100644
--- a/plugins/tasklist.new/Makefile.am
+++ b/plugins/separator/Makefile.am
@@ -2,46 +2,44 @@
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_builddir) \
- -DBINDIR=\"$(bindir)\" \
- -DG_LOG_DOMAIN=\"libtasklist\" \
+ -DG_LOG_DOMAIN=\"libseparator\" \
+ -DLOCALEDIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
plugindir = \
$(libdir)/xfce4/panel-plugins
plugin_LTLIBRARIES = \
- libtasklist.la
+ libseparator.la
-libtasklist_la_SOURCES = \
- tasklist-box.c \
- tasklist-box.h \
- tasklist-plugin.c \
- tasklist-plugin.h
+libseparator_la_SOURCES = \
+ separator.c
-libtasklist_la_CFLAGS = \
+libseparator_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
+ $(CAIRO_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(PLATFORM_CFLAGS)
-libtasklist_la_LDFLAGS = \
+libseparator_la_LDFLAGS = \
-avoid-version \
-module \
$(PLATFORM_LDFLAGS)
if HAVE_CYGWIN
-libtasklist_la_LDFLAGS += \
+libseparator_la_LDFLAGS += \
-no-undefined
endif
-libtasklist_la_LIBADD = \
+libseparator_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
+ $(CAIRO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS)
-libtasklist_la_DEPENDENCIES = \
+libseparator_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la
#
@@ -51,7 +49,7 @@ desktopdir = \
$(datadir)/xfce4/panel-plugins
desktop_in_in_files = \
- tasklist.desktop.in.in
+ separator.desktop.in.in
desktop_in_files = \
$(desktop_in_in_files:.desktop.in.in=.desktop.in)
diff --git a/plugins/separator/separator.c b/plugins/separator/separator.c
new file mode 100644
index 0000000..7915988
--- /dev/null
+++ b/plugins/separator/separator.c
@@ -0,0 +1,181 @@
+/* $Id$ */
+/*
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2007-2008 Nick Schermer <nick 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 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+
+typedef struct _XfceSeparatorClass XfceSeparatorClass;
+typedef struct _XfceSeparator XfceSeparator;
+typedef enum _XfceSeparatorMode XfceSeparatorStyle;
+
+
+
+static void xfce_separator_class_init (XfceSeparatorClass *klass);
+static void xfce_separator_init (XfceSeparator *separator);
+static void xfce_separator_finalize (GObject *object);
+static void xfce_separator_configure_plugin (XfcePanelPlugin *plugin);
+static void xfce_separator_load (XfceSeparator *separator);
+
+
+
+struct _XfceSeparatorClass
+{
+ /* parent class */
+ XfcePanelPluginClass __parent__;
+};
+
+struct _XfceSeparator
+{
+ /* parent type */
+ XfcePanelPlugin __parent__;
+
+ /* separator style */
+ XfceSeparatorStyle style;
+
+ /* if the separator should expand */
+ guint expand : 1;
+};
+
+enum _XfceSeparatorMode
+{
+ XFCE_SEPARATOR_MODE_TRANSPARENT,
+ XFCE_SEPARATOR_MODE_SEPARATOR,
+ XFCE_SEPARATOR_MODE_HANDLE,
+ XFCE_SEPARATOR_MODE_DOTS
+};
+
+
+
+XFCE_PANEL_DEFINE_TYPE (XfceSeparator, xfce_separator, XFCE_TYPE_PANEL_PLUGIN);
+
+
+
+static void
+xfce_separator_class_init (XfceSeparatorClass *klass)
+{
+ XfcePanelPluginClass *plugin_class;
+
+ plugin_class = XFCE_PANEL_PLUGIN_CLASS (klass);
+ plugin_class->save = xfce_separator_save;
+ plugin_class->configure_plugin = xfce_separator_configure_plugin;
+}
+
+
+
+static void
+xfce_separator_init (XfceSeparator *separator)
+{
+ /* initialize the default values */
+ separator->style = XFCE_SEPARATOR_MODE_SEPARATOR;
+ separator->expand = FALSE;
+
+ /* show the properties dialog */
+ xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (clock));
+
+ /* read the user settings */
+ xfce_separator_load (separator);
+
+
+}
+
+
+
+static void
+xfce_separator_save (XfcePanelPlugin *plugin)
+{
+ XfceSeparator *separator = XFCE_SEPARATOR (plugin);
+ gchar *filename;
+ XfceRc *rc;
+
+ /* get the config file */
+ filename = xfce_panel_plugin_save_location (plugin, TRUE);
+ if (G_LIKELY (filename))
+ {
+ /* open rc file */
+ rc = xfce_rc_simple_open (filename, FALSE);
+
+ /* cleanup */
+ g_free (filename);
+
+ if (G_LIKELY (rc))
+ {
+ /* save the settings */
+ xfce_rc_write_int_entry (rc, "Expand", separator->expand);
+ xfce_rc_write_bool_entry (rc, "Style", separator->style);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+static void
+xfce_separator_configure_plugin (XfcePanelPlugin *plugin)
+{
+
+}
+
+
+
+static void
+xfce_separator_load (XfceSeparator *separator)
+{
+ gchar *filename;
+ XfceRc *rc;
+
+ /* config filename */
+ filename = xfce_panel_plugin_lookup_rc_file (XFCE_PANEL_PLUGIN (separator));
+ if (G_LIKELY (filename))
+ {
+ /* open rc file (readonly) */
+ rc = xfce_rc_simple_open (filename, TRUE);
+
+ /* cleanup */
+ g_free (filename);
+
+ if (G_LIKELY (rc))
+ {
+ /* read the settings */
+ separator->expand = xfce_rc_read_bool_entry (rc, "Expand", FALSE);
+ separator->style = xfce_rc_read_int_entry (rc, "Style", XFCE_SEPARATOR_MODE_SEPARATOR);
+
+ /* close the rc file */
+ xfce_rc_close (rc);
+ }
+ }
+}
+
+
+
+G_MODULE_EXPORT void
+xfce_panel_plugin_register_types (XfcePanelModule *panel_module)
+{
+ /* register the separator type */
+ xfce_separator_register_type (panel_module);
+}
+
+
+
+XFCE_PANEL_PLUGIN_REGISTER_OBJECT (XFCE_TYPE_SEPARATOR)
diff --git a/plugins/clock/clock.desktop.in.in b/plugins/separator/separator.desktop.in.in
similarity index 58%
copy from plugins/clock/clock.desktop.in.in
copy to plugins/separator/separator.desktop.in.in
index 8e31354..91e2460 100644
--- a/plugins/clock/clock.desktop.in.in
+++ b/plugins/separator/separator.desktop.in.in
@@ -1,9 +1,9 @@
[Xfce Panel]
Type=X-XFCE-PanelPlugin
Encoding=UTF-8
-_Name=Clock
-_Comment=What time is it?
+_Name=Separator or Spacing
+_Comment=Adds a space or a line between panel items
Icon=x-office-calendar
-X-XFCE-Module=clock
+X-XFCE-Module=separator
X-XFCE-Module-Path=@libdir@/xfce4/panel-plugins
X-XFCE-External=TRUE
More information about the Xfce4-commits
mailing list