

Use the new GtkComboBox widget if compiling against GTK+ 2.4; otherwise, the
DGTK_DISABLE_DEPRECATED flag prevents compilation.



diff -puN switch.c~combo-box switch.c
--- gtk-theme-switch-2.0.0rc2/switch.c~combo-box	2004-03-21 08:53:47.953211952 -0600
+++ gtk-theme-switch-2.0.0rc2-arashi/switch.c	2004-03-21 09:02:06.061487984 -0600
@@ -7,6 +7,7 @@
 
 #include "switch.h"
 #define INIT_GTK if (!using_gtk) { gtk_init (&argc, &argv); using_gtk = 1; }
+#define USE_COMBO_BOX GTK_CHECK_VERSION(2,4,0)
 
 /* globals */
 GHashTable *hash;
@@ -125,8 +126,14 @@ preview_clicked(GtkWidget *button, gpoin
 	gchar *dir; 
 	gchar *rc;
 	gchar *actual;
+	gint active;
 
+#if USE_COMBO_BOX
+	active = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
+	entry = g_list_nth(get_dirs(), active)->data;
+#else
 	entry = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
+#endif
 	dir = g_hash_table_lookup(hash,entry);
 	dir = g_strconcat(dir,"/",NULL);
 	rc = g_strconcat(dir,entry,NULL);
@@ -157,7 +164,11 @@ static void update_newfont (void)
 static void 
 apply_clicked(GtkWidget *button, gpointer data)
 {
+#if USE_COMBO_BOX
+	G_CONST_RETURN gchar *entry = g_list_nth(get_dirs(), gtk_combo_box_get_active(GTK_COMBO_BOX(combo)))->data;
+#else
 	G_CONST_RETURN gchar *entry = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
+#endif
 	gchar *dir = g_hash_table_lookup(hash,entry);
 	gchar *name = g_strdup_printf ("%s/%s/gtk-2.0/gtkrc", dir, entry);
 /*	GtkStyle *style;*/
@@ -326,6 +337,8 @@ dock (void)
 {
 	GtkWidget *label, *button, *pixmap, *evbox;
        	GtkTooltips *tips;
+	GList *item;
+	int i;
      	
 	dockwin = gtk_dialog_new();
      	gtk_widget_realize(dockwin);
@@ -339,9 +352,16 @@ dock (void)
 	label = gtk_label_new("Theme: ");
 	gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,FALSE);
 
+#if USE_COMBO_BOX
+	combo = gtk_combo_box_new_text();
+	glist = get_dirs();
+	for (i = 0; (item = g_list_nth(glist, i)) != NULL; i++)
+		gtk_combo_box_append_text(GTK_COMBO_BOX(combo), item->data);
+#else
 	combo = gtk_combo_new();
 	glist = get_dirs();
 	gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
+#endif
 	gtk_box_pack_start(GTK_BOX(box),combo,TRUE,TRUE,FALSE);
      	
      	pixmap = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
@@ -690,7 +710,8 @@ static short install_tarball (gchar *pat
 {
 	gchar *command, *themedir;
 	gint result;
-	GList *new_list, *new_theme;
+	GList *new_list, *new_theme, *item;
+	int i;
 
 	themedir = g_strdup_printf ("%s/.themes", homedir);
 
@@ -726,7 +747,15 @@ static short install_tarball (gchar *pat
 		g_list_free (glist);
 		glist = new_list;
 		/* Update combo, but only in dock mode */
+#if USE_COMBO_BOX
+		if (combo) {
+			for (i = 0; (item=g_list_nth(new_list, i)) != NULL;i++)
+				gtk_combo_box_append_text(GTK_COMBO_BOX(combo),
+							  item->data);
+		}
+#else
 		if (combo)	gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
+#endif
 	}
 	else
 	{

_
