[Xfce4-commits] r30412 - in xfc/trunk: . debian libXFCcore/xfc/glib libXFCde/xfc libXFCde/xfc/panel libXFCde/xfc/panel/inline libXFCde/xfc/ui libXFCde/xfc/ui/inline libXFCde/xfc/utils libXFCde/xfc/utils/inline

Bo Lorentsen bl at xfce.org
Tue Jul 28 23:11:53 CEST 2009


Author: bl
Date: 2009-07-28 21:11:52 +0000 (Tue, 28 Jul 2009)
New Revision: 30412

Added:
   xfc/trunk/libXFCde/xfc/panel/inline/
   xfc/trunk/libXFCde/xfc/panel/inline/Makefile.am
   xfc/trunk/libXFCde/xfc/panel/inline/plugin.inl
   xfc/trunk/libXFCde/xfc/panel/plugin.cc
   xfc/trunk/libXFCde/xfc/panel/plugin.hh
   xfc/trunk/libXFCde/xfc/ui/dialog.cc
   xfc/trunk/libXFCde/xfc/ui/dialog.hh
   xfc/trunk/libXFCde/xfc/ui/inline/
   xfc/trunk/libXFCde/xfc/ui/inline/Makefile.am
   xfc/trunk/libXFCde/xfc/ui/inline/dialog.inl
   xfc/trunk/libXFCde/xfc/utils/inline/
   xfc/trunk/libXFCde/xfc/utils/inline/Makefile.am
   xfc/trunk/libXFCde/xfc/utils/inline/config.inl
Modified:
   xfc/trunk/ChangeLog
   xfc/trunk/configure.ac
   xfc/trunk/debian/control
   xfc/trunk/debian/rules
   xfc/trunk/libXFCcore/xfc/glib/error.cc
   xfc/trunk/libXFCcore/xfc/glib/error.hh
   xfc/trunk/libXFCde/xfc/Makefile.am
   xfc/trunk/libXFCde/xfc/panel/Makefile.am
   xfc/trunk/libXFCde/xfc/ui/Makefile.am
   xfc/trunk/libXFCde/xfc/utils/Makefile.am
   xfc/trunk/libXFCde/xfc/utils/config.cc
   xfc/trunk/libXFCde/xfc/utils/config.hh
Log:
XFCde + xfconf client

Modified: xfc/trunk/ChangeLog
===================================================================
--- xfc/trunk/ChangeLog	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/ChangeLog	2009-07-28 21:11:52 UTC (rev 30412)
@@ -1,3 +1,10 @@
+2009-07.28 23:11  bl
+
+   * add basic build structure for libXFCde as panel, utils and ui
+   * basic xfconf client works 
+   * outline for new panel code 
+   * xfcde debian packet added
+
 2009-06-28 23:21  bl
 
    * PageSetup code added

Modified: xfc/trunk/configure.ac
===================================================================
--- xfc/trunk/configure.ac	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/configure.ac	2009-07-28 21:11:52 UTC (rev 30412)
@@ -130,7 +130,7 @@
 
 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--disable-debug], [do not produce debugging information])],, [enable_debug=yes])
 if test "x$enable_debug" = "xyes"; then
-  CXXFLAGS="-g -O2"  
+  CXXFLAGS="-g -O0"  
 else
   CXXFLAGS="-O2"
 fi
@@ -397,8 +397,11 @@
           libXFCde/xfcde-4.3.pc \
           libXFCde/xfc/Makefile \
           libXFCde/xfc/utils/Makefile \
+          libXFCde/xfc/utils/inline/Makefile \
           libXFCde/xfc/panel/Makefile \
+          libXFCde/xfc/panel/inline/Makefile \
           libXFCde/xfc/ui/Makefile \
+          libXFCde/xfc/ui/inline/Makefile \
 	  demos/Makefile \
 	  demos/xfc-demo/Makefile \
 	  examples/Makefile \

Modified: xfc/trunk/debian/control
===================================================================
--- xfc/trunk/debian/control	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/debian/control	2009-07-28 21:11:52 UTC (rev 30412)
@@ -64,14 +64,14 @@
 Package: libxfcde-dev
 Section: libdevel
 Architecture: any
