Add a stock icon to the "Add bookmark" button.

2003-11-03  Federico Mena Quintero  <federico@ximian.com>

	* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
	icon to the "Add bookmark" button.

	* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
	* gtk/gtkfilesystemmodel.c: Likewise.
	* gtk/gtkfilechooser.c: Likewise.
	* gtk/gtkfilechooserdefault.c: Likewise.

Mon Nov  3 20:56:28 2003  Matthias Clasen  <maclas@gmx.de>
This commit is contained in:
Federico Mena Quintero 2003-11-03 20:24:04 +00:00 committed by Federico Mena Quintero
parent b31a2ece5c
commit 3dbad630ac
9 changed files with 102 additions and 36 deletions

View File

@ -1,3 +1,13 @@
2003-11-03 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
icon to the "Add bookmark" button.
* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
* gtk/gtkfilesystemmodel.c: Likewise.
* gtk/gtkfilechooser.c: Likewise.
* gtk/gtkfilechooserdefault.c: Likewise.
Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de> Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk.c: * gdk/gdk.c:

View File

@ -1,3 +1,13 @@
2003-11-03 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
icon to the "Add bookmark" button.
* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
* gtk/gtkfilesystemmodel.c: Likewise.
* gtk/gtkfilechooser.c: Likewise.
* gtk/gtkfilechooserdefault.c: Likewise.
Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de> Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk.c: * gdk/gdk.c:

View File

@ -1,3 +1,13 @@
2003-11-03 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
icon to the "Add bookmark" button.
* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
* gtk/gtkfilesystemmodel.c: Likewise.
* gtk/gtkfilechooser.c: Likewise.
* gtk/gtkfilechooserdefault.c: Likewise.
Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de> Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk.c: * gdk/gdk.c:

View File

@ -1,3 +1,13 @@
2003-11-03 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
icon to the "Add bookmark" button.
* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
* gtk/gtkfilesystemmodel.c: Likewise.
* gtk/gtkfilechooser.c: Likewise.
* gtk/gtkfilechooserdefault.c: Likewise.
Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de> Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk.c: * gdk/gdk.c:

View File

@ -1,3 +1,13 @@
2003-11-03 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (create_shortcuts_tree): Add a stock
icon to the "Add bookmark" button.
* gtk/gtkfilesystemunix.c: Mark missing strings for translation.
* gtk/gtkfilesystemmodel.c: Likewise.
* gtk/gtkfilechooser.c: Likewise.
* gtk/gtkfilechooserdefault.c: Likewise.
Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de> Mon Nov 3 20:56:28 2003 Matthias Clasen <maclas@gmx.de>
* gdk/gdk.c: * gdk/gdk.c:

View File

@ -21,10 +21,9 @@
#include "gtkfilechooser.h" #include "gtkfilechooser.h"
#include "gtkfilechooserprivate.h" #include "gtkfilechooserprivate.h"
#include "gtkfilesystem.h" #include "gtkfilesystem.h"
#include "gtkintl.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#define _(str) (str)
static void gtk_file_chooser_class_init (gpointer g_iface); static void gtk_file_chooser_class_init (gpointer g_iface);
static GtkFilePath *gtk_file_chooser_get_path (GtkFileChooser *chooser); static GtkFilePath *gtk_file_chooser_get_path (GtkFileChooser *chooser);
@ -1440,7 +1439,7 @@ gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
g_set_error (error, g_set_error (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
"Invalid filename: %s", _("Invalid filename: %s"),
folder); folder);
return FALSE; return FALSE;
} }
@ -1484,7 +1483,7 @@ gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
g_set_error (error, g_set_error (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
"Invalid filename: %s", _("Invalid filename: %s"),
folder); folder);
return FALSE; return FALSE;
} }
@ -1559,7 +1558,7 @@ gtk_file_chooser_add_shortcut_folder_uri (GtkFileChooser *chooser,
g_set_error (error, g_set_error (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
"Invalid filename: %s", _("Invalid filename: %s"),
uri); uri);
return FALSE; return FALSE;
} }
@ -1603,7 +1602,7 @@ gtk_file_chooser_remove_shortcut_folder_uri (GtkFileChooser *chooser,
g_set_error (error, g_set_error (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
"Invalid filename: %s", _("Invalid filename: %s"),
uri); uri);
return FALSE; return FALSE;
} }

View File

