[PATCH] More HIG in properties dialog



Some alignment and spacing changing in Properties dialog to fit HIG
specifications.

Unfortunately it needs a bit more caring (some crazy spacing and
alignment):-( 

I'll do it, but let me know if we want/can to apply in 2.4 timeline.
-- 
Think bigger

			My uncle
diff -Naur nautilus/src/file-manager/fm-properties-window.c nautilus-new/src/file-manager/fm-properties-window.c
--- nautilus/src/file-manager/fm-properties-window.c	2003-07-08 13:20:53.000000000 +0200
+++ nautilus-new/src/file-manager/fm-properties-window.c	2003-07-08 12:15:35.000000000 +0200
@@ -54,6 +54,7 @@
 #include <gtk/gtksignal.h>
 #include <gtk/gtkstock.h>
 #include <gtk/gtktable.h>
+#include <gtk/gtkvbbox.h>
 #include <gtk/gtkvbox.h>
 #include <libegg/egg-screen-help.h>
 #include <libgnome/gnome-i18n.h>
@@ -312,6 +313,10 @@
 	}
 }
 
+/*
+
+FIXME!! Remove this function
+
 static void
 add_prompt_and_separator (GtkVBox *vbox, const char *prompt_text)
 {
@@ -324,6 +329,8 @@
   	gtk_box_pack_end (GTK_BOX (vbox), separator_line, TRUE, TRUE, GNOME_PAD_BIG);
 }
 
+*/
+
 static GdkPixbuf *
 get_pixbuf_for_properties_window (FMPropertiesWindow *window)
 {
@@ -1443,22 +1450,14 @@
 		    int row)
 {
 	GtkWidget *option_menu;
-	GtkWidget *aligner;
 
-	option_menu = gtk_option_menu_new ();
-	gtk_widget_show (option_menu);
+ 	option_menu = gtk_option_menu_new ();
+ 	gtk_widget_show (option_menu);
 
-	/* Put option menu in alignment to make it left-justified
-	 * but minimally sized.
-	 */	
-	aligner = gtk_alignment_new (0, 0.5, 0, 0);
-	gtk_widget_show (aligner);
-
-	gtk_container_add (GTK_CONTAINER (aligner), option_menu);
-	gtk_table_attach (table, aligner,
+	gtk_table_attach (table, option_menu,
 			  VALUE_COLUMN, VALUE_COLUMN + 1,
 			  row, row + 1,
-			  GTK_FILL, 0,
+			  GTK_FILL|GTK_EXPAND, 0,
 			  0, 0);
 
 	return GTK_OPTION_MENU (option_menu);
@@ -1636,11 +1635,15 @@
 	new_row_count = table->nrows + 1;
 
 	gtk_table_resize (table, new_row_count, table->ncols);
-	gtk_table_set_row_spacing (table, new_row_count - 1, GNOME_PAD);
+	gtk_table_set_row_spacing (table, new_row_count - 1, 6);
 
 	return new_row_count - 1;
 }
 
+/*
+
+FIXME!! Remove this function
+
 static GtkWidget *
 append_separator (GtkTable *table)
 {
@@ -1658,6 +1661,8 @@
 	return separator;				   
 }
 
+*/
+
 static void
 directory_contents_value_field_update (FMPropertiesWindow *window)
 {
@@ -1828,6 +1833,7 @@
 
 	last_row = append_row (table);
 	title_label = attach_title_field (table, last_row, title);
+	gtk_misc_set_alignment (GTK_MISC (title_label), 0, 0);
 
 	if (label) {
 		*label = title_label;
@@ -1893,7 +1899,7 @@
 	}
 
 	for (i= 0; i < row_count; ++i) {
-		gtk_table_set_row_spacing (table, first_row + i, should_show ? GNOME_PAD : 0);
+		gtk_table_set_row_spacing (table, first_row + i, should_show ? 6 : 0);
 	}
 }				   
 
@@ -1971,9 +1977,9 @@
 	g_assert (GTK_IS_NOTEBOOK (notebook));
 	g_assert (title != NULL);
 
-	vbox = gtk_vbox_new (FALSE, 0);
+	vbox = gtk_vbox_new (FALSE, 18);
 	gtk_widget_show (vbox);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
 	gtk_notebook_append_page (notebook, vbox, gtk_label_new (title));
 
 	return vbox;
@@ -1982,8 +1988,8 @@
 static void
 apply_standard_table_padding (GtkTable *table)
 {
-	gtk_table_set_row_spacings (table, GNOME_PAD);
-	gtk_table_set_col_spacings (table, GNOME_PAD);	
+	gtk_table_set_row_spacings (table, 6);
+	gtk_table_set_col_spacings (table, 12);	
 }
 
 static GtkWidget *
@@ -2120,10 +2126,9 @@
 	GtkTable *table;
 	GtkWidget *container;
 	GtkWidget *name_field;
-	GtkWidget *icon_aligner;
 	GtkWidget *icon_pixmap_widget;
-
-	GtkWidget *hbox, *name_label;
+	GtkWidget *icon_box;
+	GtkWidget *name_label;
 
 	create_page_with_table_in_vbox (window->details->notebook, 
 					_("Basic"), 
@@ -2133,24 +2138,63 @@
 	window->details->basic_table = table;
 	
 	/* Icon pixmap */
-	hbox = gtk_hbox_new (FALSE, 4);
-	gtk_widget_show (hbox);
-	gtk_table_attach (table,
-			  hbox,
-			  TITLE_COLUMN, 
-			  TITLE_COLUMN + 1,
-			  0, 1,
-			  0, 0,
-			  0, 0);
+
+	icon_box = gtk_hbox_new (FALSE, 12);
+	gtk_widget_show (icon_box);
+	gtk_box_pack_start (GTK_BOX (container), icon_box, FALSE, FALSE, 0);
+	gtk_box_reorder_child (GTK_BOX (container), icon_box, 0);
 
 	icon_pixmap_widget = create_image_widget (window);
 	gtk_widget_show (icon_pixmap_widget);
 	
-	icon_aligner = gtk_alignment_new (1, 0.5, 0, 0);
-	gtk_widget_show (icon_aligner);
-	
-	gtk_container_add (GTK_CONTAINER (icon_aligner), icon_pixmap_widget);
-	gtk_box_pack_start (GTK_BOX (hbox), icon_aligner, TRUE, TRUE, 0);
+ 	gtk_misc_set_alignment (GTK_MISC (icon_pixmap_widget), 0, 0);
+	gtk_box_pack_start (GTK_BOX (icon_box), icon_pixmap_widget, FALSE, FALSE, 0);	
+
+	/* Icon buttons */
+
+	if (should_show_custom_icon_buttons (window)) {
+
+		GtkWidget *button_box;
+		GtkWidget *temp_button;
+		GList *l;
+		
+		/* add command buttons for setting and clearing custom icons */
+		button_box = gtk_vbutton_box_new ();
+		gtk_widget_show (button_box);
+		gtk_box_pack_end (GTK_BOX(icon_box), button_box, FALSE, TRUE, 0);  
+		gtk_box_set_spacing (GTK_BOX (button_box), 6);
+		gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_START);
+		
+	 	temp_button = gtk_button_new_with_mnemonic (_("_Select Custom Icon..."));
+		gtk_widget_show (temp_button);
+		gtk_container_add (GTK_CONTAINER (button_box), temp_button);
+		gtk_box_pack_start (GTK_BOX (button_box), temp_button, FALSE, FALSE, 0);
+
+		g_signal_connect_object (temp_button, "clicked", G_CALLBACK (select_image_button_callback), window, 0);
+	 	
+	 	temp_button = gtk_button_new_with_mnemonic (_("_Remove Custom Icon"));
+		gtk_widget_show (temp_button);
+		gtk_container_add (GTK_CONTAINER (button_box), temp_button);
+		gtk_box_pack_start (GTK_BOX(button_box), temp_button, FALSE, FALSE, 0);  
+
+	 	g_signal_connect_object (temp_button, "clicked", G_CALLBACK (remove_image_button_callback), window, 0);
+
+		window->details->remove_image_button = temp_button;
+		
+		/* de-sensitize the remove button if there isn't a custom image */
+		gtk_widget_set_sensitive (temp_button, FALSE);
+		for (l = window->details->original_files; l != NULL; l = l->next) {
+			char *image_uri = nautilus_file_get_metadata 
+				(NAUTILUS_FILE (l->data), 
+				 NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL);
+			if (image_uri) {
+				gtk_widget_set_sensitive (temp_button, TRUE);
+			}
+			g_free (image_uri);
+		}
+
+	}
+
 
 	/* Name label */
 	if (is_multi_file_window (window)) {
@@ -2159,8 +2203,16 @@
 		name_label = gtk_label_new_with_mnemonic (_("_Name:"));
 	}
 	eel_gtk_label_make_bold (GTK_LABEL (name_label));
+	/*****/
+	gtk_misc_set_alignment (GTK_MISC (name_label), 0, 0);
 	gtk_widget_show (name_label);
-	gtk_box_pack_end (GTK_BOX (hbox), name_label, FALSE, FALSE, 0);
+	gtk_table_attach (table,
+			  name_label,
+			  TITLE_COLUMN, 
+			  TITLE_COLUMN + 1,
+			  0, 1,
+			  GTK_FILL, 0,
+			  0, 0);
 
 	/* Name field */
 	name_field = nautilus_entry_new ();
@@ -2171,7 +2223,7 @@
 			  VALUE_COLUMN, 
 			  VALUE_COLUMN + 1,
 			  0, 1,
-			  GTK_FILL, 0,
+			  GTK_FILL|GTK_EXPAND, 0,
 			  0, 0);
 	gtk_label_set_mnemonic_widget (GTK_LABEL (name_label), name_field);
 