-Depends: libxfconf-0-dev (>= 4.6.0), libxfccore (= ${Source-Version}), xfce4-util-dev (>= 4.6.0), libxfce4-panel-dev (>= 4.6.0), libxfconf-0-dev (>= 4.6.0)
+Depends: libxfconf-0-dev (>= 4.6.0), libxfccore (= ${Source-Version}), libxfce4util-dev (>= 4.6.0), xfce4-panel-dev (>= 4.6.0)
 Description: Xfce4 desktop environment development files
  Xfce desktop environment development files
 
 Package: libxfcde
 Section: libs
 Architecture: any
-Depends: libxfccore (=${Source-Version}), xfce4-util (>= 4.6.0), libxfce4-panel (>= 4.6.0), libxfconf-0-2 (>= 4.6.0)
+Depends: libxfccore (=${Source-Version}), libxfce4util4 (>= 4.6.0), xfce4-panel (>= 4.6.0), libxfconf-0-2 (>= 4.6.0)
 Description: Xfce4 desktop environment
  Xfce4 desktop environment code
 

Modified: xfc/trunk/debian/rules
===================================================================
--- xfc/trunk/debian/rules	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/debian/rules	2009-07-28 21:11:52 UTC (rev 30412)
@@ -14,10 +14,10 @@
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
-CFLAGS = -Wall -g
+CFLAGS = -Wall
 
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0 -g
 else
 	CFLAGS += -O2
 endif

Modified: xfc/trunk/libXFCcore/xfc/glib/error.cc
===================================================================
--- xfc/trunk/libXFCcore/xfc/glib/error.cc	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCcore/xfc/glib/error.cc	2009-07-28 21:11:52 UTC (rev 30412)
@@ -37,11 +37,11 @@
 
 } // namespace
 
-G::Error::Error()
+G::Error::Error() throw() : error_(0)
 {
 }
 
-G::Error::Error(GQuark domain, int code, const char *format, ...)
+G::Error::Error(GQuark domain, int code, const char *format, ...) throw()
 : error_(0)
 {
 	g_return_if_fail(format != 0);
@@ -52,17 +52,17 @@
 	va_end(args);
 }
 
-G::Error::Error(GQuark domain, int code, const String& message)
+G::Error::Error(GQuark domain, int code, const String& message) throw()
 : error_(g_error_new_literal(domain, code, message.c_str()))
 {
 }
 
-G::Error::Error(GError *error)
+G::Error::Error(GError *error) throw()
 : error_(g_error_copy(error))
 {
 }
 
-G::Error::Error(const Error& src)
+G::Error::Error(const Error& src) throw()
 : error_(g_error_copy(src.error_))
 {
 }
@@ -125,6 +125,5 @@
 
 const char * G::Error::what( void ) const throw()
 {
-    return error_->message;
+    return (error_) ? error_->message : "Undefined error";
 }
-

Modified: xfc/trunk/libXFCcore/xfc/glib/error.hh
===================================================================
--- xfc/trunk/libXFCcore/xfc/glib/error.hh	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCcore/xfc/glib/error.hh	2009-07-28 21:11:52 UTC (rev 30412)
@@ -96,17 +96,17 @@
 /// @name Constructors
 /// @{
 
-	Error();
+	Error() throw();
 	///< Create a properly initialized error object.
 
-	Error(GQuark domain, int code, const char *format, ...);
+	Error(GQuark domain, int code, const char *format, ...) throw();
 	///< Create a new error object with the given domain and code, and a message formatted with format.
 	///< @param domain The error domain.
 	///< @param code The error code.
 	///< @param format Parameters for message format.
 	///< @param ... Arguments to format.
 
-	Error(GQuark domain, int code, const String& message);
+	Error(GQuark domain, int code, const String& message) throw();
 	///< Create a new error object with the given domain, code, and message.
 	///< @param domain The error domain.
 	///< @param code The error code.
@@ -116,10 +116,10 @@
 	///< this constructor if message contains text you don't have control over, that could include
 	///< printf() escape sequences.
 
-	Error(GError *error);
+	Error(GError *error) throw();
 	///< Create an Error from an existing GError*. Used by XFC for error reporting.
 
-	Error(const Error& src);
+	Error(const Error& src) throw();
 	///< Copy constructor.
 
 	virtual ~Error() throw();
@@ -184,7 +184,7 @@
 	///< Frees the associated GError object and sets the internal error pointer to null.
 
     /// std C++ exception, that just return the human readable message part
