Move create_generic_config_page to configurator.c, which is a better place.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Tue, 10 Oct 2006 10:17:14 +0000 (10:17 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Tue, 10 Oct 2006 10:17:14 +0000 (10:17 +0000)
src/configurator.c
src/misc.c

index c59b54b..72be662 100644 (file)
@@ -935,3 +935,53 @@ restart(void)
     RET();
 }
 
+/* Parameters: const char* name, gpointer ret_value, GType type, ....NULL */
+GtkWidget* create_generic_config_page( const char* name, ... )
+{
+    va_list args;
+    GtkWidget* config = gtk_vbox_new( FALSE, 4 );
+    va_start( args, name );
+    while( name )
+    {
+        GtkWidget* label = gtk_label_new( name );
+        GtkWidget* entry = NULL;
+        gpointer val = va_arg( args, gpointer );
+        GType type = va_arg( args, GType );
+        switch( type )
+        {
+            case G_TYPE_STRING:
+                entry = gtk_entry_new();
+                gtk_entry_set_text( entry, *(char**)val );
+                break;
+            case G_TYPE_INT:
+            {
+                /* FIXME: the range shouldn't be hardcoded */
+                entry = gtk_spin_button_new_with_range( 0, 1000, 1 );
+                gtk_spin_button_set_value( entry, *(int*)val );
+                break;
+            }
+            case G_TYPE_BOOLEAN:
+                entry = gtk_check_button_new();
+                gtk_container_add( entry, label );
+                gtk_toggle_button_set_active( entry, *(gboolean*)val );
+                break;
+        }
+        if( entry )
+        {
+            if( type == G_TYPE_BOOLEAN )
+                gtk_box_pack_start( config, entry, FALSE, FALSE, 2 );
+            else
+            {
+                GtkWidget* hbox = gtk_hbox_new( FALSE, 2 );
+                gtk_box_pack_start( hbox, label, FALSE, FALSE, 2 );
+                gtk_box_pack_start( hbox, entry, TRUE, TRUE, 2 );
+                gtk_box_pack_start( config, hbox, FALSE, FALSE, 2 );
+            }
+        }
+        name = va_arg( args, const char* );
+    }
+    va_end( args );
+    gtk_widget_show_all( config );
+    return config;
+}
+
index 6391836..4323151 100644 (file)
@@ -1044,53 +1044,3 @@ char* translate_exec_to_cmd( const char* exec, const char* icon,
     return g_string_free( cmd, FALSE );
 }
 
-/* Parameters: const char* name, gpointer ret_value, GType type, ....NULL */
-GtkWidget* create_generic_config_page( const char* name, ... )
-{
-    va_list args;
-    GtkWidget* config = gtk_vbox_new( FALSE, 4 );
-    va_start( args, name );
-    while( name )
-    {
-        GtkWidget* label = gtk_label_new( name );
-        GtkWidget* entry = NULL;
-        gpointer val = va_arg( args, gpointer );
-        GType type = va_arg( args, GType );
-        switch( type )
-        {
-            case G_TYPE_STRING:
-                entry = gtk_entry_new();
-                gtk_entry_set_text( entry, *(char**)val );
-                break;
-            case G_TYPE_INT:
-            {
-                /* FIXME: the range shouldn't be hardcoded */
-                entry = gtk_spin_button_new_with_range( 0, 100, 1 );
-                gtk_spin_button_set_value( entry, *(int*)val );
-                break;
-            }
-            case G_TYPE_BOOLEAN:
-                entry = gtk_check_button_new();
-                gtk_container_add( entry, label );
-                gtk_toggle_button_set_active( entry, *(gboolean*)val );
-                break;
-        }
-        if( entry )
-        {
-            if( type == G_TYPE_BOOLEAN )
-                gtk_box_pack_start( config, entry, FALSE, FALSE, 2 );
-            else
-            {
-                GtkWidget* hbox = gtk_hbox_new( FALSE, 2 );
-                gtk_box_pack_start( hbox, label, FALSE, FALSE, 2 );
-                gtk_box_pack_start( hbox, entry, TRUE, TRUE, 2 );
-                gtk_box_pack_start( config, hbox, FALSE, FALSE, 2 );
-            }
-        }
-        name = va_arg( args, const char* );
-    }
-    va_end( args );
-    gtk_widget_show_all( config );
-    return config;
-}
-