]> Pileus Git - ~andy/gtk/blobdiff - tests/testcombochange.c
gtk: remove "gboolean homogeneous" from gtk_box_new()
[~andy/gtk] / tests / testcombochange.c
index f673a4066964705cb9f253af19197ae0e2065191..c9da7587965ab91d706af620673ac64dfaaedd71 100644 (file)
@@ -1,4 +1,24 @@
-#include <config.h>
+/* testcombochange.c
+ * Copyright (C) 2004  Red Hat, Inc.
+ * Author: Owen Taylor
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
 #include <gtk/gtk.h>
 #include <stdarg.h>
 
@@ -9,18 +29,18 @@ GArray *contents;
 static char next_value = 'A';
 
 static void
-test_init ()
+test_init (void)
 {
   if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
                   G_FILE_TEST_EXISTS))
     {
-      g_setenv ("GDK_PIXBUF_MODULE_FILE", "../gdk-pixbuf/gdk-pixbuf.loaders", TRUE);
-      g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/gtk.immodules", TRUE);
+      g_setenv ("GDK_PIXBUF_MODULE_FILE", "../gdk-pixbuf/loaders.cache", TRUE);
+      g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
     }
 }
 
 static void
-log (const char *fmt,
+combochange_log (const char *fmt,
      ...)
 {
   GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
@@ -120,7 +140,7 @@ on_insert (void)
 
   g_array_insert_val (contents, insert_pos, new_value);
 
-  log ("Inserted '%c' at position %d", new_value[0], insert_pos);
+  combochange_log ("Inserted '%c' at position %d", new_value[0], insert_pos);
 }
 
 static void
@@ -141,7 +161,7 @@ on_delete (void)
 
   old_val = g_array_index (contents, char, delete_pos);
   g_array_remove_index (contents, delete_pos);
-  log ("Deleted '%c' from position %d", old_val, delete_pos);
+  combochange_log ("Deleted '%c' from position %d", old_val, delete_pos);
 }
 
 static void
@@ -175,7 +195,7 @@ on_reorder (void)
   g_array_free (contents, TRUE);
   contents = new_contents;
 
-  log ("Reordered array");
+  combochange_log ("Reordered array");
     
   g_free (shuffle_array);
 }
@@ -208,12 +228,13 @@ on_animate (void)
 {
   n_animations += 20;
  
-  timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL);
+  timer = gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, NULL);
 }
 
 int
 main (int argc, char **argv)
 {
+  GtkWidget *content_area;
   GtkWidget *dialog;
   GtkWidget *scrolled_window;
   GtkWidget *hbox;
@@ -233,15 +254,17 @@ main (int argc, char **argv)
   contents = g_array_new (FALSE, FALSE, sizeof (char));
   
   dialog = gtk_dialog_new_with_buttons ("GtkComboBox model changes",
-                                       NULL, GTK_DIALOG_NO_SEPARATOR,
+                                       NULL, 0,
                                        GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
                                        NULL);
-  
-  hbox = gtk_hbox_new (FALSE, 12);
+
+  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
   gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
 
-  combo_vbox = gtk_vbox_new (FALSE, 8);
+  combo_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_box_pack_start (GTK_BOX (hbox), combo_vbox, FALSE, FALSE, 0);
 
   label = gtk_label_new (NULL);
@@ -277,7 +300,7 @@ main (int argc, char **argv)
 
   gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
 
-  button_vbox = gtk_vbox_new (FALSE, 8);
+  button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
   gtk_box_pack_start (GTK_BOX (hbox), button_vbox, FALSE, FALSE, 0);
   
   gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);