-    const char *what( void ) const throw();
+    virtual const char *what( void ) const throw();
     
 /// @}
 };

Modified: xfc/trunk/libXFCde/xfc/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/Makefile.am	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -1,4 +1,4 @@
-## libXFCsourceview source directory
+## libXFCde source directory
 
 SUBDIRS = utils ui panel
 
@@ -7,6 +7,6 @@
 lib_LTLIBRARIES = libXFCde-4.3.la
 
 libXFCde_4_3_la_SOURCES= 
-libXFCde_4_3_la_LIBADD= $(XFC_DE_UTIL_LIBS) $(XFC_DE_CONF_LIBS) $(XFC_DE_PANEL_LIBS) $(XFC_DE_UI_LIBS)
+libXFCde_4_3_la_LIBADD= utils/libutils.la panel/libpanel.la ui/libui.la $(XFC_DE_UTIL_LIBS) $(XFC_DE_CONF_LIBS) $(XFC_DE_PANEL_LIBS) $(XFC_DE_UI_LIBS)
 libXFCde_4_3_la_LDFLAGS= -version-info $(XFC_LIBRARY_VERSION)
 

Modified: xfc/trunk/libXFCde/xfc/panel/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/panel/Makefile.am	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/panel/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,17 @@
+SUBDIRS = inline
+
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_DE_CONF_CFLAGS@ @XFC_DE_PANEL_CFLAGS@
+
+hh_sources =\
+ plugin.hh
+
+cc_sources =\
+ plugin.cc
+
+library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/panel
+library_include_HEADERS = $(hh_sources)
+
+INCLUDES = -I$(top_builddir)/libXFCde -I$(top_builddir)/libXFCcore 
+
+noinst_LTLIBRARIES= libpanel.la
+libpanel_la_SOURCES= $(hh_sources) $(cc_sources)

Added: xfc/trunk/libXFCde/xfc/panel/inline/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/panel/inline/Makefile.am	                        (rev 0)
+++ xfc/trunk/libXFCde/xfc/panel/inline/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,7 @@
+inline_sources = plugin.inl
+
+library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/panel
+
+inline_includedir = $(library_includedir)/inline
+inline_include_HEADERS = $(inline_sources)
+

