Properties dialog - patch



After proposals in the last week, now it's time to patch.

Obviously there is UI freeze breakage, but there is a string breakage
too: I change the "Modify" and "Accessed" header to "Last modified" and
"Last accessed", like in "Last changed" in Permissions.

There are just some doubt:
        * why not Basic - Permissions - Emblems - Notes order?
        * A "Clear" button in Notes page?
        * Hide the "Special Flag" section by default?

-- 
Think bigger

			My uncle
diff -Naur nautilus-old/src/file-manager/fm-properties-window.c nautilus/src/file-manager/fm-properties-window.c
--- nautilus-old/src/file-manager/fm-properties-window.c	2003-02-25 19:08:46.000000000 +0100
+++ nautilus/src/file-manager/fm-properties-window.c	2003-02-25 19:09:27.000000000 +0100
@@ -53,6 +53,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>
@@ -225,18 +226,6 @@
 	}
 }
 
-static void
-add_prompt_and_separator (GtkVBox *vbox, const char *prompt_text)
-{
-	GtkWidget *separator_line;
-
-	add_prompt (vbox, prompt_text, FALSE);
-
- 	separator_line = gtk_hseparator_new ();
-  	gtk_widget_show (separator_line);
-  	gtk_box_pack_end (GTK_BOX (vbox), separator_line, TRUE, TRUE, GNOME_PAD_BIG);
-}		   
-
 static GdkPixbuf *
 get_pixbuf_for_properties_window (NautilusFile *file)
 {
@@ -958,22 +947,14 @@
 		    int row)
 {
 	GtkWidget *option_menu;
-	GtkWidget *aligner;
 
 	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);
@@ -1151,27 +1132,10 @@
 	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;
 }
-
-static GtkWidget *
-append_separator (GtkTable *table)
-{
-	GtkWidget *separator;
-	guint last_row;
-
-	last_row = append_row (table);
-	separator = gtk_hseparator_new ();
-	gtk_widget_show (separator);
-	gtk_table_attach (table, separator,
-			  TITLE_COLUMN, COLUMN_COUNT,
-			  last_row, last_row+1,
-			  GTK_FILL, 0,
-			  0, 0);
-	return separator;				   
-}		  	
  
 static void
 directory_contents_value_field_update (FMPropertiesWindow *window)
@@ -1321,7 +1285,7 @@
 		     int row,
 		     const char *title)
 {
-	return attach_label (table, row, TITLE_COLUMN, title, TRUE, TRUE, FALSE, FALSE, TRUE);
+	return attach_label (table, row, TITLE_COLUMN, title, FALSE, TRUE, FALSE, FALSE, TRUE);
 }		      
 
 static guint
@@ -1387,7 +1351,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);
 	}
 }				   
 
@@ -1457,9 +1421,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;
@@ -1468,8 +1432,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 *
@@ -1590,11 +1554,10 @@
 {
 	GtkTable *table;
 	GtkWidget *container;
-	GtkWidget *icon_pixmap_widget, *icon_aligner, *name_field;
-	GtkWidget *button_box, *temp_button;
+	GtkWidget *icon_pixmap_widget, *icon_box, *button_box, *temp_button;
+	GtkWidget *name_field, *name_label;
 	char *image_uri;
 	NautilusFile *target_file, *original_file;
-	GtkWidget *hbox, *name_label;
 
 	target_file = window->details->target_file;
 	original_file = window->details->original_file;
@@ -1605,32 +1568,67 @@
 					&table, 
 					&container);
 	window->details->basic_table = table;
+
+	/* Icon pixmap and buttons container */
 	
+	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 */
-	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_pixmap_widget = create_image_widget_for_file (original_file);
 	gtk_widget_show (icon_pixmap_widget);
-	
-	icon_aligner = gtk_alignment_new (1, 0.5, 0, 0);
-	gtk_widget_show (icon_aligner);
+	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)) {
+		/* 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), 12);
+		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);
 
-	gtk_container_add (GTK_CONTAINER (icon_aligner), icon_pixmap_widget);
-	gtk_box_pack_start (GTK_BOX (hbox), icon_aligner, TRUE, TRUE, 0);
+		window->details->remove_image_button = temp_button;
+		
+		/* de-sensitize the remove button if there isn't a custom image */
+		image_uri = nautilus_file_get_metadata 
+			(original_file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL);
+		gtk_widget_set_sensitive (temp_button, image_uri != NULL);
+		g_free (image_uri);
+	}
 
 	/* Name label */
 	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.5);
 	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 ();
