[Xfce4-commits] <xfc:master> add missing inl file
Bo Lorensen
noreply at xfce.org
Sun Nov 15 23:44:01 CET 2009
Updating branch refs/heads/master
to 14ea664de626e312693107f9ba560c7e218ddc35 (commit)
from 5e5cd00b3b4fba8374280b75fe765f39ae3f3c56 (commit)
commit 14ea664de626e312693107f9ba560c7e218ddc35
Author: Bo Lorensen <bl at lue.dk>
Date: Sun Nov 15 23:42:11 2009 +0100
add missing inl file
libXFCui/xfc/gtk/inline/builder.inl | 47 +++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/libXFCui/xfc/gtk/inline/builder.inl b/libXFCui/xfc/gtk/inline/builder.inl
new file mode 100644
index 0000000..3fea8b9
--- /dev/null
+++ b/libXFCui/xfc/gtk/inline/builder.inl
@@ -0,0 +1,47 @@
+inline GtkBuilder* Xfc::Gtk::Builder::gtk_builder() const
+{
+ return reinterpret_cast<GtkBuilder*>(instance_);
+}
+
+inline Xfc::Gtk::Builder::operator GtkBuilder* () const
+{
+ return this ? gtk_builder() : NULL;
+}
+
+template<typename WidgetType>
+inline bool
+Xfc::Gtk::Builder::get_widget(const String& name, WidgetType *&widget) const
+{
+ widget = 0;
+ GtkWidget *tmp_widget = GTK_WIDGET(gtk_builder_get_object(gtk_builder(), name.c_str()));
+ if (tmp_widget)
+ {
+ typedef typename WidgetType::CObjectType GtkWidgetType;
+ widget = G::Object::wrap<WidgetType>((GtkWidgetType*)tmp_widget);
+ }
+ return widget != 0;
+}
+
+template<typename DerivedType>
+inline bool
+Xfc::Gtk::Builder::get_widget_derived(const String& name, DerivedType *&widget) const
+{
+ widget = 0;
+ GtkWidget *tmp_widget = GTK_WIDGET(gtk_builder_get_object(gtk_builder(), name.c_str()));
+ if (tmp_widget)
+ {
+ G::Object *object = G::Object::pointer((GObject*)tmp_widget);
+ if (object)
+ {
+ widget = dynamic_cast<DerivedType*>(object);
+ if (!widget)
+ g_error("Wrong derived widget argument type passed for \"%s\"\n", name.c_str());
+ }
+ else
+ {
+ typedef typename DerivedType::CObjectType GtkWidgetType;
+ widget = new DerivedType((GtkWidgetType*)tmp_widget, *this);
+ }
+ }
+ return widget != 0;
+}
More information about the Xfce4-commits
mailing list