@@ -2203,14 +2255,6 @@
 	        gtk_widget_grab_focus (GTK_WIDGET (name_field));
         }
         
-	if (should_show_file_type (window)) {
-		append_title_value_pair (window,
-					 table, _("Type:"), 
-					 "type",
-					 _("--"),
-					 FALSE);
-	}
-
 	if (is_multi_file_window (window)) {
 		/* FIXME: append a total size field here */
 #if 0
@@ -2229,7 +2273,11 @@
 					    "where",
 					    _("--"),
 					    FALSE);
+
+	/* Blank title ensures standard row height */
+	append_title_field (table, "", NULL);
 	
+
 	if (should_show_free_space (window)) {
 		append_title_and_ellipsizing_value (window, table, 
 						    _("Volume:"), 
@@ -2249,6 +2297,19 @@
 						    _("--"),
 						    FALSE);
 	}
+
+	/* Blank title ensures standard row height */
+	append_title_field (table, "", NULL);
+
+	if (should_show_file_type (window)) {
+		append_title_value_pair (window,
+					 table, _("Type:"), 
+					 "type",
+					 _("--"),
+					 FALSE);
+	}
+
+
 	if (should_show_mime_type (window)) {
 		append_title_value_pair (window, table, _("MIME type:"), 
 					 "mime_type",
@@ -2259,56 +2320,18 @@
 	/* Blank title ensures standard row height */
 	append_title_field (table, "", NULL);
 	
-	append_title_value_pair (window, table, _("Modified:"), 
+	append_title_value_pair (window, table, _("Last modified:"), 
 				 "date_modified",
 				 _("--"),
 				 FALSE);
 	
 	if (should_show_accessed_date (window)) {
-		append_title_value_pair (window, table, _("Accessed:"), 
+		append_title_value_pair (window, table, _("Last accessed:"), 
 					 "date_accessed",
 					 _("--"),
 					 FALSE);
 	}
 
-	if (should_show_custom_icon_buttons (window)) {
-		GtkWidget *button_box;
-		GtkWidget *temp_button;
-		GList *l;
-		
-		/* add command buttons for setting and clearing custom icons */
-		button_box = gtk_hbox_new (FALSE, 0);
-		gtk_widget_show (button_box);
-		gtk_box_pack_end (GTK_BOX(container), button_box, FALSE, FALSE, 4);  
-		
-	 	temp_button = gtk_button_new_with_mnemonic (_("_Select Custom Icon..."));
-		gtk_widget_show (temp_button);
-		gtk_box_pack_start (GTK_BOX (button_box), temp_button, FALSE, FALSE, 4);  
-
-		g_signal_connect_object (temp_button, "clicked", G_CALLBACK (select_image_button_callback), window, 0);
-	 	
-	 	temp_button = gtk_button_new_with_mnemonic (_("_Remove Custom Icon"));
-		gtk_widget_show (temp_button);
-		gtk_box_pack_start (GTK_BOX(button_box), temp_button, FALSE, FALSE, 4);  
-
-	 	g_signal_connect_object (temp_button, "clicked", G_CALLBACK (remove_image_button_callback), window, 0);
-
-		window->details->remove_image_button = temp_button;
-		
-		/* de-sensitize the remove button if there isn't a custom image */
-		
-		gtk_widget_set_sensitive (temp_button, FALSE);
-		for (l = window->details->original_files; l != NULL; l = l->next) {
-			char *image_uri = nautilus_file_get_metadata 
-				(NAUTILUS_FILE (l->data), 
-				 NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL);
-			if (image_uri) {
-				gtk_widget_set_sensitive (temp_button, TRUE);
-			}
-			
-			g_free (image_uri);
-		}
-	}
 }
 
 static GHashTable *
@@ -2347,7 +2370,7 @@
 	/* The emblems wrapped table */
 	scroller = eel_scrolled_wrap_table_new (TRUE, &emblems_table);
 
-	gtk_container_set_border_width (GTK_CONTAINER (emblems_table), GNOME_PAD);
+	gtk_container_set_border_width (GTK_CONTAINER (emblems_table), 12);
 	
 	gtk_widget_show (scroller);
 
@@ -2703,7 +2726,6 @@
 	remember_special_flags_widget (window, append_special_execution_checkbox 
 		(window, table, _("_Sticky"), GNOME_VFS_PERM_STICKY));
 
-	remember_special_flags_widget (window, append_separator (table));
 	++window->details->num_special_flags_rows;
 
 	update_visibility_of_special_flags_widgets (window);
@@ -2793,9 +2815,29 @@
 	
 	if (all_can_get_permissions (file_list)) {
 		if (!all_can_set_permissions (file_list)) {
-			add_prompt_and_separator (
-				GTK_VBOX (vbox), 
-				_("You are not the owner, so you can't change these permissions."));
+			GtkWidget *no_change_label, *separator_line, *warn_vbox;
+			gchar *str;
+
+			warn_vbox = gtk_vbox_new (FALSE , 6);
+			gtk_box_pack_start (GTK_BOX (vbox), warn_vbox, FALSE, TRUE, 0);
+
+			str = g_strconcat ("<big>",
+					   _("You are not the owner, so you can't change these permissions."),
+					   "</big>", 
+					   NULL);
+
+			no_change_label = gtk_label_new( NULL );
+			gtk_label_set_markup (GTK_LABEL (no_change_label), str);
+			g_free (str);
+			gtk_widget_show (GTK_WIDGET (no_change_label));
+
+			gtk_box_pack_start (GTK_BOX (warn_vbox), no_change_label, TRUE, TRUE, 0);
+
+			separator_line = gtk_hseparator_new ();
+			gtk_widget_show (separator_line);
+			gtk_box_pack_end (GTK_BOX (warn_vbox), separator_line, TRUE, TRUE, 0);
+
+			gtk_widget_show (warn_vbox);
 		}
 
 		page_table = GTK_TABLE (gtk_table_new (1, COLUMN_COUNT, FALSE));
@@ -2844,7 +2886,22 @@
 					    FALSE); 
 		}
 
-		append_separator (page_table);
+		append_title_field (page_table, "", NULL);
+
+		append_title_value_pair
+			(window, page_table, _("Text view:"), 
+			 "permissions", _("--"),
+			 FALSE);
+		append_title_value_pair 
+			(window, page_table, _("Number view:"), 
+			 "octal_permissions", _("--"),
+			 FALSE);
+		append_title_value_pair
+			(window, page_table, _("Last changed:"), 
+			 "date_permissions", _("--"),
+			 FALSE);
+
+		append_title_field (page_table, "", NULL);
 		
 		checkbox_titles_row = append_title_field (page_table, _("Owner:"), NULL);
 		append_title_field (page_table, _("Group:"), NULL);
@@ -2916,22 +2973,10 @@
 					  PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
 					  GNOME_VFS_PERM_OTHER_EXEC);
 
-		append_separator (page_table);
-
-		append_special_execution_flags (window, page_table);
-		
-		append_title_value_pair
-			(window, page_table, _("Text view:"), 
-			 "permissions", _("--"),
-			 FALSE);
-		append_title_value_pair 
-			(window, page_table, _("Number view:"), 
-			 "octal_permissions", _("--"),
-			 FALSE);
-		append_title_value_pair
-			(window, page_table, _("Last changed:"), 
-			 "date_permissions", _("--"),
-			 FALSE);
+		if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS)) {
+			append_title_field (page_table, "", NULL);
+			append_special_execution_flags (window, page_table);
+		}
 	} else {
 		if (!is_multi_file_window (window)) {
 			file_name = nautilus_file_get_display_name (get_target_file (window));
@@ -2954,7 +2999,7 @@
 	GtkWidget *label;
 	GtkWidget *image;
 
-	hbox = gtk_hbox_new (FALSE, GNOME_PAD);
+	hbox = gtk_hbox_new (FALSE, 12);
 	image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
 					  GTK_ICON_SIZE_DIALOG);
 
@@ -3337,14 +3382,15 @@
 	}
 
 	/* Create box for notebook and button box. */
-	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+	vbox = gtk_vbox_new (FALSE, 12);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
 	gtk_widget_show (vbox);
 	gtk_container_add (GTK_CONTAINER (window),
 			   GTK_WIDGET (vbox));
 
 	/* Create the notebook tabs. */
 	window->details->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
+	gtk_container_set_border_width (GTK_CONTAINER (window->details->notebook), 6);
 	gtk_widget_show (GTK_WIDGET (window->details->notebook));
 	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (window->details->notebook),
 			    TRUE, TRUE, 0);
@@ -3366,7 +3412,8 @@
 	/* Create box for help and close buttons. */
 	hbox = gtk_hbutton_box_new ();
 	gtk_widget_show (hbox);
-	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), FALSE, TRUE, 5);
+	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (hbox), FALSE, TRUE, 0);
+	gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_EDGE);
 
 	button = gtk_button_new_from_stock (GTK_STOCK_HELP);


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