Added: xfc/trunk/libXFCde/xfc/panel/plugin.hh
===================================================================
--- xfc/trunk/libXFCde/xfc/panel/plugin.hh	                        (rev 0)
+++ xfc/trunk/libXFCde/xfc/panel/plugin.hh	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,195 @@
+/*
+    Define the PanelPlugin interface that is the common class for both
+    the internal and external interface.
+*/
+#ifndef XFC_DE_PANEL_HH
+#define XFC_DE_PANEL_HH
+
+#ifndef XFC_G_PROPERTY_HH
+#include <xfc/glib/property.hh>
+#endif
+
+#ifndef __XFCE_PANEL_PLUGIN_IFACE_H__
+#include <libxfce4panel/xfce-panel-plugin-iface.h>
+#endif
+
+namespace Xfc {
+    namespace De {
+        enum ScreenPosition {
+            NONE = XFCE_SCREEN_POSITION_NONE,
+
+            NW_H = XFCE_SCREEN_POSITION_NW_H,          /* North West Horizontal */
+            N    = XFCE_SCREEN_POSITION_N,             /* North                 */
+            NE_H = XFCE_SCREEN_POSITION_NE_H,          /* North East Horizontal */
+
+            NW_V = XFCE_SCREEN_POSITION_NW_V,          /* North West Vertical   */
+            W    = XFCE_SCREEN_POSITION_W,             /* West                  */
+            SW_V = XFCE_SCREEN_POSITION_SW_V,          /* South West Vertical   */
+
+            NE_V = XFCE_SCREEN_POSITION_NE_V,          /* North East Vertical   */
+            E    = XFCE_SCREEN_POSITION_E,             /* East                  */
+            SE_V = XFCE_SCREEN_POSITION_SE_V,          /* South East Vertical   */
+
+            SW_H = XFCE_SCREEN_POSITION_SW_H,          /* South West Horizontal */
+            S    = XFCE_SCREEN_POSITION_S,             /* South                 */
+            SE_H = XFCE_SCREEN_POSITION_SE_H,          /* South East Horizontal */
+
+            FLOATING_H = XFCE_SCREEN_POSITION_FLOATING_H,    /* Floating Horizontal */
+            FLOATING_V = XFCE_SCREEN_POSITION_FLOATING_V     /* Floating Vertical */
+        };
+        
+        class PanelPlugin : public G::TypeInterface {
+        protected:
+/// @name Constructors
+/// @{
+
+            explicit PanelPlugin( XfcePanelPlugin *panel, bool owns_reference = false );
+
+/// @}
+/// @name Signal Prototypes
+/// @{
+
+            // "about"                                          : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void> AboutSignalType;
+            typedef G::SignalProxy<G::TypeInstance, AboutSignalType> AboutSignalProxy;
+            static const AboutSignalType about_signal;
+            
+            //  "configure-plugin"                               : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void> ConfigurePluginSignalType;
+            typedef G::SignalProxy<G::TypeInstance, ConfigurePluginSignalType> ConfigurePluginSignalProxy;
+            static const ConfigurePluginSignalType configure_plugin_signal;
+
+            // "free-data"                                      : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void> FreeDataSignalType;
+            typedef G::SignalProxy<G::TypeInstance, FreeDataSignalType> FreeDataSignalProxy;
+            static const FreeDataSignalType free_data_signal;
+
+            // "orientation-changed"                            : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void, Gtk::Orientation> OrientationChangedSignalType;
+            typedef G::SignalProxy<G::TypeInstance, OrientationChangedSignalType> OrientationChangedSignalProxy;
+            static const OrientationChangedSignalType orientation_changed_signal;
+
+            //  "save"                                           : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void> SaveSignalType;
+            typedef G::SignalProxy<G::TypeInstance, SaveSignalType> SaveSignalProxy;
+            static const SaveSignalType save_signal;
+
+            //  "screen-position-changed"                        : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void, ScreenPosition> ScreenPositionChangedSignalType;
+            typedef G::SignalProxy<G::TypeInstance, ScreenPositionChangedSignalType> ScreenPositionChangedSignalProxy;
+            static const ScreenPositionChangedSignalType screen_position_changed_signal;
+
+            //  "size-changed"                                   : Run Last / No Recursion / No Hooks
+            typedef G::Signal<void> SizeChangedSignalType;
+            typedef G::SignalProxy<G::TypeInstance, SizeChangedSignalType> SizeChangedSignalProxy;
+            static const SizeChangedSignalType size_changed_signal;
+            };
+
+/// @}
+/// @name Property Prototypes
+/// @{
+    
+            // "display-name"             gchar*                : Read
+            typedef G::ReadableProperty<gchar*> DisplayNamePropertyType;
+            typedef G::PropertyProxy<G::Object, DisplayNamePropertyType> DisplayNamePropertyProxy;
+            static const DisplayNamePropertyType display_name_property;
+
+            // "expand"                   gboolean              : Read / Write
+            typedef G::Property<gboolean> ExpandPropertyType;
+            typedef G::PropertyProxy<G::Object, ExpandPropertyType> ExpandPropertyProxy;
+            static const ExpandPropertyType expand_property;
+             
+            //  "id"                       gchar*                : Read
+            typedef G::ReadableProperty<gchar*> IdPropertyType;
+            typedef G::PropertyProxy<G::Object, IdPropertyType> IdPropertyProxy;
+            static const idPropertyType id_property;
+            
+            //  "name"                     gchar*                : Read
+            typedef G::ReadableProperty<gchar*> NamePropertyType;
+            typedef G::PropertyProxy<G::Object, NamePropertyType> NamePropertyProxy;
+            static const NamePropertyType name_property;
+
+            //  "screen-position"          XfceScreenPosition    : Read
+            typedef G::ReadableProperty<XfceScreenPosition> ScreenPositionPropertyType;
+            typedef G::PropertyProxy<G::Object, NamePropertyType> ScreenPositionPropertyProxy;
+            static const ScreenPositionPropertyType screen_position_property;
+
+            //  "size"                     gint                  : Read
+            typedef G::ReadableProperty<gint> SizePropertyType;
+            typedef G::PropertyProxy<G::Object, SizePropertyType> SizePropertyProxy;
+            static const SizePropertyType size_property;
+
+        public:
+
+/// @}
+/// @name Accessors
+/// @{
+
+            XfcePanelPlugin *xfce_panel_plugin() const;
+            operator XfcePanelPlugin *() const;
+
+            String get_name() const;
+            String get_id() const;
+            String get_display_name() const;
+            int get_size() const;
+            ScreenPosition get_screen_position() const;
+            bool get_expand() const;
+            Gtk::Orientation get_orientation() const;
+            String lookup_rc_file() const;
+
+/// @}
+/// @name Methods
+/// @{
+        
+            void set_expand(bool expand);
+            void add_action_widget(Gtk::Widget *widget);
+            void menu_insert_item(Gtk::MenuItem *item);
+            void menu_show_about();
+            void menu_show_configure();
+            void block_menu();
+            void unblock_menu();
+            void register_menu(Gtk::Menu *menu);
+            String save_location(bool create);
+            void focus_widget(Gtk::Widget *widget);
+            void set_panel_hidden(bool hidden);
+
+/// @}
+/// @name Property Proxies
+/// @{
+
+            const DisplayNamePropertyProxy property_display_name();
+            
+            ExpandPropertyProxy property_expand();
+
+            const IdPropertyProxy property_id();
+
+            const NamePropertyProxy property_name();
+
+            const ScreenPositionPropertyProxy property_screen_position();
+
+            const SizePropertyProxy property_size();
+            
+/// @}
+/// @name Signal Proxies
+/// @{
+            
+            AboutSignalProxy signal_about();
+            
+            ConfigurePluginSignalProxy signal_configure_plugin();
+            
+            FreeDataSignalProxy signal_free_data();
+            
+            OrientationChangedSignalProxy signal_orientation_changed();
+            
+            SaveSignalProxy signal_save();
+            
+            ScreenPositionChangedSignalProxy signal_screen_position_changed();
+            
+            SizeChangedSignalProxy signal_size_changed();
+/// @}
+    } // namespace De
+} // namespace Xfc
+
+#include <xfc/de/panel/inline/panel.inl>
+
+#endif // XFC_DE_PANEL_HH

