[PATCH] UI Properties capplet



Hi,

attached is a small patch to control-center-1.0.5/capplets/ui-properties/ui-properties.c.
All it does is change the layout of the Dialogs and MDI sections to use a table instead
of a vbox.  This makes things look neater.

In case someone else has started this or has a better idea, I am going to add a preview
to the Application defaults.  I want to separate it into three tabs: Toolbars, Menus,
and Misc.  The Toolbars tab will have a toolbar and the check buttons related to
toolbars, and changes in the check buttons will be reflected in the toolbar.  Menus
will be similar, while Misc will just have three check buttons (2 x statusbar and the
dialog buttons one).  I also want to add a check button for "Toolbar buttons have
icons", but I can only do this if there is such a setting in Gnome.  Is there?

Lyndon 

--- ui-properties.c	Tue Mar  9 09:49:33 1999
+++ ui-properties.c	Sat Apr 17 12:14:38 1999
@@ -139,7 +139,7 @@
 }
 
 static void
-make_option_menu(GtkWidget * vbox, const gchar * labeltext,
+make_option_menu(GtkWidget * table, gint row, const gchar * labeltext,
                  gint (*getfunc)(),
                  const gchar * const names[], gint N,
                  void (*callback)(GtkWidget*,gint))
@@ -147,7 +147,6 @@
   GtkWidget * option_menu;
   GtkWidget * menu;
   GtkWidget * menuitem;
-  GtkWidget * hbox;
   GtkWidget * label;
   gint i, def = 0; 
 
@@ -172,24 +171,22 @@
 
   gtk_option_menu_set_history ( GTK_OPTION_MENU(option_menu), def );
 
-  hbox = gtk_hbox_new (FALSE, 0);
-
   label = gtk_label_new(labeltext);
+  gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
 
-  gtk_box_pack_start ( GTK_BOX(hbox), label, FALSE, FALSE, GNOME_PAD );
-  /* FIXME: option menu width should be just wide enough to display
-     widest menu item.  Ideally the option menu code would handle this
-     for us.  Also, the button is not tall enough -- descenders seem
-     to get clipped on my display.  */
-  gtk_box_pack_end ( GTK_BOX(hbox), option_menu, TRUE, TRUE, 0 );
-  gtk_box_pack_start ( GTK_BOX(vbox), hbox, FALSE, FALSE, 0 );
+  gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1,
+                   GTK_FILL, GTK_FILL|GTK_EXPAND,
+                   0, 0);
+  gtk_table_attach_defaults(GTK_TABLE(table), option_menu, 1, 2, row, row + 1);
 }
 
 static void
 ui_setup (GtkWidget *old, GtkWidget *the_capplet)
 {
-  GtkWidget * vbox;
-  GtkWidget * button;
+    GtkWidget * table;
+    GtkWidget * vbox;
+    GtkWidget * button;
+    gint row;
 	capplet = the_capplet;
 	
 	gtk_signal_connect (GTK_OBJECT(the_capplet), "new_multi_capplet", 
@@ -200,23 +197,30 @@
 		case -1:
 		case 0: /* Dialogs */
 
-			vbox = gtk_vbox_new(FALSE, GNOME_PAD);
- 	 		gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD);
+          vbox = gtk_vbox_new(FALSE, 0);
+          table = gtk_table_new(5, 2, FALSE);
+          gtk_table_set_row_spacings (GTK_TABLE(table), GNOME_PAD);
+          gtk_table_set_col_spacings (GTK_TABLE(table), GNOME_PAD);
+ 	 	  gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD);
+          row = 0;
 
