[tests] Not use GtkOptionMenu deprecate widget.
Replace GtkOptionMenu with GtkComboBox. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=606288
This commit is contained in:
		@ -19,7 +19,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef GTK_DISABLE_DEPRECATED
 | 
					 | 
				
			||||||
#include <gtk/gtk.h>
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "prop-editor.h"
 | 
					#include "prop-editor.h"
 | 
				
			||||||
@ -396,16 +395,16 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
enum_modified (GtkOptionMenu *om, gpointer data)
 | 
					enum_modified (GtkComboBox *cb, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ObjectProperty *p = data;
 | 
					  ObjectProperty *p = data;
 | 
				
			||||||
  gint i;
 | 
					  gint i;
 | 
				
			||||||
  GEnumClass *eclass;
 | 
					  GEnumClass *eclass;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  eclass = G_ENUM_CLASS (g_type_class_peek (p->spec->value_type));
 | 
					  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 (cb);
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  if (is_child_property (p->spec))
 | 
					  if (is_child_property (p->spec))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      GtkWidget *widget = GTK_WIDGET (p->obj);
 | 
					      GtkWidget *widget = GTK_WIDGET (p->obj);
 | 
				
			||||||
@ -421,7 +420,7 @@ enum_modified (GtkOptionMenu *om, gpointer data)
 | 
				
			|||||||
static void
 | 
					static void
 | 
				
			||||||
enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
 | 
					enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  GtkOptionMenu *om = GTK_OPTION_MENU (data);
 | 
					  GtkComboBox *cb = GTK_COMBO_BOX (data);
 | 
				
			||||||
  GValue val = { 0, };  
 | 
					  GValue val = { 0, };  
 | 
				
			||||||
  GEnumClass *eclass;
 | 
					  GEnumClass *eclass;
 | 
				
			||||||
  gint i;
 | 
					  gint i;
 | 
				
			||||||
@ -439,11 +438,11 @@ enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
 | 
				
			|||||||
      ++i;
 | 
					      ++i;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (gtk_option_menu_get_history (om) != i)
 | 
					  if (gtk_combo_box_get_active (cb) != i)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      block_controller (G_OBJECT (om));
 | 
					      block_controller (G_OBJECT (cb));
 | 
				
			||||||
      gtk_option_menu_set_history (om, i);
 | 
					      gtk_combo_box_set_active (cb, i);
 | 
				
			||||||
      unblock_controller (G_OBJECT (om));
 | 
					      unblock_controller (G_OBJECT (cb));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  g_value_unset (&val);
 | 
					  g_value_unset (&val);
 | 
				
			||||||
@ -820,34 +819,23 @@ property_widget (GObject    *object,
 | 
				
			|||||||
  else if (type == G_TYPE_PARAM_ENUM)
 | 
					  else if (type == G_TYPE_PARAM_ENUM)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
	GtkWidget *menu;
 | 
					 | 
				
			||||||
	GEnumClass *eclass;
 | 
						GEnumClass *eclass;
 | 
				
			||||||
	gint j;
 | 
						gint j;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	prop_edit = gtk_option_menu_new ();
 | 
						prop_edit = gtk_combo_box_new_text ();
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	menu = gtk_menu_new ();
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
 | 
						eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	j = 0;
 | 
						j = 0;
 | 
				
			||||||
	while (j < eclass->n_values)
 | 
						while (j < eclass->n_values)
 | 
				
			||||||
	  {
 | 
						  {
 | 
				
			||||||
	    GtkWidget *mi;
 | 
						    gtk_combo_box_append_text (GTK_COMBO_BOX (prop_edit),
 | 
				
			||||||
	    
 | 
						                               eclass->values[j].value_name);
 | 
				
			||||||
	    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);
 | 
					 | 
				
			||||||
	    
 | 
					 | 
				
			||||||
	    ++j;
 | 
						    ++j;
 | 
				
			||||||
	  }
 | 
						  }
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	g_type_class_unref (eclass);
 | 
						g_type_class_unref (eclass);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	gtk_option_menu_set_menu (GTK_OPTION_MENU (prop_edit), menu);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	g_object_connect_property (object, spec,
 | 
						g_object_connect_property (object, spec,
 | 
				
			||||||
				   G_CALLBACK (enum_changed),
 | 
									   G_CALLBACK (enum_changed),
 | 
				
			||||||
				   prop_edit, G_OBJECT (prop_edit));
 | 
									   prop_edit, G_OBJECT (prop_edit));
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user