[Xfce4-commits] <xfc:master> builder succefully added, and does even work

Bo Lorensen noreply at xfce.org
Sun Nov 15 22:52:01 CET 2009


Updating branch refs/heads/master
         to 5e5cd00b3b4fba8374280b75fe765f39ae3f3c56 (commit)
       from d967ef4d2e0878cb1a8767e85beacf2fcb09a173 (commit)

commit 5e5cd00b3b4fba8374280b75fe765f39ae3f3c56
Author: Bo Lorensen <bl at lue.dk>
Date:   Sun Nov 15 22:51:15 2009 +0100

    builder succefully added, and does even work

 configure.ac                        |    8 +-
 debian/changelog                    |    7 ++
 debian/libxfccore-dev.install       |    2 +-
 debian/libxfcsourceview-dev.install |    2 +-
 debian/libxfcui-dev.install         |    2 +-
 examples/Makefile.fragment          |    1 -
 libXFCcore/xfc/glib/Makefile.am     |    1 +
 libXFCde/xfc/Makefile.am            |    8 +-
 libXFCde/xfc/utils/config.hh        |    2 +-
 libXFCui/xfc/gtk/Makefile.am        |    2 +
 libXFCui/xfc/gtk/builder.cc         |   60 ++++++++++++
 libXFCui/xfc/gtk/builder.hh         |  173 +++++++++++++++++++++++++++++++++++
 libXFCui/xfc/gtk/inline/Makefile.am |    1 +
 13 files changed, 257 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b3b470..190cce0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -496,9 +496,11 @@ AC_CONFIG_FILES([libXFCde/Makefile \
     libXFCde/xfc/ui/Makefile \
     libXFCde/xfc/ui/inline/Makefile])
 
-AM_COND_IF([USE_PANEL], [AC_CONFIG_FILES([
-    libXFCde/xfc/panel/Makefile \
-    libXFCde/xfc/panel/inline/Makefile])] )
+if test "x$DE_PANEL_FOUND" == "xyes"; then
+    AC_CONFIG_FILES([
+       libXFCde/xfc/panel/Makefile \
+       libXFCde/xfc/panel/inline/Makefile])
+fi
 
 AC_OUTPUT()
 
diff --git a/debian/changelog b/debian/changelog
index 9bf4394..1cecf15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xfc (4.3.2-4) unstable; urgency=low
+
+  * Added G::SList template
+  * Added Gtk::Builder class to make it possible to stop using libglade
+
+ -- Bo Lorentsen <bl at lue.dk>  Sun, 15 Nov 2009 20:12:19 +0100
+
 xfc (4.3.2-3) unstable; urgency=low
 
   * Basic printing support added
