[PATCH] HIGify properties window



Bug 325024 [1] has the details and some screenshots.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=325024

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.226
diff -u -p -r1.226 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	20 Dec 2005 16:37:33 -0000	1.226
+++ src/file-manager/fm-properties-window.c	31 Dec 2005 12:34:26 -0000
@@ -40,6 +40,7 @@
 #include <eel/eel-wrap-table.h>
 #include <gtk/gtkalignment.h>
 #include <gtk/gtkcheckbutton.h>
+#include <gtk/gtkdialog.h>
 #include <gtk/gtkdnd.h>
 #include <gtk/gtkeditable.h>
 #include <gtk/gtkentry.h>
@@ -100,8 +101,9 @@ struct FMPropertiesWindowDetails {	
 	GtkWidget *icon_image;
 	GtkWidget *icon_chooser;
 
-	GtkWidget *name_label;
+	GtkLabel *name_label;
 	GtkWidget *name_field;
+	unsigned int name_row;
 	char *pending_name;
 
 	GtkLabel *directory_contents_title_field;
@@ -216,7 +218,7 @@ static GtkLabel *attach_ellipsizing_valu
 						   const char *initial_text);
 
 GNOME_CLASS_BOILERPLATE (FMPropertiesWindow, fm_properties_window,
-			 GtkWindow, GTK_TYPE_WINDOW);
+			 GtkDialog, GTK_TYPE_DIALOG);
 
 static gboolean
 is_multi_file_window (FMPropertiesWindow *window)
@@ -574,7 +576,11 @@ set_name_field (FMPropertiesWindow *wind
 		}
 
 		if (use_label) {
-			window->details->name_field = GTK_WIDGET (attach_ellipsizing_value_label (window->details->basic_table, 0, VALUE_COLUMN, name));		
+			window->details->name_field =
+				GTK_WIDGET (attach_ellipsizing_value_label
+					(window->details->basic_table,
+					 window->details->name_row,
+					 VALUE_COLUMN, name));		
 		} else {
 			window->details->name_field = nautilus_entry_new ();
 			gtk_entry_set_text (GTK_ENTRY (window->details->name_field), name);
@@ -583,7 +589,8 @@ set_name_field (FMPropertiesWindow *wind
 					  window->details->name_field,
 					  VALUE_COLUMN, 
 					  VALUE_COLUMN + 1,
-					  0, 1,
+					  window->details->name_row,
+					  window->details->name_row + 1,
 					  GTK_FILL, 0,
 					  0, 0);
 			gtk_label_set_mnemonic_widget (GTK_LABEL (window->details->name_label), window->details->name_field);
@@ -633,7 +640,11 @@ static void
 update_name_field (FMPropertiesWindow *window)
 {
 	NautilusFile *file;
-	
+
+	gtk_label_set_text_with_mnemonic (window->details->name_label,
+					  ngettext ("_Name:", "_Names:",
+						    get_not_gone_original_file_count (window)));
+
 	if (is_multi_file_window (window)) {
 		/* Multifile property dialog, show all names */
 		GString *str;
@@ -1822,23 +1833,6 @@ append_row (GtkTable *table)
 	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)
 {
@@ -2020,7 +2014,7 @@ attach_title_field (GtkTable *table,
 		     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, FALSE, FALSE, FALSE, TRUE);
 }		      
 
 static guint
@@ -2077,6 +2071,16 @@ append_title_and_ellipsizing_value (FMPr
 	return last_row;
 }
 
+static GtkWidget *
+append_blank_row (GtkTable *table)
+{
+	GtkWidget *separator;
+
+	append_title_field (table, "", (GtkLabel **) &separator);
+
+	return separator;
+}
+
 static void
 update_visibility_of_table_rows (GtkTable *table,
 		   	 	 gboolean should_show,
@@ -2096,7 +2100,7 @@ update_visibility_of_table_rows (GtkTabl
 	}
 
 	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);
 	}
 }				   
 
