[rep-gtk: 3/12] Wrap GtkBuilder functions/objects
- From: Christopher Bratusek <chrisb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rep-gtk: 3/12] Wrap GtkBuilder functions/objects
- Date: Tue, 1 Sep 2009 17:04:04 +0000 (UTC)
commit a0714c0575af6150b4e32b160c8d957ee55f0da5
Author: Juergen Hoetzel <juergen archlinux org>
Date: Tue Aug 25 20:51:14 2009 +0200
Wrap GtkBuilder functions/objects
Implemented: gtk_builder_new, gtk_builder_add_from_file,
gtk_builder_get_object, gtk_builder_connect_signals.
GError** output arguments not handled: NULL Pointer default argument
passed.
Added simple GtkBuilder example code: examples/gtk-builder.jl
Makefile.in | 2 +-
examples/gtk-builder-test.glade | 43 +++++++++++++++++++++++++++++++++++++++
examples/gtk-builder.jl | 28 +++++++++++++++++++++++++
gtk.defs | 2 +
gtkbuilder.defs | 24 +++++++++++++++++++++
5 files changed, 98 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.in b/Makefile.in
index a61d1e9..bbd77ba 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -105,4 +105,4 @@ gtk-2 :
mkdir gtk-2
# hand-needed dependences
-gtk-glue.c : gtk.defs gtktext.defs build-gtk.jlc
+gtk-glue.c : gtk.defs gtktext.defs gtkbuilder.defs build-gtk.jlc
diff --git a/examples/gtk-builder-test.glade b/examples/gtk-builder-test.glade
new file mode 100644
index 0000000..0d3e6d4
--- /dev/null
+++ b/examples/gtk-builder-test.glade
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="window">
+ <signal name="destroy" handler="gtk_main_quit"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="button">
+ <property name="label" translatable="yes">button</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="filechooserbutton1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/examples/gtk-builder.jl b/examples/gtk-builder.jl
new file mode 100644
index 0000000..1d201bd
--- /dev/null
+++ b/examples/gtk-builder.jl
@@ -0,0 +1,28 @@
+;; gtk-builder.jl
+
+(require 'gui.gtk-2.gtk)
+
+(structure ()
+ (open rep
+ rep.system
+ gui.gtk-2.gtk)
+
+ (define builder (gtk-builder-new))
+ (gtk-builder-add-from-file builder "gtk-builder-test.glade")
+ (define window (gtk-builder-get-object builder "window"))
+ (gtk-widget-show-all window)
+
+ (g-signal-connect (gtk-builder-get-object builder "button") "pressed"
+ (lambda ()
+ (message "Button pressed")))
+
+ (gtk-builder-connect-signals builder)
+
+ (setq interrupt-mode 'exit)
+ (recursive-edit))
+
+
+
+;; Local variables:
+;; major-mode: lisp-mode
+;; End:
diff --git a/gtk.defs b/gtk.defs
index b3861be..50d33ef 100644
--- a/gtk.defs
+++ b/gtk.defs
@@ -4,6 +4,7 @@
;; GtkButton, GtkToggleButton, GtkCheckButton, GtkRadioButton, GtkFontButton
;; GtkLinkButton, GtkColorButton, GtkVolumeButton, GtkStatusIcon
+;; GtkBuilder
;; updated for gtk+ 1.3:
@@ -5175,6 +5176,7 @@
(include "gtktext.defs")
(include "gtktree.defs")
+(include "gtkbuilder.defs")
;; Options
diff --git a/gtkbuilder.defs b/gtkbuilder.defs
new file mode 100644
index 0000000..971749e
--- /dev/null
+++ b/gtkbuilder.defs
@@ -0,0 +1,24 @@
+;; -*- lisp -*-
+
+(define-object GtkBuilder (GObject))
+
+(define-func gtk_builder_new
+ GtkBuilder
+ ())
+
+(define-func gtk_builder_add_from_file
+ (int)
+ ((GtkBuilder builder)
+ (string filename)
+ ;; XXX fix this
+ (GPointer gerror (= "0"))))
+
+(define-func gtk_builder_get_object
+ (GObject)
+ ((GtkBuilder builder)
+ (string name)))
+
+(define-func gtk_builder_connect_signals
+ none
+ ((GtkBuilder builder)
+ (GPointer user_data)))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]