-		  make_option_menu(vbox,_("Dialog buttons"),
+		  make_option_menu(table, row, _("Dialog buttons"),
                    gnome_preferences_get_button_layout,
                    buttonbox_style_names, NUM_BUTTONBOX_STYLES,
                    buttonbox_style_cb);
+          row++;
 
-		  make_option_menu(vbox,_("Dialog position"),
+		  make_option_menu(table, row, _("Dialog position"),
                    gnome_preferences_get_dialog_position,
                    dialog_positions_names, NUM_DIALOG_POSITIONS,
                    dialog_position_cb);
+          row++;
 
-		  make_option_menu(vbox,_("Dialog hints"),
+		  make_option_menu(table, row, _("Dialog hints"),
                    gnome_preferences_get_dialog_type,
                    dialog_types_names, NUM_DIALOG_TYPES,
                    dialog_type_cb);
+          row++;
 
 
 		  button = 
@@ -227,7 +231,8 @@
                      GTK_SIGNAL_FUNC(checkbutton_cb),
                      gnome_preferences_set_statusbar_dialog);
 
-		  gtk_box_pack_start ( GTK_BOX(vbox), button, FALSE, FALSE, 0);
+		  gtk_table_attach_defaults ( GTK_TABLE(table), button, 1, 2, row, row + 1);
+          row++;
 
 		  button = 
 		 		gtk_check_button_new_with_label(_("Place dialogs over application window when possible"));
@@ -237,10 +242,13 @@
     		                 GTK_SIGNAL_FUNC(checkbutton_cb),
         		             gnome_preferences_set_dialog_centered);
 
-		  gtk_box_pack_start ( GTK_BOX(vbox), button, FALSE, FALSE, 0);
+          gtk_table_attach_defaults ( GTK_TABLE(table), button, 1, 2, row, row + 1);
+          row++;
 		
+          gtk_box_pack_start ( GTK_BOX(vbox), table, FALSE, FALSE, 0);
 		  gtk_widget_show_all(vbox);
 			gtk_widget_show(the_capplet);
+            gtk_container_add (GTK_CONTAINER (the_capplet), vbox);
 			break;
 			
 		case 1: /* Application */
@@ -324,7 +332,7 @@
 		    gtk_check_button_new_with_label(_("Statusbar progress meter on right"));
 
 		  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), 
-    		                          gnome_preferences_get_statusbar_meter_on_right);
+    		                          gnome_preferences_get_statusbar_meter_on_right());
 
 		  gtk_signal_connect(GTK_OBJECT(button), "toggled",
     		                 GTK_SIGNAL_FUNC(checkbutton_cb),
@@ -357,24 +365,33 @@
 
 		  gtk_widget_show_all(vbox);
 			gtk_widget_show(the_capplet);
+            gtk_container_add (GTK_CONTAINER (the_capplet), vbox);
 			break;
 			
 		case 2: /* MDI */
-		  vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-		  gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD);
+          vbox = gtk_vbox_new(FALSE, 0);
+		  table = gtk_table_new(2, 2, FALSE);
+          gtk_table_set_row_spacings (GTK_TABLE(table), GNOME_PAD_SMALL);
+          gtk_table_set_col_spacings (GTK_TABLE(table), GNOME_PAD_SMALL);
+		  gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD);
+          row = 0;
 
-		  make_option_menu(vbox,_("Default MDI mode"),
+		  make_option_menu(table, row, _("Default MDI mode"),
     		               gnome_preferences_get_mdi_mode,
         		           mdi_mode_names, NUM_MDI_MODES,
 		                   mdi_mode_cb);
+          row++;
 
-		  make_option_menu(vbox,_("MDI notebook tab position"),
+		  make_option_menu(table, row, _("MDI notebook tab position"),
     		               gnome_preferences_get_mdi_tab_pos,
         		           tab_position_names, NUM_TAB_POSITIONS,
 		                   mdi_tab_pos_cb);
+          row++;
 
+          gtk_box_pack_start ( GTK_BOX(vbox), table, FALSE, FALSE, 0);
 		  gtk_widget_show_all(vbox);
 			gtk_widget_show(the_capplet);
+            gtk_container_add (GTK_CONTAINER (the_capplet), vbox);
 			break;
 	}
 			
@@ -383,7 +400,6 @@
 	gtk_signal_connect (GTK_OBJECT (the_capplet), "ok",
                       GTK_SIGNAL_FUNC (ui_write), NULL);
 
-  gtk_container_add (GTK_CONTAINER (the_capplet), vbox);
 }
 
 int


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