diff --git a/debian/libxfccore-dev.install b/debian/libxfccore-dev.install
index cc8cd31..e275c73 100644
--- a/debian/libxfccore-dev.install
+++ b/debian/libxfccore-dev.install
@@ -11,4 +11,4 @@ debian/tmp/usr/include/xfce4/xfc/integerobject.hh
 debian/tmp/usr/include/xfce4/xfc/glib/*.hh
 debian/tmp/usr/include/xfce4/xfc/glib/private/*.hh
 debian/tmp/usr/include/xfce4/xfc/glib/inline/*.inl
-debian/tmp/usr/lib/pkgconfig/xfccore-4.3.pc
+debian/tmp/usr/lib/pkgconfig/xfccore-*.pc
diff --git a/debian/libxfcsourceview-dev.install b/debian/libxfcsourceview-dev.install
index e02103a..7b31eff 100644
--- a/debian/libxfcsourceview-dev.install
+++ b/debian/libxfcsourceview-dev.install
@@ -1,3 +1,3 @@
 debian/tmp/usr/include/xfce4/xfc/sourceview/*.hh
 debian/tmp/usr/include/xfce4/xfc/sourceview/private/*.hh
-debian/tmp/usr/lib/pkgconfig/xfcsourceview-4.3.pc
+debian/tmp/usr/lib/pkgconfig/xfcsourceview-*.pc
diff --git a/debian/libxfcui-dev.install b/debian/libxfcui-dev.install
index 6e9b185..90fe50e 100644
--- a/debian/libxfcui-dev.install
+++ b/debian/libxfcui-dev.install
@@ -16,4 +16,4 @@ debian/tmp/usr/include/xfce4/xfc/gtk/inline/*.inl
 debian/tmp/usr/include/xfce4/xfc/pango/*.hh
 debian/tmp/usr/include/xfce4/xfc/pango/inline/*.inl
 debian/tmp/usr/include/xfce4/xfc/cairo/*.hh
-debian/tmp/usr/lib/pkgconfig/xfcui-4.3.pc
+debian/tmp/usr/lib/pkgconfig/xfcui-*.pc
diff --git a/examples/Makefile.fragment b/examples/Makefile.fragment
index f5c3e68..41b6fa1 100644
--- a/examples/Makefile.fragment
+++ b/examples/Makefile.fragment
@@ -18,4 +18,3 @@ uninstall-local:
 	    rm -f  $(DESTDIR)$(xfc_docdir)/$(subdir)/$$f; \
 	  fi; \
 	done
-	
diff --git a/libXFCcore/xfc/glib/Makefile.am b/libXFCcore/xfc/glib/Makefile.am
index b3ba1bf..33f618d 100644
--- a/libXFCcore/xfc/glib/Makefile.am
+++ b/libXFCcore/xfc/glib/Makefile.am
@@ -30,6 +30,7 @@ hh_sources = \
  scanner.hh \
  shell.hh \
  signals.hh \
+ slist.hh \
  spawn.hh \
  thread.hh \
  threadpool.hh \
diff --git a/libXFCde/xfc/Makefile.am b/libXFCde/xfc/Makefile.am
index a1d25c6..f85c861 100644
--- a/libXFCde/xfc/Makefile.am
+++ b/libXFCde/xfc/Makefile.am
@@ -11,8 +11,8 @@ libXFCde_4_3_la_LIBADD= utils/libutils.la ui/libui.la $(XFC_DE_UTIL_LIBS) $(XFC_
 libXFCde_4_3_la_LDFLAGS= -version-info $(XFC_LIBRARY_VERSION)
 
 # Panel will not work until Xfce 4.8
-if USE_PANEL
-   SUBDIRS += panel
-   libXFCde_4_3_la_LIBADD += panel/libpanel.la $(XFC_DE_PANEL_LIBS) 
-endif
+#if USE_PANEL
+#   SUBDIRS += panel
+#   libXFCde_4_3_la_LIBADD += panel/libpanel.la $(XFC_DE_PANEL_LIBS) 
+#endif
 
diff --git a/libXFCde/xfc/utils/config.hh b/libXFCde/xfc/utils/config.hh
index a7a3402..44f01f6 100644
--- a/libXFCde/xfc/utils/config.hh
+++ b/libXFCde/xfc/utils/config.hh
@@ -130,6 +130,6 @@ namespace Xfc {
     } // namespace De
 } // namespace Xfc
 
-#include <xfc/utils/inline/config.inl>
+#include <xfc/de/utils/inline/config.inl>
 
 #endif
diff --git a/libXFCui/xfc/gtk/Makefile.am b/libXFCui/xfc/gtk/Makefile.am
index dfcc739..5261d13 100755
--- a/libXFCui/xfc/gtk/Makefile.am
+++ b/libXFCui/xfc/gtk/Makefile.am
@@ -27,6 +27,7 @@ hh_sources = \
  bin.hh \
  box.hh \
  boxchild.hh \
+ builder.hh \
  button.hh \
  buttonsignals.hh \
  buttonbox.hh \
@@ -226,6 +227,7 @@ cc_sources = \
  bin.cc \
  box.cc \
  boxchild.cc \
+ builder.cc \
  button.cc \
  buttonsignals.cc \
  buttonbox.cc \
diff --git a/libXFCui/xfc/gtk/builder.cc b/libXFCui/xfc/gtk/builder.cc
index e69de29..882f2a1 100644
--- a/libXFCui/xfc/gtk/builder.cc
+++ b/libXFCui/xfc/gtk/builder.cc
@@ -0,0 +1,60 @@
+#include "builder.hh"
+
+#include <xfc/glib/error.hh>
+
+using namespace Xfc;
+
+Gtk::Builder::Builder() : G::Object((GObject *)gtk_builder_new()) // We could make a private class .. but we dont need to ... really
+{
+}
+
+Gtk::Builder::Builder( const String &filename ) : G::Object((GObject *)gtk_builder_new())
+{
+    add_from_file( filename );
+}
+
+Gtk::Builder::Builder(GtkBuilder *self, bool owns_reference ) :
+    G::Object((GObject*)self, owns_reference)
+{
+}
+
+void Gtk::Builder::add_from_file( const String &filename )
+{
+    G::Error error;
+
+    if( gtk_builder_add_from_file( gtk_builder(), filename.c_str(), error ) == 0)
+        throw error;
+}
+
+void Gtk::Builder::add_from_string( const String &buffer )
+{
+    G::Error error;
+    
+    if( gtk_builder_add_from_string( gtk_builder(), buffer.c_str(), buffer.size(), error ) == 0)
+        throw error;
+}
+
+G::Object* Gtk::Builder::get_object( const String &name ) const
+{
+     return G::Object::wrap<G::Object>( gtk_builder_get_object( gtk_builder(), name.c_str() ));
+}
+
+G::SList<GObject> Gtk::Builder::get_objects() const 
+{
+    return G::SList<GObject>( gtk_builder_get_objects( gtk_builder()));
+}
+
+void Gtk::Builder::set_translation_domain(const String &domain)
+{
+    gtk_builder_set_translation_domain( gtk_builder(), domain.c_str() );
+}
+
+String Gtk::Builder::get_translation_domain() const
+{
+    return gtk_builder_get_translation_domain( gtk_builder());
+}
+
+GType Gtk::Builder::get_type_from_name(const String &type_name) const
+{
+    return gtk_builder_get_type_from_name(gtk_builder(), type_name.c_str());
+}
diff --git a/libXFCui/xfc/gtk/builder.hh b/libXFCui/xfc/gtk/builder.hh
index 264d42a..b2136de 100644
--- a/libXFCui/xfc/gtk/builder.hh
+++ b/libXFCui/xfc/gtk/builder.hh
@@ -6,3 +6,176 @@
 
    This came in GTK version 2.12
 */
