[Xfce4-commits] <xfce4-panel:devel> Generate the XfceScreenPosition enum type.

Nick Schermer noreply at xfce.org
Mon Oct 26 21:18:02 CET 2009


Updating branch refs/heads/devel
         to 0e7c60d67c36972cf7b8b1f414bfd3a444453736 (commit)
       from 2709897058552033baefda648a07de5d4bba2d89 (commit)

commit 0e7c60d67c36972cf7b8b1f414bfd3a444453736
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Oct 26 14:36:20 2009 +0100

    Generate the XfceScreenPosition enum type.

 Makefile.am                                        |    2 +-
 libxfce4panel/Makefile.am                          |   26 +++++++++++++++++++-
 .../{xfce-panel-enums.h => libxfce4panel-enums.h}  |    8 ++++--
 libxfce4panel/libxfce4panel.h                      |    3 +-
 libxfce4panel/libxfce4panel.symbols                |    7 +++++
 libxfce4panel/xfce-panel-plugin.c                  |    6 ++--
 libxfce4panel/xfce-panel-plugin.h                  |   26 ++++++++++----------
 7 files changed, 56 insertions(+), 22 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0a7f885..4a7015a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
 # $Id$
 
 SUBDIRS = \
-	common \
 	libxfce4panel \
+	common \
 	panel \
 	plugins \
 	po \
diff --git a/libxfce4panel/Makefile.am b/libxfce4panel/Makefile.am
index d199235..b7932ac 100644
--- a/libxfce4panel/Makefile.am
+++ b/libxfce4panel/Makefile.am
@@ -10,18 +10,23 @@ INCLUDES = \
 lib_LTLIBRARIES = \
 	libxfce4panel.la
 
+libxfce4panel_public_built_sources = \
+	libxfce4panel-enum-types.h
+
 libxfce4panel_built_sources = \
+	$(libxfce4panel_public_built_sources) \
 	libxfce4panel-alias.h \
 	libxfce4panel-aliasdef.c \
+	libxfce4panel-enum-types.c \
 	libxfce4panel-marshal.c \
 	libxfce4panel-marshal.h
 
 libxfce4panel_headers = \
 	libxfce4panel.h \
+	libxfce4panel-enums.h \
 	xfce-arrow-button.h \
 	xfce-hvbox.h \
 	xfce-panel-convenience.h \
-	xfce-panel-enums.h \
 	xfce-panel-macros.h \
 	xfce-panel-plugin.h \
 	xfce-panel-image.h
@@ -30,6 +35,7 @@ libxfce4panel_includedir = \
 	$(includedir)/xfce4/libxfce4panel
 
 libxfce4panel_include_HEADERS = \
+	$(libxfce4panel_public_built_sources) \
 	$(libxfce4panel_headers)
 
 libxfce4panel_la_SOURCES = \
@@ -82,6 +88,24 @@ libxfce4panel-alias.h: make-libxfce4panel-alias.pl libxfce4panel.symbols
 libxfce4panel-aliasdef.c: make-libxfce4panel-alias.pl libxfce4panel.symbols
 	$(AM_V_GEN) $(PERL) $(srcdir)/make-libxfce4panel-alias.pl -def < $(srcdir)/libxfce4panel.symbols > $@
 
+libxfce4panel-enum-types.h: $(libxfce4panel_headers) Makefile
+	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
+		--fhead "#ifndef __LIBXFCE4PANEL_ENUM_TYPES_H__\n#define __LIBXFCE4PANEL_ENUM_TYPES_H__\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
+		--fprod "/* enumerations from \"@filename@\" */\n" \
+		--vhead "GType @enum_name at _get_type (void) G_GNUC_CONST;\n#define XFCE_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
+		--ftail "G_END_DECLS\n\n#endif /* !__LIBXFCE4PANEL_ENUM_TYPES_H__ */" \
+		$(libxfce4panel_headers) ) > $@
+
+libxfce4panel-enum-types.c:  $(libxfce4panel_headers) Makefile
+	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
+		--fhead "#include <libxfce4panel/libxfce4panel-enums.h>\n#include <libxfce4panel/libxfce4panel-enum-types.h>\n#include <libxfce4panel/libxfce4panel-alias.h>" \
+		--fprod "\n/* enumerations from \"@filename@\" */" \
+		--vhead "GType\n at enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G at Type@Value values[] = {"\
+		--vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+		--vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_ at type@_register_static (\"@EnumName@\", values);\n  }\n\treturn type;\n}\n" \
+		--ftail "\n#define __LIBXFCE4PANEL_ENUM_TYPES_C__\n#include <libxfce4panel/libxfce4panel-aliasdef.c>\n" \
+		$(libxfce4panel_headers) ) > $@
+
 DISTCLEANFILES = \
 	$(libxfce4panel_built_sources)
 
diff --git a/libxfce4panel/xfce-panel-enums.h b/libxfce4panel/libxfce4panel-enums.h
similarity index 97%
rename from libxfce4panel/xfce-panel-enums.h
rename to libxfce4panel/libxfce4panel-enums.h
index 2c74f44..d45440e 100644
--- a/libxfce4panel/xfce-panel-enums.h
+++ b/libxfce4panel/libxfce4panel-enums.h
@@ -22,8 +22,10 @@
 #error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
 #endif
 