@ -35,6 +35,7 @@
#include "gtkhpaned.h" #include "gtkhpaned.h"
#include "gtkicontheme.h" #include "gtkicontheme.h"
#include "gtkimage.h" #include "gtkimage.h"
#include "gtkintl.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkmenuitem.h" #include "gtkmenuitem.h"
#include "gtkmessagedialog.h" #include "gtkmessagedialog.h"
@ -494,7 +495,7 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
char *label; char *label;
name = g_get_user_name (); name = g_get_user_name ();
label = g_strdup_printf ("%s's Home", name); label = g_strdup_printf (_("%s's Home"), name);
home = g_get_home_dir (); home = g_get_home_dir ();
home_path = gtk_file_system_filename_to_path (impl->file_system, home); home_path = gtk_file_system_filename_to_path (impl->file_system, home);
@ -514,7 +515,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
/* FIXME: What is the Right Way of finding the desktop directory? */ /* FIXME: What is the Right Way of finding the desktop directory? */
name = g_build_filename (g_get_home_dir (), "Desktop", NULL); name = g_build_filename (g_get_home_dir (), _("Desktop"), NULL);
path = gtk_file_system_filename_to_path (impl->file_system, name); path = gtk_file_system_filename_to_path (impl->file_system, name);
g_free (name); g_free (name);
@ -640,7 +641,7 @@ toolbar_up_cb (GtkToolButton *button,
else else
{ {
error_dialog (impl, error_dialog (impl,
"Could not go to the parent folder:\n%s", _("Could not go to the parent folder:\n%s"),
error); error);
g_error_free (error); g_error_free (error);
} }
@ -709,7 +710,7 @@ create_filter (GtkFileChooserDefault *impl)
gtk_container_add (GTK_CONTAINER (impl->filter_alignment), hbox); gtk_container_add (GTK_CONTAINER (impl->filter_alignment), hbox);
gtk_widget_show (hbox); gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic ("Files of _type:"); label = gtk_label_new_with_mnemonic (_("Files of _type:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
@ -765,7 +766,7 @@ create_folder_tree (GtkFileChooserDefault *impl)
/* Column */ /* Column */
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0, gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (impl->tree), 0,
"File name", _("File name"),
gtk_cell_renderer_text_new (), gtk_cell_renderer_text_new (),
tree_name_data_func, impl, NULL); tree_name_data_func, impl, NULL);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->tree), gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->tree),
@ -868,6 +869,8 @@ create_shortcuts_tree (GtkFileChooserDefault *impl)
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *hbox2;
GtkWidget *widget;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
@ -910,7 +913,7 @@ create_shortcuts_tree (GtkFileChooserDefault *impl)
/* Column */ /* Column */
column = gtk_tree_view_column_new (); column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Folder"); gtk_tree_view_column_set_title (column, _("Folder"));
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_pack_start (column, renderer, FALSE);
@ -932,22 +935,34 @@ create_shortcuts_tree (GtkFileChooserDefault *impl)
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox); gtk_widget_show (hbox);
impl->add_bookmark_button = gtk_button_new_with_label ("Add bookmark"); /* "Add bookmark" */
impl->add_bookmark_button = gtk_button_new ();
hbox2 = gtk_hbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (impl->add_bookmark_button), hbox2);
widget = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start (GTK_BOX (hbox2), widget, FALSE, FALSE, 0);
widget = gtk_label_new (_("Add bookmark"));
gtk_box_pack_start (GTK_BOX (hbox2), widget, FALSE, FALSE, 0);
gtk_widget_show_all (impl->add_bookmark_button);
g_signal_connect (impl->add_bookmark_button, "clicked", g_signal_connect (impl->add_bookmark_button, "clicked",
G_CALLBACK (add_bookmark_button_clicked_cb), impl); G_CALLBACK (add_bookmark_button_clicked_cb), impl);
gtk_box_pack_start (GTK_BOX (hbox), impl->add_bookmark_button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), impl->add_bookmark_button, FALSE, FALSE, 0);
gtk_widget_set_sensitive (impl->add_bookmark_button, FALSE); gtk_widget_set_sensitive (impl->add_bookmark_button, FALSE);
gtk_widget_show (impl->add_bookmark_button); gtk_widget_show (impl->add_bookmark_button);
/* "Remove bookmark" */
impl->remove_bookmark_button = gtk_button_new (); impl->remove_bookmark_button = gtk_button_new ();
g_signal_connect (impl->remove_bookmark_button, "clicked", g_signal_connect (impl->remove_bookmark_button, "clicked",
G_CALLBACK (remove_bookmark_button_clicked_cb), impl); G_CALLBACK (remove_bookmark_button_clicked_cb), impl);
image = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON); image = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (impl->remove_bookmark_button), image); gtk_container_add (GTK_CONTAINER (impl->remove_bookmark_button), image);
gtk_widget_show (image);
gtk_widget_set_sensitive (impl->remove_bookmark_button, FALSE); gtk_widget_set_sensitive (impl->remove_bookmark_button, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), impl->remove_bookmark_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), impl->remove_bookmark_button, FALSE, FALSE, 0);
gtk_widget_show (impl->remove_bookmark_button); gtk_widget_show_all (impl->remove_bookmark_button);
return vbox; return vbox;
} }
@ -986,7 +1001,7 @@ create_file_list (GtkFileChooserDefault *impl)
/* Filename column */ /* Filename column */
column = gtk_tree_view_column_new (); column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "File name"); gtk_tree_view_column_set_title (column, _("File name"));
gtk_tree_view_column_set_sort_column_id (column, FILE_LIST_COL_NAME); gtk_tree_view_column_set_sort_column_id (column, FILE_LIST_COL_NAME);
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
@ -1004,7 +1019,7 @@ create_file_list (GtkFileChooserDefault *impl)
/* Size column */ /* Size column */
column = gtk_tree_view_column_new (); column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Size"); gtk_tree_view_column_set_title (column, _("Size"));
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_pack_start (column, renderer, TRUE);
@ -1016,7 +1031,7 @@ create_file_list (GtkFileChooserDefault *impl)
/* Modification time column */ /* Modification time column */
column = gtk_tree_view_column_new (); column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Modified"); gtk_tree_view_column_set_title (column, _("Modified"));
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_pack_start (column, renderer, TRUE);
@ -1037,7 +1052,7 @@ create_filename_entry (GtkFileChooserDefault *impl)
hbox = gtk_hbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 6);
gtk_widget_show (hbox); gtk_widget_show (hbox);
label = gtk_label_new_with_mnemonic ("_Location:"); label = gtk_label_new_with_mnemonic (_("_Location:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
@ -1140,7 +1155,7 @@ gtk_file_chooser_default_constructor (GType type,
/* Preview */ /* Preview */
impl->preview_frame = gtk_frame_new ("Preview"); impl->preview_frame = gtk_frame_new (_("Preview"));
gtk_table_attach (GTK_TABLE (table), impl->preview_frame, gtk_table_attach (GTK_TABLE (table), impl->preview_frame,
1, 2, 0, 2, 1, 2, 0, 2,
0, GTK_EXPAND | GTK_FILL, 0, GTK_EXPAND | GTK_FILL,
@ -1886,7 +1901,7 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
g_set_error (error, g_set_error (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_NONEXISTENT, GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
"shortcut %s does not exist", _("shortcut %s does not exist"),
gtk_file_path_get_string (path)); gtk_file_path_get_string (path));
return FALSE; return FALSE;
@ -2357,13 +2372,13 @@ list_size_data_func (GtkTreeViewColumn *tree_column,
return; return;
if (size < (gint64)1024) if (size < (gint64)1024)
str = g_strdup_printf ("%d bytes", (gint)size); str = g_strdup_printf (_("%d bytes"), (gint)size);
else if (size < (gint64)1024*1024) else if (size < (gint64)1024*1024)
str = g_strdup_printf ("%.1f K", size / (1024.)); str = g_strdup_printf (_("%.1f K"), size / (1024.));
else if (size < (gint64)1024*1024*1024) else if (size < (gint64)1024*1024*1024)
str = g_strdup_printf ("%.1f M", size / (1024.*1024.)); str = g_strdup_printf (_("%.1f M"), size / (1024.*1024.));
else else
str = g_strdup_printf ("%.1f G", size / (1024.*1024.*1024.)); str = g_strdup_printf (_("%.1f G"), size / (1024.*1024.*1024.));
g_object_set (cell, g_object_set (cell,
"text", str, "text", str,
@ -2403,7 +2418,7 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
if (tm.tm_mday == now_tm.tm_mday if (tm.tm_mday == now_tm.tm_mday
&& tm.tm_mon == now_tm.tm_mon && tm.tm_mon == now_tm.tm_mon
&& tm.tm_year == now_tm.tm_year) && tm.tm_year == now_tm.tm_year)
strcpy (buf, "Today"); strcpy (buf, _("Today"));
else else
{ {
int i; int i;
@ -2423,10 +2438,10 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
&& tm.tm_year == then_tm.tm_year) && tm.tm_year == then_tm.tm_year)
{ {
if (i == 1) if (i == 1)
strcpy (buf, "Yesterday"); strcpy (buf, _("Yesterday"));
else else
if (strftime (buf, sizeof (buf), "%A", &tm) == 0) if (strftime (buf, sizeof (buf), "%A", &tm) == 0)
strcpy (buf, "Unknown"); strcpy (buf, _("Unknown"));
break; break;
} }
@ -2436,8 +2451,8 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
if (i == 7) if (i == 7)
{ {
if (strftime (buf, sizeof (buf), "%d/%b/%Y", &tm) == 0) if (strftime (buf, sizeof (buf), _("%d/%b/%Y"), &tm) == 0)
strcpy (buf, "Unknown"); strcpy (buf, _("Unknown"));
} }
} }

View File

@ -22,6 +22,7 @@
#include "gtkfilesystemmodel.h" #include "gtkfilesystemmodel.h"
#include "gtkfilesystem.h" #include "gtkfilesystem.h"
#include "gtkintl.h"
#include "gtktreemodel.h" #include "gtktreemodel.h"
typedef struct _GtkFileSystemModelClass GtkFileSystemModelClass; typedef struct _GtkFileSystemModelClass GtkFileSystemModelClass;
@ -1013,7 +1014,7 @@ file_model_node_get_info (GtkFileSystemModel *model,
if (node->is_dummy) if (node->is_dummy)
{ {
node->info = gtk_file_info_new (); node->info = gtk_file_info_new ();
gtk_file_info_set_display_name (node->info, "(Empty)"); gtk_file_info_set_display_name (node->info, _("(Empty)"));
} }
else if (node->parent || model->root_folder) else if (node->parent || model->root_folder)
{ {

View File

@ -20,6 +20,7 @@
#include "gtkfilesystem.h" #include "gtkfilesystem.h"
#include "gtkfilesystemunix.h" #include "gtkfilesystemunix.h"
#include "gtkintl.h"
#define XDG_PREFIX _gtk_xdg #define XDG_PREFIX _gtk_xdg
#include "xdgmime/xdgmime.h" #include "xdgmime/xdgmime.h"
@ -295,7 +296,7 @@ gtk_file_system_unix_create_folder (GtkFileSystem *file_system,
g_set_error (error, g_set_error (error,
GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR,
GTK_FILE_SYSTEM_ERROR_NONEXISTENT, GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
"error creating directory '%s': %s", _("error creating directory '%s': %s"),
filename_utf8 ? filename_utf8 : "???", filename_utf8 ? filename_utf8 : "???",
g_strerror (errno)); g_strerror (errno));
g_free (filename_utf8); g_free (filename_utf8);
@ -553,7 +554,7 @@ gtk_file_system_unix_add_bookmark (GtkFileSystem *file_system,
g_set_error (error, g_set_error (error,
GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR,
GTK_FILE_SYSTEM_ERROR_FAILED, GTK_FILE_SYSTEM_ERROR_FAILED,
"This file system does not support bookmarks"); _("This file system does not support bookmarks"));
return FALSE; return FALSE;
} }
@ -566,7 +567,7 @@ gtk_file_system_unix_remove_bookmark (GtkFileSystem *file_system,
g_set_error (error, g_set_error (error,
GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR,
GTK_FILE_SYSTEM_ERROR_FAILED, GTK_FILE_SYSTEM_ERROR_FAILED,
"This file system does not support bookmarks"); _("This file system does not support bookmarks"));
return FALSE; return FALSE;
} }
@ -737,7 +738,7 @@ filename_get_info (const gchar *filename,
g_set_error (error, g_set_error (error,
GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR,
GTK_FILE_SYSTEM_ERROR_NONEXISTENT, GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
"error getting information for '%s': %s", _("error getting information for '%s': %s"),
filename_utf8 ? filename_utf8 : "???", filename_utf8 ? filename_utf8 : "???",
g_strerror (errno)); g_strerror (errno));
g_free (filename_utf8); g_free (filename_utf8);