+#ifndef XFC_BUILDER_HH
+#define XFC_BUILDER_HH
+
+#ifndef XFC_G_OBJECT_HH
+#include <xfc/glib/object.hh>
+#endif
+
+#ifndef XFC_GTK_WIDGET_HH
+#include <xfc/gtk/widget.hh>
+#endif
+
+#ifndef __GTK_BUILDER_H__
+#include <gtk/gtkbuilder.h>
+#endif
+
+#ifndef XFC_SLIST_HH
+#include <xfc/glib/slist.hh>
+#endif
+
+namespace Xfc {
+namespace Gtk {
+
+/**
+    A GtkBuilder is an auxiliary object that reads textual descriptions
+    of a user interface and instantiates the described objects.
+
+    A GtkBuilder holds a reference to all objects that it has constructed
+    and drops these references when it is finalized. This finalization
+    can cause the destruction of non-widget objects or widgets which
+    are not contained in a toplevel window. For toplevel windows
+    constructed by a builder, it is the responsibility of the user to
+    call Gtk::Widget::destroy() to get rid of them and all the widgets
+    they contain.
+*/
+class Builder : public G::Object {
+public:
+    /**
+        Construct an empty builder object without any content.
+    */
+    Builder();
+
+    /**
+        Construct a new builder object and load the definition from
+        given filename.
+    */
+    Builder( const String &filename );
+
+    /**
+        Constuct a new builder from a lowlevel C GtkBuilder object.
+    */
+    explicit Builder(GtkBuilder *self, bool owns_reference = true);
+
+    GtkBuilder* gtk_builder() const;
+	
+	operator GtkBuilder* () const;
+
+    /**
+        Parses a file containing a GtkBuilder UI definition and merges
+        it with the current contents of builder.
+
+        @param filename name of the file to parse
+        @exception G::Error on some kind of error
+    */
+    void add_from_file( const String &filename );
+
+    /**
+        Parses a string containing a GtkBuilder UI definition and merges
+        it with the current contents of builder.
+
+        @param the string to parse
+        @exception G::Error on some kind of error
+    */
+    void add_from_string( const String &buffer );
+
+    /**
+        Gets the object named name. Note that this function does not
+        increment the reference count of the returned object.
+
+        @param name of the object to get (dismiss when done)
+        @return the object named name or NULL if it could not be found
+        in the object tree. 
+    */
+    G::Object* get_object( const String &name ) const;
+
+	/**
+        Gets a pointer to the Gtk::Widget corresponding to <EM>name</EM> in the interface description. 
+        @param name The name of the widget in the XML description. 
+        @return A pointer to the widget matching <EM>name</EM>, or null if none exists.
+    */
+    Gtk::Widget *get_widget( const String &name ) const;
+
+	/**
+        Gets a pointer to the Gtk::Widget corresponding to <EM>name</EM> in the interface description. 
+        @param name The name of the widget in the XML description. 
+        @param widget A reference to a pointer to hold the widget matching <EM>name</EM>, or null if none exists.
+        @return <EM>true</EM> if successful, <EM>false</EM> if no widget exists.
+	 
+        To use this method <EM>WidgetType</EM> must be one of the standard XFC widgets. 
+	
+        <B>Example:</B> Connecting a "clicked" signal handler to a Gtk::Button.
+        @code
+        Gtk::Button *button;
+        if (xml->get_widget("my_button", button))
+        {
+            button->signal_clicked().connect(sigc::mem_fun(this, &MyWindow::on_my_button_clicked));
+        }
+        @endcode    
+    */
+    template<typename WidgetType>
+        bool get_widget(const String& name, WidgetType *&widget) const;
+
+    /**
+        Gets a pointer to the Gtk::Widget corresponding to <EM>name</EM> in the interface description. 
+        @param name The name of the widget in the XML description. 
+        @param widget A reference to a pointer to hold the widget matching <EM>name</EM>, or null if none exists.
+        @return <EM>true</EM> if successful, <EM>false</EM> if no widget exists.
+        
+        To use this method <EM>DerivedType</EM> must be a user-defined widget class
+        that derives from one of the standard XFC widgets. The derived widget class
+        must declare it's constructor with the following signature:
+	        
+        <B>Example:</B> Instantiating a main application window from an XML description.
+        @code
+        MyWindow *window;
+        if (xml->get_widget_derived("MyWindow", window))
+        {
+            window->signal_destroy().connect(sigc::ptr_fun(&Xfc::Main::quit));
+            window->show();
+            run();
+        }
+        @endcode
+    */
+    template<typename DerivedType>
+        bool get_widget_derived(const String& name, DerivedType *&widget) const;
+
+    /**
+        Gets all objects that have been constructed by builder.
+
+        @note that this function does not increment the reference
+        counts of the returned objects.
+
+        @return a newly-allocated GSList containing all the objects constructed by the GtkBuilder instance. It should be freed by g_slist_free()
+    */
+    G::SList<GObject> get_objects() const;
+
+    /**
+        Sets the translation domain of builder.
+
+        @param domain the translation domain
+    */
+    void set_translation_domain(const String &domain);
+
+    /**
+        Gets the translation domain of builder
+        
+        @return the translation domain.
+    */
+    String get_translation_domain() const;
+
+    /**
+        Looks up a type by name, using the virtual function that GtkBuilder
+        has for that purpose. This is mainly used when implementing the
+        GtkBuildable interface on a type.
+    */
+    GType get_type_from_name(const String &type_name) const;
+};
+
+} // Gtk
+} // Xfc
+
+#include <xfc/gtk/inline/builder.inl>
+
+#endif
diff --git a/libXFCui/xfc/gtk/inline/Makefile.am b/libXFCui/xfc/gtk/inline/Makefile.am
index 5b9d8fd..4c4981d 100644
--- a/libXFCui/xfc/gtk/inline/Makefile.am
+++ b/libXFCui/xfc/gtk/inline/Makefile.am
@@ -16,6 +16,7 @@ inline_sources = \
  bin.inl \
  box.inl \
  boxchild.inl \
+ builder.inl \
  button.inl \
  buttonbox.inl \
  calendar.inl \



More information about the Xfce4-commits mailing list