@@ -1641,7 +1639,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);
 
@@ -1683,10 +1681,6 @@
 				 "changed",
 				 G_CALLBACK (name_field_update_to_match_file),
 				 name_field, G_CONNECT_SWAPPED);
-
-	if (should_show_file_type (window)) {
-		append_title_value_pair (table, _("Type:"), target_file, "type");
-	}
 	if (nautilus_file_is_directory (target_file)) {
 		append_directory_contents_fields (window, table);
 	} else {
@@ -1696,6 +1690,14 @@
 	if (should_show_link_target (window)) {
 		append_title_and_ellipsizing_value (table, _("Link target:"), target_file, "link_target");
 	}
+
+	/* Blank title ensures standard row height */
+	append_title_field (table, "", NULL);
+
+	if (should_show_file_type (window)) {
+		append_title_value_pair (table, _("Type:"), target_file, "type");
+	}
+
 	if (should_show_mime_type (window)) {
 		append_title_value_pair (table, _("MIME type:"), target_file, "mime_type");
 	}				  
@@ -1703,38 +1705,12 @@
 	/* Blank title ensures standard row height */
 	append_title_field (table, "", NULL);
 	
-	append_title_value_pair (table, _("Modified:"), target_file, "date_modified");
+	append_title_value_pair (table, _("Last modified:"), target_file, "date_modified");
 
 	if (should_show_accessed_date (window)) {
-		append_title_value_pair (table, _("Accessed:"), target_file, "date_accessed");
+		append_title_value_pair (table, _("Last accessed:"), target_file, "date_accessed");
 	}
 
-	if (should_show_custom_icon_buttons (window)) {
-		/* 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 */
-		image_uri = nautilus_file_get_metadata 
-			(original_file, NAUTILUS_METADATA_KEY_CUSTOM_ICON, NULL);
-		gtk_widget_set_sensitive (temp_button, image_uri != NULL);
-		g_free (image_uri);
-	}
 }
 
 static void
@@ -1753,7 +1729,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);
 
@@ -2013,7 +1989,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);
@@ -2043,9 +2018,29 @@
 
 	if (nautilus_file_can_get_permissions (file)) {
 		if (!nautilus_file_can_set_permissions (file)) {
-			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));
@@ -2084,7 +2079,13 @@
 			attach_value_field (page_table, last_row, VALUE_COLUMN, file, "group"); 
 		}
 
-		append_separator (page_table);
+		append_title_field (page_table, "", NULL);
+
+		append_title_value_pair (page_table, _("Text view:"), file, "permissions");
+		append_title_value_pair (page_table, _("Number view:"), file, "octal_permissions");
+		append_title_value_pair (page_table, _("Last changed:"), file, "date_permissions");
+
+		append_title_field (page_table, "", NULL);
 
 		checkbox_titles_row = append_title_field (page_table, _("Owner:"), NULL);
 		append_title_field (page_table, _("Group:"), NULL);
@@ -2147,15 +2148,13 @@
 					  PERMISSIONS_CHECKBOXES_EXECUTE_COLUMN,
 					  GNOME_VFS_PERM_OTHER_EXEC);
 
-		append_separator (page_table);
-
-		append_special_execution_flags (window, page_table);
-
-		append_title_value_pair (page_table, _("Text view:"), file, "permissions");		
-		append_title_value_pair (page_table, _("Number view:"), file, "octal_permissions");
-		append_title_value_pair (page_table, _("Last changed:"), file, "date_permissions");
+		if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS)) {
+			append_title_field (page_table, "", NULL);
+			append_special_execution_flags (window, page_table);
+		}
 		
 	} else {
+		/*TODO: convert to <big>*/
 		file_name = nautilus_file_get_display_name (file);
 		prompt_text = g_strdup_printf (_("The permissions of \"%s\" could not be determined."), file_name);
 		g_free (file_name);
@@ -2172,7 +2171,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);
 
@@ -2412,14 +2411,15 @@
 					 window, G_CONNECT_SWAPPED);
 
 	/* 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);
@@ -2441,7 +2441,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]