@@ -2130,7 +2134,7 @@ create_page_with_vbox (GtkNotebook *note
 
 	vbox = gtk_vbox_new (FALSE, 0);
 	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;
@@ -2139,8 +2143,8 @@ create_page_with_vbox (GtkNotebook *note
 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 *
@@ -2270,49 +2274,41 @@ static void
 create_basic_page (FMPropertiesWindow *window)
 {
 	GtkTable *table;
-	GtkWidget *container;
+	GtkLabel *icon_label;
 	GtkWidget *icon_aligner;
-	GtkWidget *icon_pixmap_widget;
-
-	GtkWidget *hbox, *name_label;
+	GtkWidget *icon_widget;
+	unsigned int row;
 
 	create_page_with_table_in_vbox (window->details->notebook, 
 					_("Basic"), 
 					1,
-					&table, 
-					&container);
+					&table,
+					NULL);
 	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_pixmap_widget = create_image_widget (
-		window, should_show_custom_icon_buttons (window));
-	gtk_widget_show (icon_pixmap_widget);
+	/* Icon label */
+	row = append_title_field (table, _("Ic_on:"), &icon_label);
 
-	icon_aligner = gtk_alignment_new (1, 0.5, 0, 0);
+	/* Icon image */
+	icon_aligner = gtk_alignment_new (0.0, 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_table_attach (table, icon_aligner,
+			  VALUE_COLUMN, VALUE_COLUMN + 1,
+			  row, row + 1,
+			  GTK_FILL, 0,
+			  0, 0);
+
+	icon_widget = create_image_widget (window, should_show_custom_icon_buttons (window));
+	gtk_label_set_mnemonic_widget (icon_label, icon_widget);
+	gtk_widget_show (icon_widget);
+	gtk_container_add (GTK_CONTAINER (icon_aligner), icon_widget);
 
 	window->details->icon_chooser = NULL;
 
-	/* Name label */
-	name_label = gtk_label_new_with_mnemonic (ngettext ("_Name:", "_Names:",
-							    get_not_gone_original_file_count (window)));
-	eel_gtk_label_make_bold (GTK_LABEL (name_label));
-	gtk_widget_show (name_label);
-	gtk_box_pack_end (GTK_BOX (hbox), name_label, FALSE, FALSE, 0);
-	window->details->name_label = name_label;
+	/* Name label. The text will be determined in update_name_field */
+	row = append_title_field (table, NULL, &window->details->name_label);
+	window->details->name_row = row;
 
 	/* Name field */
 	window->details->name_field = NULL;
@@ -2332,6 +2328,21 @@ create_basic_page (FMPropertiesWindow *w
 					 FALSE);
 	}
 
+	if (should_show_link_target (window)) {
+		append_title_and_ellipsizing_value (window, table, 
+						    _("Link target:"), 
+						    "link_target",
+						    _("--"),
+						    FALSE);
+	}
+
+	if (should_show_mime_type (window)) {
+		append_title_value_pair (window, table, _("MIME type:"), 
+					 "mime_type",
+					 _("--"),
+					 FALSE);
+	}				  
+
 	if (is_multi_file_window (window) ||
 	    nautilus_file_is_directory (get_target_file (window))) {
 		append_directory_contents_fields (window, table);
@@ -2346,8 +2357,23 @@ create_basic_page (FMPropertiesWindow *w
 					    "where",
 					    _("--"),
 					    TRUE);
-	
+
+	if (should_show_accessed_date (window)) {
+		append_blank_row (table);
+
+		append_title_value_pair (window, table, _("Modified:"), 
+					 "date_modified",
+					 _("--"),
+					 FALSE);
+		append_title_value_pair (window, table, _("Accessed:"), 
+					 "date_accessed",
+					 _("--"),
+					 FALSE);
+	}
+
 	if (should_show_free_space (window)) {
+		append_blank_row (table);
+
 		append_title_and_ellipsizing_value (window, table, 
 						    _("Volume:"), 
 						    "volume",
@@ -2358,35 +2384,6 @@ create_basic_page (FMPropertiesWindow *w
 					 _("--"),
 					 FALSE);
 	}
-
-	if (should_show_link_target (window)) {
-		append_title_and_ellipsizing_value (window, table, 
-						    _("Link target:"), 
-						    "link_target",
-						    _("--"),
-						    FALSE);
-	}
-	if (should_show_mime_type (window)) {
-		append_title_value_pair (window, table, _("MIME type:"), 
-					 "mime_type",
-					 _("--"),
-					 FALSE);
-	}				  
-	
-	/* Blank title ensures standard row height */
-	append_title_field (table, "", NULL);
-	
-	append_title_value_pair (window, table, _("Modified:"), 
-				 "date_modified",
-				 _("--"),
-				 FALSE);
-	
-	if (should_show_accessed_date (window)) {
-		append_title_value_pair (window, table, _("Accessed:"), 
-					 "date_accessed",
-					 _("--"),
-					 FALSE);
-	}
 }
 
 static GHashTable *
@@ -2425,7 +2422,7 @@ create_emblems_page (FMPropertiesWindow 
 	/* 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);
 
@@ -2814,7 +2811,7 @@ append_special_execution_flags (FMProper
 	remember_special_flags_widget (window, append_special_execution_checkbox 
 		(window, table, _("_Sticky"), GNOME_VFS_PERM_STICKY));
 
-	remember_special_flags_widget (window, append_separator (table));
+	remember_special_flags_widget (window, append_blank_row (table));
 	++window->details->num_special_flags_rows;
 
 	update_visibility_of_special_flags_widgets (window);
@@ -2963,7 +2960,7 @@ create_permissions_page (FMPropertiesWin
 					    FALSE); 
 		}
 
-		append_separator (page_table);
+		append_blank_row (page_table);
 		
 		checkbox_titles_row = append_title_field (page_table, _("Owner:"), &owner_perm_label);
 		append_title_field (page_table, _("Group:"), &group_perm_label);
@@ -3044,22 +3041,22 @@ create_permissions_page (FMPropertiesWin
 					  GNOME_VFS_PERM_OTHER_EXEC,
 					  other_perm_label);
 
-		append_separator (page_table);
+		append_blank_row (page_table);
 
 		append_special_execution_flags (window, page_table);
-		
+
+		/* translators: This refers to a symbolic representation
+		 * of file permissions. For details, see man 1 chmod */
 		append_title_value_pair
-			(window, page_table, _("Text view:"), 
+			(window, page_table, _("Symbolic view:"), 
 			 "permissions", _("--"),
 			 FALSE);
+		/* translators: This refers to an octal representation
+		 * of file permissions. For details, see man 1 chmod */
 		append_title_value_pair 
-			(window, page_table, _("Number view:"), 
+			(window, page_table, _("Octal view:"), 
 			 "octal_permissions", _("--"),
 			 FALSE);
-		append_title_value_pair
-			(window, page_table, _("Last changed:"), 
-			 "date_permissions", _("--"),
-			 FALSE);
 	} else {
 		if (!is_multi_file_window (window)) {
 			file_name = nautilus_file_get_display_name (get_target_file (window));
@@ -3215,22 +3212,6 @@ startup_data_free (StartupData *data)
 }
 
 static void
-help_button_callback (GtkWidget *widget, GtkWidget *property_window)
-{
-	GError *error = NULL;
-
-	gnome_help_display_desktop_on_screen (NULL, "user-guide", "user-guide.xml", "gosnautilus-51",
-					      gtk_window_get_screen (GTK_WINDOW (property_window)),
-&error);
-
-	if (error) {
-		eel_show_error_dialog (_("There was an error displaying help."), error->message,
-				       GTK_WINDOW (property_window));
-		g_error_free (error);
-	}
-}
-
-static void
 file_changed_callback (NautilusFile *file, gpointer user_data)
 {
 	FMPropertiesWindow *window = FM_PROPERTIES_WINDOW (user_data);
@@ -3294,9 +3275,6 @@ static FMPropertiesWindow *
 create_properties_window (StartupData *startup_data)
 {
 	FMPropertiesWindow *window;
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *button;
 	GList *l;
 
 	window = FM_PROPERTIES_WINDOW (gtk_widget_new (fm_properties_window_get_type (), NULL));
@@ -3365,17 +3343,11 @@ create_properties_window (StartupData *s
 					 0);
 	}
 
-	/* Create box for notebook and button box. */
-	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
-	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_widget_show (GTK_WIDGET (window->details->notebook));
-	gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (window->details->notebook),
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
+			    GTK_WIDGET (window->details->notebook),
 			    TRUE, TRUE, 0);
 
 	/* Create the pages. */
@@ -3396,27 +3368,17 @@ create_properties_window (StartupData *s
 	/* append pages from available views */
 	append_extension_pages (window);
 
-	/* 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_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_EDGE);
-
-	button = gtk_button_new_from_stock (GTK_STOCK_HELP);
- 	gtk_widget_show (button);
-	gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (button),
-			    FALSE, TRUE, 0);
-	g_signal_connect_object (button, "clicked",
-				 G_CALLBACK (help_button_callback),
-				 window, 0);
-	
-	button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
-	gtk_widget_show (button);
-	gtk_box_pack_end (GTK_BOX (hbox), GTK_WIDGET (button),
-			    FALSE, TRUE, 0);
-	g_signal_connect_swapped (button, "clicked",
-				  G_CALLBACK (gtk_widget_destroy),
-				  window);
+	gtk_dialog_add_buttons (GTK_DIALOG (window),
+				GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+				GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+				NULL);
+
+	/* FIXME - HIGificiation, should be done inside GTK+ */
+	gtk_widget_ensure_style (GTK_WIDGET (window));
+	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (window)->vbox), 12);
+	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (window)->action_area), 0);
+	gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (window)->vbox), 12);
+	gtk_dialog_set_has_separator (GTK_DIALOG (window), FALSE);
 
 	/* Update from initial state */
 	properties_window_update (window, NULL);
@@ -3641,6 +3603,36 @@ fm_properties_window_present (GList *ori
 }
 
 static void
+real_response (GtkDialog *dialog,
+	       int        response)
+{
+	GError *error = NULL;
+
+	switch (response) {
+	case GTK_RESPONSE_HELP:
+		gnome_help_display_desktop_on_screen (NULL, "user-guide", "user-guide.xml", "gosnautilus-51",
+						      gtk_window_get_screen (GTK_WINDOW (dialog)),
+						      &error);
+		if (error != NULL) {
+			eel_show_error_dialog (_("There was an error displaying help."), error->message,
+					       GTK_WINDOW (dialog));
+			g_error_free (error);
+		}
+		break;
+
+	case GTK_RESPONSE_NONE:
+	case GTK_RESPONSE_CLOSE:
+	case GTK_RESPONSE_DELETE_EVENT:
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+
+	default:
+		g_assert_not_reached ();
+		break;
+	}
+}
+
+static void
 real_destroy (GtkObject *object)
 {
 	FMPropertiesWindow *window;
@@ -3950,12 +3942,11 @@ fm_properties_window_class_init (FMPrope
 {
 	G_OBJECT_CLASS (class)->finalize = real_finalize;
 	GTK_OBJECT_CLASS (class)->destroy = real_destroy;
+	GTK_DIALOG_CLASS (class)->response = real_response;
 }
 
 static void
 fm_properties_window_instance_init (FMPropertiesWindow *window)
 {
 	window->details = g_new0 (FMPropertiesWindowDetails, 1);
-
-	eel_gtk_window_set_up_close_accelerator (GTK_WINDOW (window));
 }
Index: src/file-manager/fm-properties-window.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.h,v
retrieving revision 1.13
diff -u -p -r1.13 fm-properties-window.h
--- src/file-manager/fm-properties-window.h	22 Nov 2004 15:24:38 -0000	1.13
+++ src/file-manager/fm-properties-window.h	31 Dec 2005 12:34:26 -0000
@@ -26,7 +26,7 @@
 #ifndef FM_PROPERTIES_WINDOW_H
 #define FM_PROPERTIES_WINDOW_H
 
-#include <gtk/gtkwindow.h>
+#include <gtk/gtkdialog.h>
 #include <libnautilus-private/nautilus-file.h>
 
 typedef struct FMPropertiesWindow FMPropertiesWindow;
@@ -45,12 +45,12 @@ typedef struct FMPropertiesWindow FMProp
 typedef struct FMPropertiesWindowDetails FMPropertiesWindowDetails;
 
 struct FMPropertiesWindow {
-	GtkWindow window;
+	GtkDialog dialog;
 	FMPropertiesWindowDetails *details;	
 };
 
 struct FMPropertiesWindowClass {
-	GtkWindowClass parent_class;
+	GtkDialogClass parent_class;
 };
 
 typedef struct FMPropertiesWindowClass FMPropertiesWindowClass;

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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