Modified: xfc/trunk/libXFCde/xfc/ui/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/ui/Makefile.am	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/ui/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,17 @@
+SUBDIRS = inline
+
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_DE_UI_CFLAGS@
+
+hh_sources =\
+ dialog.hh
+
+cc_sources =\
+ dialog.cc
+
+library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/ui
+library_include_HEADERS = $(hh_sources)
+
+INCLUDES = -I$(top_builddir)/libXFCde -I$(top_builddir)/libXFCcore -I$(top_builddir)/libXFCui
+
+noinst_LTLIBRARIES= libui.la
+libui_la_SOURCES= $(hh_sources) $(cc_sources)

Added: xfc/trunk/libXFCde/xfc/ui/inline/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/ui/inline/Makefile.am	                        (rev 0)
+++ xfc/trunk/libXFCde/xfc/ui/inline/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,7 @@
+inline_sources = dialog.inl
+
+library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/ui
+
+inline_includedir = $(library_includedir)/inline
+inline_include_HEADERS = $(inline_sources)
+

Modified: xfc/trunk/libXFCde/xfc/utils/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/utils/Makefile.am	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/utils/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -1,4 +1,4 @@
-#SUBDIRS = private
+SUBDIRS = inline
 
 AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_DE_CONF_CFLAGS@ @XFC_DE_UTIL_CFLAGS@
 
@@ -11,9 +11,8 @@
 library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/utils
 library_include_HEADERS = $(hh_sources)
 
-INCLUDES = -I$(top_builddir)/libXFCde \
-     -I$(top_builddir)/libXFCcore 
+INCLUDES = -I$(top_builddir)/libXFCde -I$(top_builddir)/libXFCcore 
 
-noinst_LTLIBRARIES= libde.la
-libde_la_SOURCES= $(hh_sources) $(cc_sources)
+noinst_LTLIBRARIES= libutils.la
+libutils_la_SOURCES= $(hh_sources) $(cc_sources)
 

