[gimp/gtk3-port: 59/251] app: port GimpScalComboBox to GTK+ 3.0



commit b31a319dfbb8d053d86a142357a506dcc7bf745b
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 12:21:11 2010 +0200

    app: port GimpScalComboBox to GTK+ 3.0

 app/display/gimpscalecombobox.c |   14 +++++++-------
 app/display/gimpscalecombobox.h |   26 ++++++++------------------
 2 files changed, 15 insertions(+), 25 deletions(-)
---
diff --git a/app/display/gimpscalecombobox.c b/app/display/gimpscalecombobox.c
index 2529809..663674d 100644
--- a/app/display/gimpscalecombobox.c
+++ b/app/display/gimpscalecombobox.c
@@ -71,7 +71,7 @@ static void      gimp_scale_combo_box_scale_iter_set  (GtkListStore      *store,
 
 
 G_DEFINE_TYPE (GimpScaleComboBox, gimp_scale_combo_box,
-               GTK_TYPE_COMBO_BOX_ENTRY)
+               GTK_TYPE_COMBO_BOX)
 
 #define parent_class gimp_scale_combo_box_parent_class
 
@@ -130,12 +130,12 @@ gimp_scale_combo_box_init (GimpScaleComboBox *combo_box)
   gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
   g_object_unref (store);
 
-  gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (combo_box),
-                                       COLUMN_LABEL);
+  gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo_box), COLUMN_LABEL);
 
   entry = gtk_bin_get_child (GTK_BIN (combo_box));
 
   g_object_set (entry,
+                "has-entry",          TRUE,
                 "xalign",             1.0,
                 "width-chars",        7,
                 "truncate-multiline", TRUE,
@@ -338,7 +338,7 @@ gimp_scale_combo_box_entry_key_press (GtkWidget         *entry,
                                       GdkEventKey       *event,
                                       GimpScaleComboBox *combo_box)
 {
-  if (event->keyval == GDK_Escape)
+  if (event->keyval == GDK_KEY_Escape)
     {
       gimp_scale_combo_box_set_scale (combo_box, combo_box->scale);
 
@@ -347,9 +347,9 @@ gimp_scale_combo_box_entry_key_press (GtkWidget         *entry,
       return TRUE;
     }
 
-  if (event->keyval == GDK_Tab    ||
-      event->keyval == GDK_KP_Tab ||
-      event->keyval == GDK_ISO_Left_Tab)
+  if (event->keyval == GDK_KEY_Tab    ||
+      event->keyval == GDK_KEY_KP_Tab ||
+      event->keyval == GDK_KEY_ISO_Left_Tab)
     {
       gimp_scale_combo_box_entry_activate (entry, combo_box);
 
diff --git a/app/display/gimpscalecombobox.h b/app/display/gimpscalecombobox.h
index 9ab2db7..a4500d9 100644
--- a/app/display/gimpscalecombobox.h
+++ b/app/display/gimpscalecombobox.h
@@ -22,16 +22,6 @@
 #define __GIMP_SCALE_COMBO_BOX_H__
 
 
-#if GTK_CHECK_VERSION(2,23,1)
-#undef GTK_DISABLE_DEPRECATED
-#undef GTK_DISABLE_SINGLE_INCLUDES
-#undef __GTK_COMBO_BOX_ENTRY_H__
-#include <gtk/gtkcomboboxentry.h>
-#define GTK_DISABLE_SINGLE_INCLUDES
-#define GTK_DISABLE_DEPRECATED
-#endif
-
-
 #define GIMP_TYPE_SCALE_COMBO_BOX            (gimp_scale_combo_box_get_type ())
 #define GIMP_SCALE_COMBO_BOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SCALE_COMBO_BOX, GimpScaleComboBox))
 #define GIMP_SCALE_COMBO_BOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SCALE_COMBO_BOX, GimpScaleComboBoxClass))
@@ -42,20 +32,20 @@
 
 typedef struct _GimpScaleComboBoxClass  GimpScaleComboBoxClass;
 
-struct _GimpScaleComboBoxClass
+struct _GimpScaleComboBox
 {
-  GtkComboBoxEntryClass  parent_instance;
+  GtkComboBox  parent_instance;
 
-  void (* entry_activated) (GimpScaleComboBox *combo_box);
+  gdouble      scale;
+  GtkTreePath *last_path;
+  GList       *mru;
 };
 
-struct _GimpScaleComboBox
+struct _GimpScaleComboBoxClass
 {
-  GtkComboBoxEntry  parent_instance;
+  GtkComboBoxClass  parent_instance;
 
-  gdouble           scale;
-  GtkTreePath      *last_path;
-  GList            *mru;
+  void (* entry_activated) (GimpScaleComboBox *combo_box);
 };
 
 



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