[gtk+/gtk-2-90: 104/146] Use GtkComboBox in the property editor code



commit 7deaa5befb5943463da4c66dca319c83a88f603f
Author: Christian Dywan <christian twotoasts de>
Date:   Fri Oct 16 16:58:34 2009 +0200

    Use GtkComboBox in the property editor code

 tests/prop-editor.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index dd44149..3d9f7dc 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -396,7 +396,7 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
 
 
 static void
-enum_modified (GtkOptionMenu *om, gpointer data)
+enum_modified (GtkComboBox *om, gpointer data)
 {
   ObjectProperty *p = data;
   gint i;
@@ -404,7 +404,7 @@ enum_modified (GtkOptionMenu *om, gpointer data)
   
   eclass = G_ENUM_CLASS (g_type_class_peek (p->spec->value_type));
   
-  i = gtk_option_menu_get_history (om);
+  i = gtk_combo_box_get_active (om);
   
   if (is_child_property (p->spec))
     {
@@ -421,7 +421,7 @@ enum_modified (GtkOptionMenu *om, gpointer data)
 static void
 enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
 {
-  GtkOptionMenu *om = GTK_OPTION_MENU (data);
+  GtkComboBox *om = GTK_COMBO_BOX (data);
   GValue val = { 0, };  
   GEnumClass *eclass;
   gint i;
@@ -439,10 +439,10 @@ enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
       ++i;
     }
   
-  if (gtk_option_menu_get_history (om) != i)
+  if (gtk_combo_box_get_active (om) != i)
     {
       block_controller (G_OBJECT (om));
-      gtk_option_menu_set_history (om, i);
+      gtk_combo_box_set_active (om, i);
       unblock_controller (G_OBJECT (om));
     }
   
@@ -774,34 +774,23 @@ property_widget (GObject    *object,
   else if (type == G_TYPE_PARAM_ENUM)
     {
       {
-	GtkWidget *menu;
 	GEnumClass *eclass;
 	gint j;
 	
-	prop_edit = gtk_option_menu_new ();
-	
-	menu = gtk_menu_new ();
+	prop_edit = gtk_combo_box_new_text ();
 	
 	eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
 	
 	j = 0;
 	while (j < eclass->n_values)
 	  {
-	    GtkWidget *mi;
-	    
-	    mi = gtk_menu_item_new_with_label (eclass->values[j].value_name);
-	    
-	    gtk_widget_show (mi);
-	    
-	    gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+	    gtk_combo_box_append_text (GTK_COMBO_BOX (prop_edit), eclass->values[j].value_name);
 	    
 	    ++j;
 	  }
 	
 	g_type_class_unref (eclass);
 	
-	gtk_option_menu_set_menu (GTK_OPTION_MENU (prop_edit), menu);
-	
 	g_object_connect_property (object, spec,
 				   G_CALLBACK (enum_changed),
 				   prop_edit, G_OBJECT (prop_edit));



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