[gtk+] gtk: remove unused GTK_BUTTONBOX_DEFAULT_STYLE from gtkenums.h tests: remove GTK_BUTTONBOX_DEFAULT_S



commit 568e867dad4bbea600b12333b86b358944c24d13
Author: Clayton Walker <clayton m walker gmail com>
Date:   Thu Jan 2 00:38:37 2014 +0100

    gtk: remove unused GTK_BUTTONBOX_DEFAULT_STYLE from gtkenums.h tests: remove GTK_BUTTONBOX_DEFAULT_STYLE 
from testbbox.c and fix crashing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721317

 gtk/gtkenums.h   |    1 -
 tests/testbbox.c |   31 +++++++++++++------------------
 2 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index c1e0311..e87c983 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -155,7 +155,6 @@ typedef enum
 
 /**
  * GtkButtonBoxStyle:
- * @GTK_BUTTONBOX_DEFAULT_STYLE: Default packing.
  * @GTK_BUTTONBOX_SPREAD: Buttons are evenly spread across the box.
  * @GTK_BUTTONBOX_EDGE: Buttons are placed at the edges of the box.
  * @GTK_BUTTONBOX_START: Buttons are grouped towards the start of the box,
diff --git a/tests/testbbox.c b/tests/testbbox.c
index 1edade5..a56be68 100644
--- a/tests/testbbox.c
+++ b/tests/testbbox.c
@@ -23,8 +23,7 @@
 GtkWidget *bbox = NULL;
 GtkWidget *hbbox = NULL, *vbbox = NULL;
 
-static const char* styles[] = { "GTK_BUTTONBOX_DEFAULT_STYLE",
-                               "GTK_BUTTONBOX_SPREAD",
+static const char* styles[] = { "GTK_BUTTONBOX_SPREAD",
                                "GTK_BUTTONBOX_EDGE",
                                "GTK_BUTTONBOX_START",
                                "GTK_BUTTONBOX_END",
@@ -51,16 +50,10 @@ static void
 combo_changed_cb (GtkComboBoxText *combo,
                  gpointer user_data)
 {
-  char *text;
-  int i;
-  
-  text = gtk_combo_box_text_get_active_text (combo);
-  
-  for (i = 0; styles[i]; i++) {
-    if (g_str_equal (text, styles[i])) {
-      gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), (GtkButtonBoxStyle)i);
-    }
-  }
+  gint active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox),
+                            (GtkButtonBoxStyle) (active + 1));
 }
 
 static void
@@ -82,19 +75,19 @@ combo_types_changed_cb (GtkComboBoxText *combo,
   char *text;
   GtkWidget *old_parent, *new_parent;
   GtkButtonBoxStyle style;
-  
-  text = gtk_combo_box_text_get_active_text (combo);
-  
-  if (g_str_equal (text, "GtkHButtonBox")) {
+
+  gint active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+
+  if (active == GTK_ORIENTATION_HORIZONTAL) {
     old_parent = vbbox;
     new_parent = hbbox;
   } else {
     old_parent = hbbox;
     new_parent = vbbox;
   }
-  
+
   bbox = new_parent;
-  
+
   for (i = 0; i < N_BUTTONS; i++) {
     reparent_widget (buttons[i], old_parent, new_parent);
   }
@@ -144,6 +137,8 @@ main (int    argc,
   }
   
   bbox = hbbox;
+
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), GTK_BUTTONBOX_SPREAD);
   
   /* GtkVButtonBox */
   vbbox = gtk_button_box_new (GTK_ORIENTATION_VERTICAL);


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