Modified: xfc/trunk/libXFCde/xfc/utils/config.cc
===================================================================
--- xfc/trunk/libXFCde/xfc/utils/config.cc	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/utils/config.cc	2009-07-28 21:11:52 UTC (rev 30412)
@@ -11,34 +11,35 @@
 namespace Xfc {
     namespace De {
 
-        Config::Config( const String &ch_name, bool no_create )
+        XfconfInit::XfconfInit()
         {
             G::Error error;
             
             if( !xfconf_init( error ))
                 throw error;
-            
-            _channel = xfconf_channel_get( ch_name.c_str() );
+        }
 
-            if( _channel == NULL )
-                _channel = xfconf_channel_new( ch_name.c_str() );
-        }
-        
-        Config::~Config()
+        XfconfInit::~XfconfInit()
         {
             xfconf_shutdown(); // xconf takes care of refcounting !
         }
 
+        Config::Config( XfconfChannel *channel, bool owns_reference ) : G::Object((GObject *)channel, owns_reference ) {}
+
+        Config::Config( const String &ch_name ) : G::Object((GObject *)xfconf_channel_get( ch_name.c_str()), false) {}
+        
+        Config::~Config() {}
+
         bool Config::set( const String &property, const G::Value &val )
         {
-            return xfconf_channel_set_property( _channel, property.c_str(), val );
+            return xfconf_channel_set_property( xfconfchannel(), property.c_str(), val );
         }
         
         G::Value Config::get( const String &property ) const
         {
             G::Value val;
             
-            if( xfconf_channel_get_property( _channel, property.c_str(), val ))
+            if( xfconf_channel_get_property( xfconfchannel(), property.c_str(), val ))
                 return val;
 
             ostringstream os;
@@ -49,17 +50,17 @@
 
         bool Config::has_a( const String &property ) const
         {
-            return xfconf_channel_has_property( _channel, property.c_str() );
+            return xfconf_channel_has_property( xfconfchannel(), property.c_str() );
         }
         
         void Config::reset( const String &property, const String &property_base, bool recursive )
         {
-            xfconf_channel_reset_property( _channel, property_base.c_str(), recursive );
+            xfconf_channel_reset_property( xfconfchannel(), property_base.c_str(), recursive );
         }
         
         bool Config::is_locked( const String &property ) const
         {
-            return xfconf_channel_is_property_locked( _channel, property.c_str() );
+            return xfconf_channel_is_property_locked( xfconfchannel(), property.c_str() );
         }
 
     }

Modified: xfc/trunk/libXFCde/xfc/utils/config.hh
===================================================================
--- xfc/trunk/libXFCde/xfc/utils/config.hh	2009-07-28 20:04:54 UTC (rev 30411)
+++ xfc/trunk/libXFCde/xfc/utils/config.hh	2009-07-28 21:11:52 UTC (rev 30412)
@@ -1,32 +1,132 @@
+/*
+    An application-defined domain for storing configuration settings
+*/
+
+#ifndef XFC_DE_CONFIG_HH
+#define XFC_DE_CONFIG_HH
+
+#ifndef XFC_G_PROPERTY_HH
+#include <xfc/glib/property.hh>
+#endif
+
+#ifndef XFC_G_OBJECT_HH
+#include <xfc/glib/object.hh>
+#endif
+
+#ifndef XFC_G_VALUE_HH
 #include <xfc/glib/value.hh>
+#endif
 
+#ifndef __XFCONF_H__
 #include <xfconf/xfconf.h>
+#endif
 
 // Needed in XFC !
 namespace Xfc {
     namespace De { // Desktop env namespace
-        class Config {
-            XfconfChannel *_channel;
+        /**
+            Special helper class to ensure xconf init to be performed when needed.
+        */
+        class XfconfInit {
+        protected:
+            XfconfInit();
+            
         public:
+            virtual ~XfconfInit();
+        };
+
+        /**
+            An Config is a representation of a restricted domain or
+            namespace that an application can define to store configuration
+            settings. This is to ensure that different applications do
+            not store configuration keys with the same names.
+        */
+        class Config : public XfconfInit, public G::Object {
+        protected:
+        
+/// @name Constructors
+/// @{
+
+            explicit Config( XfconfChannel *channel, bool owns_reference = true );
+
+/// @}            
+/// @name Property Prototypes
+/// @{
+    
+            // "channel-name"             gchar*                : Read / Write / Construct Only
+            typedef G::ReadableProperty<gchar*> ChannelNamePropertyType;
+            typedef G::PropertyProxy<G::Object, ChannelNamePropertyType> ChannelNamePropertyProxy;
+            static const ChannelNamePropertyType channel_name_property;
+            
+            // "property-base"            gchar*                : Read / Write / Construct Only
+            typedef G::ReadableProperty<gchar*> PropertyBasePropertyType;
+            typedef G::PropertyProxy<G::Object, PropertyBasePropertyType> PropertyBasePropertyProxy;
+            static const PropertyBasePropertyType property_base_property;
+
+/// @}
+/// @name Signal Prototypes
+/// @{
+
+            // "property-changed"                               : Run Last / Has Details
+            typedef G::Signal<void> PropertyChangedSignalType;
+            typedef G::SignalProxy<G::TypeInstance, PropertyChangedSignalType> PropertyChangedSignalProxy;
+            static const PropertyChangedSignalType property_changed_signal;
+
+        public:
+        
+/// @}
+/// @name Constructors
+/// @{
+        
             /**
                 Opens up a xfconf channel if it exist, and create it if
                 it down not.
             */
-            Config( const String &channel, bool no_create = false );
-            ~Config();
+            Config( const String &channel );
+            
+            virtual ~Config();
 
-            bool set( const String &property, const G::Value &val );
+/// @}
+/// @name Accessors
+/// @{
+
+            XfconfChannel *xfconfchannel() const;
+            operator XfconfChannel *() const;
+            
             G::Value get( const String &property ) const;
-
             bool has_a( const String &property ) const;
-            void reset( const String &property, const String &base_property = "/", bool recursive = true );
             bool is_locked( const String &property ) const;
-
             // Syntactic sugar
             G::Value operator[]( const String &property ) const {return get( property );}
 
+/// @}
+/// @name Methods
+/// @{
+            
+            bool set( const String &property, const G::Value &val );
+            void reset( const String &property, const String &base_property = "/", bool recursive = true );
+
+/// @}
+/// @name Property Proxies
+/// @{
+
+            const ChannelNamePropertyProxy property_channel_name();
+
+            const PropertyBasePropertyProxy property_property_base();
+
+/// @}
+/// @name Signal Proxies
+/// @{
+
+            const PropertyChangedSignalProxy signal_property_changed();
+
             // The Xfce interface has a lot of helpers but is this really needed,
             // when we have the G::Value wrapper ?
+/// @}
         };
-    }
-}
+    } // namespace De
+} // namespace Xfc
+
+#include <xfc/de/utils/inline/config.inl>
+
+#endif

