Patch for bug 100268: "Show %s" in nautilus problematic for translation



Hello, gentle maintainers.

I have submitted a patch for bug 100268
(http://bugzilla.gnome.org/show_bug.cgi?id=100268): "Show %s" in
nautilus problematic for translation.  The patch is also attached to
this email.


From the bug report:
"This "Show %s" message in nautilus-side-pane.c is problematic for
translation, for the same reasons as mentioned in bug 45462 It would be
much better if the message could be translated as a whole, and the code
redesigned to allow for this."


My patch makes tooltips first-tier metadata and includes the necessary
infrastructure to bring the strings from each side pane module down to the
panel core code.

Though, it seems rather academic to me because none of the default panes have
icons which means that none of them create shortcuts on which to have tooltips.
 Nonetheless, if that situation changes, the tooltips will be ready.

Please cc me.

-mt
? depcomp
? libbackground
? nautilus-folder-handler.desktop
? stamp-h1
Index: libnautilus-private/nautilus-sidebar.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-sidebar.c,v
retrieving revision 1.2
diff -u -p -r1.2 nautilus-sidebar.c
--- libnautilus-private/nautilus-sidebar.c	22 Nov 2004 15:24:36 -0000	1.2
+++ libnautilus-private/nautilus-sidebar.c	23 Jun 2005 01:44:46 -0000
@@ -97,6 +97,14 @@ nautilus_sidebar_get_tab_label (Nautilus
 	return (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->get_tab_label) (sidebar);
 }
 
+char *
+nautilus_sidebar_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	g_return_val_if_fail (NAUTILUS_IS_SIDEBAR (sidebar), NULL);
+	
+	return (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->get_tab_tooltip) (sidebar);
+}
+
 GdkPixbuf *
 nautilus_sidebar_get_tab_icon (NautilusSidebar *sidebar)
 {
Index: libnautilus-private/nautilus-sidebar.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-sidebar.h,v
retrieving revision 1.2
diff -u -p -r1.2 nautilus-sidebar.h
--- libnautilus-private/nautilus-sidebar.h	22 Nov 2004 15:24:36 -0000	1.2
+++ libnautilus-private/nautilus-sidebar.h	23 Jun 2005 01:44:46 -0000
@@ -49,6 +49,7 @@ struct _NautilusSidebarIface 
 	/* VTable: */
 	const char *   (* get_sidebar_id)         (NautilusSidebar *sidebar);
 	char *         (* get_tab_label)          (NautilusSidebar *sidebar);
+	char *         (* get_tab_tooltip)        (NautilusSidebar *sidebar);
         GdkPixbuf *    (* get_tab_icon)           (NautilusSidebar *sidebar);
         void           (* is_visible_changed)     (NautilusSidebar *sidebar,
 						   gboolean         is_visible);
@@ -69,6 +70,7 @@ GType             nautilus_sidebar_get_t
 
 const char *nautilus_sidebar_get_sidebar_id     (NautilusSidebar *sidebar);
 char *      nautilus_sidebar_get_tab_label      (NautilusSidebar *sidebar);
+char *      nautilus_sidebar_get_tab_tooltip    (NautilusSidebar *sidebar);
 GdkPixbuf * nautilus_sidebar_get_tab_icon       (NautilusSidebar *sidebar);
 void        nautilus_sidebar_is_visible_changed (NautilusSidebar *sidebar,
 						 gboolean         is_visible);
Index: src/nautilus-emblem-sidebar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-emblem-sidebar.c,v
retrieving revision 1.3
diff -u -p -r1.3 nautilus-emblem-sidebar.c
--- src/nautilus-emblem-sidebar.c	29 Nov 2004 16:39:31 -0000	1.3
+++ src/nautilus-emblem-sidebar.c	23 Jun 2005 01:44:47 -0000
@@ -1045,6 +1045,12 @@ nautilus_emblem_sidebar_get_tab_label (N
 	return g_strdup (_("Emblems"));
 }
 
+static char *
+nautilus_emblem_sidebar_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	return g_strdup (_("Show Emblems"));
+}
+
 static GdkPixbuf *
 nautilus_emblem_sidebar_get_tab_icon (NautilusSidebar *sidebar)
 {
@@ -1063,6 +1069,7 @@ nautilus_emblem_sidebar_iface_init (Naut
 {
 	iface->get_sidebar_id = nautilus_emblem_sidebar_get_sidebar_id;
 	iface->get_tab_label = nautilus_emblem_sidebar_get_tab_label;
+	iface->get_tab_tooltip = nautilus_emblem_sidebar_get_tab_tooltip;
 	iface->get_tab_icon = nautilus_emblem_sidebar_get_tab_icon;
 	iface->is_visible_changed = nautilus_emblem_sidebar_is_visible_changed;
 }
Index: src/nautilus-history-sidebar.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-history-sidebar.c,v
retrieving revision 1.2
diff -u -p -r1.2 nautilus-history-sidebar.c
--- src/nautilus-history-sidebar.c	22 Nov 2004 15:24:37 -0000	1.2
+++ src/nautilus-history-sidebar.c	23 Jun 2005 01:44:47 -0000
@@ -278,6 +278,12 @@ nautilus_history_sidebar_get_tab_label (
 	return g_strdup (_("History"));
 }
 
+static char *
+nautilus_history_sidebar_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	return g_strdup (_("Show History"));
+}
+
 static GdkPixbuf *
 nautilus_history_sidebar_get_tab_icon (NautilusSidebar *sidebar)
 {
@@ -296,6 +302,7 @@ nautilus_history_sidebar_iface_init (Nau
 {
 	iface->get_sidebar_id = nautilus_history_sidebar_get_sidebar_id;
 	iface->get_tab_label = nautilus_history_sidebar_get_tab_label;
+	iface->get_tab_tooltip = nautilus_history_sidebar_get_tab_tooltip;
 	iface->get_tab_icon = nautilus_history_sidebar_get_tab_icon;
 	iface->is_visible_changed = nautilus_history_sidebar_is_visible_changed;
 }
Index: src/nautilus-information-panel.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-information-panel.c,v
retrieving revision 1.228
diff -u -p -r1.228 nautilus-information-panel.c
--- src/nautilus-information-panel.c	25 Nov 2004 14:13:37 -0000	1.228
+++ src/nautilus-information-panel.c	23 Jun 2005 01:44:48 -0000
@@ -178,6 +178,12 @@ nautilus_information_panel_get_tab_label
 	return g_strdup (_("Information"));
 }
 
+static char *
+nautilus_information_panel_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	return g_strdup (_("Show Information"));
+}
+
 static GdkPixbuf *
 nautilus_information_panel_get_tab_icon (NautilusSidebar *sidebar)
 {
@@ -196,6 +202,7 @@ nautilus_information_panel_iface_init (N
 {
 	iface->get_sidebar_id = nautilus_information_panel_get_sidebar_id;
 	iface->get_tab_label = nautilus_information_panel_get_tab_label;
+	iface->get_tab_tooltip = nautilus_information_panel_get_tab_tooltip;
 	iface->get_tab_icon = nautilus_information_panel_get_tab_icon;
 	iface->is_visible_changed = nautilus_information_panel_is_visible_changed;
 }
Index: src/nautilus-navigation-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window.c,v
retrieving revision 1.428
diff -u -p -r1.428 nautilus-navigation-window.c
--- src/nautilus-navigation-window.c	11 Jan 2005 10:53:58 -0000	1.428
+++ src/nautilus-navigation-window.c	23 Jun 2005 01:44:49 -0000
@@ -456,6 +456,7 @@ nautilus_navigation_window_add_sidebar_p
 {
 	const char *sidebar_id;
 	char *label;
+	char *tooltip;
 	char *default_id;
 	GdkPixbuf *icon;
 
@@ -465,9 +466,12 @@ nautilus_navigation_window_add_sidebar_p
 	g_return_if_fail (g_list_find (window->sidebar_panels, sidebar_panel) == NULL);	
 
 	label = nautilus_sidebar_get_tab_label (sidebar_panel);
+	tooltip = nautilus_sidebar_get_tab_tooltip (sidebar_panel);
 	nautilus_side_pane_add_panel (window->sidebar, 
 				      GTK_WIDGET (sidebar_panel), 
-				      label);
+				      label,
+				      tooltip);
+	g_free (tooltip);
 	g_free (label);
 
 	icon = nautilus_sidebar_get_tab_icon (sidebar_panel);
Index: src/nautilus-notes-viewer.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-notes-viewer.c,v
retrieving revision 1.2
diff -u -p -r1.2 nautilus-notes-viewer.c
--- src/nautilus-notes-viewer.c	22 Nov 2004 15:24:37 -0000	1.2
+++ src/nautilus-notes-viewer.c	23 Jun 2005 01:44:50 -0000
@@ -388,6 +388,12 @@ nautilus_notes_viewer_get_tab_label (Nau
 	return g_strdup (_("Notes"));
 }
 
+static char *
+nautilus_notes_viewer_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	return g_strdup (_("Show Notes"));
+}
+
 static GdkPixbuf *
 nautilus_notes_viewer_get_tab_icon (NautilusSidebar *sidebar)
 {
@@ -415,6 +421,7 @@ nautilus_notes_viewer_sidebar_iface_init
 {
 	iface->get_sidebar_id = nautilus_notes_viewer_get_sidebar_id;
 	iface->get_tab_label = nautilus_notes_viewer_get_tab_label;
+	iface->get_tab_tooltip = nautilus_notes_viewer_get_tab_tooltip;
 	iface->get_tab_icon = nautilus_notes_viewer_get_tab_icon;
 	iface->is_visible_changed = nautilus_notes_viewer_is_visible_changed;
 }
Index: src/nautilus-side-pane.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-side-pane.c,v
retrieving revision 1.8
diff -u -p -r1.8 nautilus-side-pane.c
--- src/nautilus-side-pane.c	22 Nov 2004 15:24:37 -0000	1.8
+++ src/nautilus-side-pane.c	23 Jun 2005 01:44:50 -0000
@@ -42,6 +42,7 @@
 
 typedef struct {
 	char *title;
+	char *tooltip;
 	GtkWidget *widget;
 	GtkWidget *menu_item;
 	GtkWidget *shortcut;
@@ -94,6 +95,7 @@ static void
 side_panel_free (SidePanel *panel)
 {
 	g_free (panel->title);
+	g_free (panel->tooltip);
 	g_free (panel);
 }
 
@@ -473,7 +475,8 @@ nautilus_side_pane_new (void)
 void
 nautilus_side_pane_add_panel (NautilusSidePane *side_pane, 
 			      GtkWidget *widget, 
-			      const char *title)
+			      const char *title,
+			      const char *tooltip)
 {
 	SidePanel *panel;
 
@@ -482,9 +485,11 @@ nautilus_side_pane_add_panel (NautilusSi
 	g_return_if_fail (widget != NULL);
 	g_return_if_fail (GTK_IS_WIDGET (widget));
 	g_return_if_fail (title != NULL);
+	g_return_if_fail (tooltip != NULL);
 
 	panel = g_new0 (SidePanel, 1);
 	panel->title = g_strdup (title);
+	panel->tooltip = g_strdup (tooltip);
 	panel->widget = widget;
 
 	gtk_widget_show (widget);	
@@ -584,7 +589,6 @@ create_shortcut (NautilusSidePane *side_
 {
 	GtkWidget *button;
 	GtkWidget *image;
-	char *tip;
 	
 	button = gtk_button_new ();
 	gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
@@ -593,9 +597,7 @@ create_shortcut (NautilusSidePane *side_
 	g_signal_connect (button, "clicked", 
 			  G_CALLBACK (shortcut_clicked_callback), side_pane);
 
-	tip = g_strdup_printf (_("Show %s"), panel->title);
-	gtk_tooltips_set_tip (side_pane->details->tooltips, button, tip, NULL);
-	g_free (tip);
+	gtk_tooltips_set_tip (side_pane->details->tooltips, button, panel->tooltip, NULL);
 
 	image = gtk_image_new_from_pixbuf (pixbuf);
 	gtk_widget_show (image);
Index: src/nautilus-side-pane.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-side-pane.h,v
retrieving revision 1.7
diff -u -p -r1.7 nautilus-side-pane.h
--- src/nautilus-side-pane.h	22 Nov 2004 15:24:37 -0000	1.7
+++ src/nautilus-side-pane.h	23 Jun 2005 01:44:50 -0000
@@ -53,7 +53,8 @@ GType                  nautilus_side_pan
 NautilusSidePane      *nautilus_side_pane_new             (void);
 void                   nautilus_side_pane_add_panel       (NautilusSidePane *side_pane,
 							   GtkWidget        *widget,
-							   const char       *title);
+							   const char       *title,
+							   const char       *tooltip);
 void                   nautilus_side_pane_remove_panel    (NautilusSidePane *side_pane,
 							   GtkWidget        *widget);
 void                   nautilus_side_pane_show_panel      (NautilusSidePane *side_pane,
Index: src/file-manager/fm-tree-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-tree-view.c,v
retrieving revision 1.9.2.1
diff -u -p -r1.9.2.1 fm-tree-view.c
--- src/file-manager/fm-tree-view.c	10 Jun 2005 01:52:35 -0000	1.9.2.1
+++ src/file-manager/fm-tree-view.c	23 Jun 2005 01:44:51 -0000
@@ -1497,6 +1497,12 @@ fm_tree_view_get_tab_label (NautilusSide
 	return g_strdup (_("Tree"));
 }
 
+static char *
+fm_tree_view_get_tab_tooltip (NautilusSidebar *sidebar)
+{
+	return g_strdup (_("Show Tree"));
+}
+
 static GdkPixbuf *
 fm_tree_view_get_tab_icon (NautilusSidebar *sidebar)
 {
@@ -1522,6 +1528,7 @@ fm_tree_view_iface_init (NautilusSidebar
 {
 	iface->get_sidebar_id = fm_tree_view_get_sidebar_id;
 	iface->get_tab_label = fm_tree_view_get_tab_label;
+	iface->get_tab_tooltip = fm_tree_view_get_tab_tooltip;
 	iface->get_tab_icon = fm_tree_view_get_tab_icon;
 	iface->is_visible_changed = fm_tree_view_is_visible_changed;
 }

Attachment: signature.asc
Description: This is a digitally signed message part



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