-#ifndef __XFCE_PANEL_ENUMS_H__
-#define __XFCE_PANEL_ENUMS_H__
+#ifndef __LIBXFCE4PANEL_ENUMS_H__
+#define __LIBXFCE4PANEL_ENUMS_H__
+
+#include <glib-object.h>
 
 G_BEGIN_DECLS
 /**
@@ -171,4 +173,4 @@ XfceScreenPosition;
 
 G_END_DECLS
 
-#endif /* !__XFCE_PANEL_ENUMS_H__ */
+#endif /* !__LIBXFCE4PANEL_ENUMS_H__ */
diff --git a/libxfce4panel/libxfce4panel.h b/libxfce4panel/libxfce4panel.h
index c0715c4..06429d1 100644
--- a/libxfce4panel/libxfce4panel.h
+++ b/libxfce4panel/libxfce4panel.h
@@ -24,11 +24,12 @@ G_BEGIN_DECLS
 
 #define LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H
 
+#include <libxfce4panel/libxfce4panel-enums.h>
+#include <libxfce4panel/libxfce4panel-enum-types.h>
 #include <libxfce4panel/xfce-panel-macros.h>
 #include <libxfce4panel/xfce-arrow-button.h>
 #include <libxfce4panel/xfce-hvbox.h>
 #include <libxfce4panel/xfce-panel-convenience.h>
-#include <libxfce4panel/xfce-panel-enums.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-panel-image.h>
 
diff --git a/libxfce4panel/libxfce4panel.symbols b/libxfce4panel/libxfce4panel.symbols
index b720c81..17c8978 100644
--- a/libxfce4panel/libxfce4panel.symbols
+++ b/libxfce4panel/libxfce4panel.symbols
@@ -31,6 +31,13 @@
 #define IN_SOURCE(x) 1
 #endif
 
+/* libxfce4panel-enum-types.h */
+#if IN_HEADER(__LIBXFCE4PANEL_ENUM_TYPES_H__)
+#if IN_SOURCE(__LIBXFCE4PANEL_ENUM_TYPES_C__)
+xfce_screen_position_get_type G_GNUC_CONST
+#endif
+#endif
+
 /* xfce-arrow-button.h */
 #if IN_HEADER(__XFCE_ARROW_BUTTON_H__)
 #if IN_SOURCE(__XFCE_ARROW_BUTTON_C__)
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 934affd..2c7a264 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -334,7 +334,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
   /**
    * XfcePanelPlugin::screen-position-changed
    * @plugin   : an #XfcePanelPlugin.
-   * @position : the new screen position of the panel.
+   * @position : the new #XfceScreenPosition of the panel.
    *
    * This signal is emmitted whenever the screen position of the panel
    * the @plugin is on changes. Plugins writers can for example use
@@ -346,8 +346,8 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (XfcePanelPluginClass, screen_position_changed),
                   NULL, NULL,
-                  g_cclosure_marshal_VOID__INT,
-                  G_TYPE_NONE, 1, G_TYPE_INT);
+                  g_cclosure_marshal_VOID__ENUM,
+                  G_TYPE_NONE, 1, XFCE_TYPE_SCREEN_POSITION);
 
   /**
    * XfcePanelPlugin:name:
diff --git a/libxfce4panel/xfce-panel-plugin.h b/libxfce4panel/xfce-panel-plugin.h
index f797aa5..4e26c0e 100644
--- a/libxfce4panel/xfce-panel-plugin.h
+++ b/libxfce4panel/xfce-panel-plugin.h
@@ -25,7 +25,7 @@
 #define __XFCE_PANEL_PLUGIN_H__
 
 #include <gtk/gtk.h>
-#include <libxfce4panel/xfce-panel-enums.h>
+#include <libxfce4panel/libxfce4panel-enums.h>
 
 G_BEGIN_DECLS
 
@@ -46,20 +46,20 @@ struct _XfcePanelPluginClass
   GtkEventBoxClass __parent__;
 
   /*< object oriented plugins >*/
-  void     (*construct)               (XfcePanelPlugin *plugin);
+  void     (*construct)               (XfcePanelPlugin    *plugin);
 
   /*< signals >*/
-  void     (*screen_position_changed) (XfcePanelPlugin *plugin,
-                                       gint             position);
-  gboolean (*size_changed)            (XfcePanelPlugin *plugin,
-                                       gint             size);
-  void     (*orientation_changed)     (XfcePanelPlugin *plugin,
-                                       GtkOrientation   orientation);
-  void     (*free_data)               (XfcePanelPlugin *plugin);
-  void     (*save)                    (XfcePanelPlugin *plugin);
-  void     (*about)                   (XfcePanelPlugin *plugin);
-  void     (*configure_plugin)        (XfcePanelPlugin *plugin);
-  void     (*removed)                 (XfcePanelPlugin *plugin);
+  void     (*screen_position_changed) (XfcePanelPlugin    *plugin,
+                                       XfceScreenPosition  position);
+  gboolean (*size_changed)            (XfcePanelPlugin    *plugin,
+                                       gint                size);
+  void     (*orientation_changed)     (XfcePanelPlugin    *plugin,
+                                       GtkOrientation      orientation);
+  void     (*free_data)               (XfcePanelPlugin    *plugin);
+  void     (*save)                    (XfcePanelPlugin    *plugin);
+  void     (*about)                   (XfcePanelPlugin    *plugin);
+  void     (*configure_plugin)        (XfcePanelPlugin    *plugin);
+  void     (*removed)                 (XfcePanelPlugin    *plugin);
 
   /*< private >*/
   void (*reserved1) (void);



More information about the Xfce4-commits mailing list