Added: xfc/trunk/libXFCde/xfc/utils/inline/Makefile.am
===================================================================
--- xfc/trunk/libXFCde/xfc/utils/inline/Makefile.am	                        (rev 0)
+++ xfc/trunk/libXFCde/xfc/utils/inline/Makefile.am	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,6 @@
+inline_sources = config.inl
+
+library_includedir=$(includedir)/$(XFCEDIR)/$(XFC_LIBRARY_NAME)/de/utils
+
+inline_includedir = $(library_includedir)/inline
+inline_include_HEADERS = $(inline_sources)

Added: xfc/trunk/libXFCde/xfc/utils/inline/config.inl
===================================================================
--- xfc/trunk/libXFCde/xfc/utils/inline/config.inl	                        (rev 0)
+++ xfc/trunk/libXFCde/xfc/utils/inline/config.inl	2009-07-28 21:11:52 UTC (rev 30412)
@@ -0,0 +1,24 @@
+inline const Xfc::De::Config::ChannelNamePropertyProxy Xfc::De::Config::property_channel_name()
+{
+     return ChannelNamePropertyProxy(this, &channel_name_property);
+}
+
+inline const Xfc::De::Config::PropertyBasePropertyProxy Xfc::De::Config::property_property_base()
+{
+     return PropertyBasePropertyProxy(this, &property_base_property);
+}
+
+inline const Xfc::De::Config::PropertyChangedSignalProxy Xfc::De::Config::signal_property_changed()
+{
+    return PropertyChangedSignalProxy(this, &property_changed_signal);
+}
+
+inline XfconfChannel* Xfc::De::Config::xfconfchannel() const
+{
+	return reinterpret_cast<XfconfChannel*>(instance_);
+}
+
+inline Xfc::De::Config::operator XfconfChannel * () const
+{
+	return this ? xfconfchannel() : 0;
+}




More information about the Xfce4-commits mailing list