Re: ... bumping minimum GTK+ to 2.24 (?)



Am 29.05.2011 10:15, schrieb Christopher Roy Bratusek:
Hi all,

as you maybe already noticed, I'm currently updating the widgets in the misc-1.9 branch ('file, 'font at the moment). While heading over to 'frame-style widget, I noticed, it would be best to use GtkComboBoxText widget. But: this widget requires GTK+ 2.24. Now I wanted to know whether bumping requirement for Sawfish 1.9 and rep-gtk 0.90.7/8 to that version. All distros I've checked ship that version, except Debian/Stable, which ships 2.20 (...).

Chris

Attached is a patch to implement the widget in rep-gtk, with example added (deprecated GtkComboBoxEntry dropped).

Chris
diff --git a/examples/hello.jl b/examples/hello.jl
index acd3468..2b91029 100755
--- a/examples/hello.jl
+++ b/examples/hello.jl
@@ -12,13 +12,28 @@ exec rep --batch "$0" "$@"
 
   (define window (gtk-window-new 'toplevel))
 
-  (define button (gtk-scale-button-new 'menu 0 100 0.5 '("gtk-ok" "" "undo")))
+  ;; example for GtkScaleButton                             = 0%     = 100%   = 1% - 99%
+  ;;(define button (gtk-scale-button-new 'menu 0 100 0.5 '("gtk-no" "gtk-yes" "gtk-refresh")))
+
+  ;; example for GtkComboBoxText
+  (define button (gtk-combo-box-text-new-with-entry))
+  (mapc (lambda (x) (gtk-combo-box-text-append-text button x)) '("111" "222" "333"))
+
+  (define label (gtk-label-new "The selection is shown here"))
+  (define box (gtk-vbox-new nil 0))
+
+  (g-signal-connect button "changed" (lambda ()
+				       (gtk-label-set-text label (gtk-combo-box-text-get-active-text button))))
 
   (gtk-container-set-border-width window 10)
 
   (g-signal-connect window "delete_event" (lambda (w) (throw 'quit 0)))
 
-  (gtk-container-add window button)
+  (gtk-container-add window box)
+
+  (gtk-box-pack-start box label)
+  (gtk-box-pack-start box button)
+
   (gtk-widget-show-all window)
 
   (setq interrupt-mode 'exit)
diff --git a/gtkcombobox.defs b/gtkcombobox.defs
index e702028..3ed138d 100644
--- a/gtkcombobox.defs
+++ b/gtkcombobox.defs
@@ -119,24 +119,34 @@
   static_string
   ((GtkComboBox box)))
 
-;; GtkComboBoxEntry
+;; GtkComboBoxText
 
-(define-object GtkComboBoxEntry (GObject))
+(define-object GtkComboBoxText (GObject))
 
-(define-func gtk_combo_box_entry_new
+(define-func gtk_combo_box_text_new
   GtkWidget
   ())
 
-(define-func gtk_combo_box_entry_new_with_model
+(define-func gtk_combo_box_text_new_with_entry
   GtkWidget
-  ((GtkTreeModel model)
-   (int column)))
+  ())
 
-(define-func gtk_combo_box_entry_set_text_column
+(define-func gtk_combo_box_text_append_text
   none
-  ((GtkComboBoxEntry box)
-   (int column)))
+  ((GtkComboBoxText combo)
+   (string text)))
 
-(define-func gtk_combo_box_entry_get_text_column
-  int
-  ((GtkComboBoxEntry box)))
+(define-func gtk_combo_box_text_insert_text
+  none
+  ((GtkComboBoxText combo)
+   (int position)
+   ((tvec string in) text)))
+
+(define-func gtk_combo_box_text_prepend_text
+  none
+  ((GtkComboBoxText combo)
+   ((tvec string in) text)))
+
+(define-func gtk_combo_box_text_get_active_text
+  string
+  ((GtkComboBoxText combo)))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]