Commit 278287c1 authored by Paolo Bacchilega's avatar Paolo Bacchilega Committed by Paolo Bacchilega

Use g_filename_display_name and g_filename_display_basename.

2005-04-20  Paolo Bacchilega  <paobac@cvs.gnome.org>

	* src/dlg-prop.c (dlg_prop):
	* src/dlg-batch-add.c (add_clicked_cb):
	* src/dlg-add-folder.c (selection_changed_cb)
	(file_sel_response_cb):
	* src/dlg-add-files.c (selection_changed_cb)
	(file_sel_response_cb):
	* src/window.c:

	Use g_filename_display_name and g_filename_display_basename.

	* src/fr-command-zip.c (process_line__common):
	* src/fr-process.c (process_error, process_output):

	removed useless hacks.
parent e59497cb
2005-04-20 Paolo Bacchilega <paobac@cvs.gnome.org>
* src/dlg-prop.c (dlg_prop):
* src/dlg-batch-add.c (add_clicked_cb):
* src/dlg-add-folder.c (selection_changed_cb)
(file_sel_response_cb):
* src/dlg-add-files.c (selection_changed_cb)
(file_sel_response_cb):
* src/window.c:
Use g_filename_display_name and g_filename_display_basename.
* src/fr-command-zip.c (process_line__common):
* src/fr-process.c (process_error, process_output):
removed useless hacks.
2005-04-17 Paolo Bacchilega <paobac@cvs.gnome.org>
* src/actions.c (activate_action_about): s/translator_credits/translator-credits/
* src/actions.c (activate_action_about):
s/translator_credits/translator-credits/
Fixes bug #300956: Please use a hyphen instead of an underscore, i.e
"translator-credits".
......
......@@ -81,7 +81,7 @@ file_sel_response_cb (GtkWidget *widget,
char *utf8_path;
char *message;
utf8_path = g_filename_to_utf8 (current_folder, -1, NULL, NULL, NULL);
utf8_path = g_filename_display_name (current_folder);
message = g_strdup_printf (_("You don't have the right permissions to read files from folder \"%s\""), utf8_path);
g_free (utf8_path);
......@@ -143,7 +143,7 @@ selection_changed_cb (GtkWidget *file_sel,
char *utf8_path;
char *message;
utf8_path = g_filename_to_utf8 (current_folder, -1, NULL, NULL, NULL);
utf8_path = g_filename_display_name (current_folder);
message = g_strdup_printf (_("You don't have the right permissions to read files from folder \"%s\""), utf8_path);
g_free (utf8_path);
......
......@@ -114,7 +114,7 @@ file_sel_response_cb (GtkWidget *widget,
char *utf8_path;
char *message;
utf8_path = g_filename_to_utf8 (current_folder, -1, NULL, NULL, NULL);
utf8_path = g_filename_display_name (current_folder);
message = g_strdup_printf (_("You don't have the right permissions to read files from folder \"%s\""), utf8_path);
g_free (utf8_path);
......@@ -243,7 +243,7 @@ selection_changed_cb (GtkWidget *file_sel,
char *utf8_path;
char *message;
utf8_path = g_filename_to_utf8 (current_folder, -1, NULL, NULL, NULL);
utf8_path = g_filename_display_name (current_folder);
message = g_strdup_printf (_("You don't have the right permissions to read files from folder \"%s\""), utf8_path);
g_free (utf8_path);
......
......@@ -117,7 +117,7 @@ add_clicked_cb (GtkWidget *widget,
} else if (strchrs (archive_name, BAD_CHARS)) {
GtkWidget *d;
char *utf8_name = g_filename_to_utf8 (archive_name, -1, NULL, NULL, NULL);
char *utf8_name = g_filename_display_name (archive_name);
char *reason = g_strdup_printf (_("The name \"%s\" is not valid because it cannot contain the characters: %s\n\n%s"), utf8_name, BAD_CHARS, _("Please use a different name."));
d = _gtk_message_dialog_new (GTK_WINDOW (window->app),
......
......@@ -75,7 +75,6 @@ dlg_prop (FRWindow *window)
GtkWidget *label_label;
GtkWidget *label;
char *s;
const char *s1;
GnomeVFSFileSize size, uncompressed_size;
struct tm *tm;
time_t timer;
......@@ -103,9 +102,9 @@ dlg_prop (FRWindow *window)
set_label (label_label, _("Path:"));
label = glade_xml_get_widget (data->gui, "p_path_label");
/* window->archive_filename is unescaped. */
/* note: window->archive_filename is unescaped. */
s = remove_level_from_path (window->archive_filename);
utf8_name = g_filename_to_utf8 (s, -1, NULL, NULL, NULL);
utf8_name = g_filename_display_name (s);
gtk_label_set_text (GTK_LABEL (label), utf8_name);
g_free (utf8_name);
g_free (s);
......@@ -116,8 +115,7 @@ dlg_prop (FRWindow *window)
set_label (label_label, _("Name:"));
label = glade_xml_get_widget (data->gui, "p_name_label");
s1 = file_name_from_path (window->archive_filename);
utf8_name = g_filename_to_utf8 (s1, -1, NULL, NULL, NULL);
utf8_name = g_filename_display_basename (window->archive_filename);
gtk_label_set_text (GTK_LABEL (label), utf8_name);
title_txt = g_strdup_printf (_("%s Properties"), utf8_name);
......
......@@ -139,6 +139,10 @@ list__process_line (char *line,
return;
line_l = strlen (line);
if (line_l == 0)
return;
if (line_l > EMPTY_ARCHIVE_WARNING_LENGTH)
if (strcmp (line + line_l - EMPTY_ARCHIVE_WARNING_LENGTH,
EMPTY_ARCHIVE_WARNING) == 0) {
......@@ -239,14 +243,11 @@ process_line__common (char *line,
gpointer data)
{
FRCommand *comm = FR_COMMAND (data);
char *local_line;
if (line == NULL)
return;
local_line = g_strdup (line);
fr_command_message (comm, local_line);
g_free (local_line);
fr_command_message (comm, line);
if (comm->n_files != 0) {
double fraction = (double) comm->n_file++ / comm->n_files;
......
......@@ -469,9 +469,7 @@ process_output (FRProcess *fr_proc)
g_strdup (line));
if ((fr_proc->o_proc_line_func != NULL) && (line != NULL)) {
char *tmp_line = g_strdup (line);
(*fr_proc->o_proc_line_func) (tmp_line, fr_proc->o_proc_line_data);
g_free (tmp_line);
(*fr_proc->o_proc_line_func) (line, fr_proc->o_proc_line_data);
}
line = eol + 1;
......@@ -514,9 +512,7 @@ process_error (FRProcess *fr_proc)
g_strdup (line));
if ((fr_proc->e_proc_line_func != NULL) && (line != NULL)) {
char *tmp_line = g_strdup (line);
(*fr_proc->e_proc_line_func) (tmp_line, fr_proc->e_proc_line_data);
g_free (tmp_line);
(*fr_proc->e_proc_line_func) (line, fr_proc->e_proc_line_data);
}
line = eol + 1;
......
......@@ -534,7 +534,10 @@ _gtk_entry_set_locale_text (GtkEntry *entry,
char *utf8_text;
utf8_text = g_locale_to_utf8 (text, -1, NULL, NULL, NULL);
gtk_entry_set_text (entry, utf8_text);
if (utf8_text != NULL)
gtk_entry_set_text (entry, utf8_text);
else
gtk_entry_set_text (entry, "");
g_free (utf8_text);
}
......@@ -562,8 +565,11 @@ _gtk_label_set_locale_text (GtkLabel *label,
char *utf8_text;
utf8_text = g_locale_to_utf8 (text, -1, NULL, NULL, NULL);
gtk_label_set_text (label, utf8_text);
g_free (utf8_text);
if (utf8_text != NULL) {
gtk_label_set_text (label, utf8_text);
g_free (utf8_text);
} else
gtk_label_set_text (label, "");
}
......@@ -590,8 +596,11 @@ _gtk_entry_set_filename_text (GtkEntry *entry,
char *utf8_text;
utf8_text = g_filename_to_utf8 (text, -1, NULL, NULL, NULL);
gtk_entry_set_text (entry, utf8_text);
g_free (utf8_text);
if (utf8_text != NULL) {
gtk_entry_set_text (entry, utf8_text);
g_free (utf8_text);
} else
gtk_entry_set_text (entry, "");
}
......@@ -617,7 +626,7 @@ _gtk_label_set_filename_text (GtkLabel *label,
{
char *utf8_text;
utf8_text = g_filename_to_utf8 (text, -1, NULL, NULL, NULL);
utf8_text = g_filename_display_name (text);
gtk_label_set_text (label, utf8_text);
g_free (utf8_text);
}
......
......@@ -682,12 +682,11 @@ update_file_list_idle (gpointer callback_data)
char *utf8_name;
pixbuf = get_icon (window->app, fdata);
utf8_name = g_filename_to_utf8 (fdata->list_name,
-1, NULL, NULL, NULL);
utf8_name = g_filename_display_name (fdata->list_name);
gtk_list_store_prepend (window->list_store, &iter);
if (fdata->is_dir) {
char *tmp = remove_ending_separator (window_get_current_location (window));
char *utf8_path = g_filename_to_utf8 (tmp, -1, 0, 0, 0);
char *utf8_path = g_filename_display_name (tmp);
gtk_list_store_set (window->list_store, &iter,
COLUMN_FILE_DATA, fdata,
COLUMN_ICON, pixbuf,
......@@ -710,7 +709,7 @@ update_file_list_idle (gpointer callback_data)
s_time = get_time_string (fdata->modified);
desc = file_data_get_type_description (fdata);
utf8_path = g_filename_to_utf8 (fdata->path, -1, 0, 0, 0);
utf8_path = g_filename_display_name (fdata->path);
gtk_list_store_set (window->list_store, &iter,
COLUMN_FILE_DATA, fdata,
......@@ -852,7 +851,7 @@ _window_update_title (FRWindow *window)
char *title;
char *utf8_name;
utf8_name = g_filename_to_utf8 (file_name_from_path (window->archive_filename), -1, NULL, NULL, NULL);
utf8_name = g_filename_display_basename (window->archive_filename);
title = g_strdup_printf ("%s %s",
utf8_name,
window->archive->read_only ? _("[read only]") : "");
......@@ -1504,7 +1503,7 @@ open_folder (GtkWindow *parent,
char *utf8_name;
char *message;
utf8_name = g_filename_to_utf8 (folder, -1, 0, 0, 0);
utf8_name = g_filename_display_name (folder);
message = g_strdup_printf (_("Could not display the folder \"%s\""), utf8_name);
g_free (utf8_name);
d = _gtk_message_dialog_new (parent,
......@@ -3042,6 +3041,9 @@ window_message_cb (FRCommand *command,
else
utf8_msg = g_strdup (msg);
if (utf8_msg == NULL)
return TRUE;
if (g_utf8_validate (utf8_msg, -1, NULL))
gtk_label_set_text (GTK_LABEL (window->pd_message), utf8_msg);
......@@ -4178,7 +4180,7 @@ window_archive_open (FRWindow *current_window,
char *utf8_name, *message;
char *reason;
utf8_name = g_filename_to_utf8 (file_name_from_path (window->archive_filename), -1, 0, 0, 0);
utf8_name = g_filename_display_basename (window->archive_filename);
message = g_strdup_printf (_("Could not open \"%s\""), utf8_name);
g_free (utf8_name);
reason = gerror != NULL ? gerror->message : "";
......@@ -4236,7 +4238,7 @@ window_archive_save_as (FRWindow *window,
char *utf8_name;
char *message;
utf8_name = g_filename_to_utf8 (file_name_from_path (filename), -1, NULL, NULL, NULL);
utf8_name = g_filename_display_basename (filename);
message = g_strdup_printf (_("Could not save the archive \"%s\""), file_name_from_path (filename));
g_free (utf8_name);
......@@ -5142,7 +5144,7 @@ valid_name (const char *new_name,
gboolean retval = TRUE;
new_name = eat_spaces (new_name);
utf8_new_name = g_filename_to_utf8 (new_name, -1, NULL, NULL, NULL);
utf8_new_name = g_filename_display_name (new_name);
if (*new_name == '\0') {
*reason = g_strdup_printf ("%s\n\n%s", _("The new name is void."), _("Please use a different name."));
......@@ -5207,7 +5209,7 @@ name_is_present (FRWindow *window,
if ((strncmp (filename, new_filename, new_filename_l) == 0)
&& ((filename[new_filename_l] == '\0')
|| (filename[new_filename_l] == G_DIR_SEPARATOR))) {
char *utf8_name = g_filename_to_utf8 (new_name, -1, NULL, NULL, NULL);
char *utf8_name = g_filename_display_name (new_name);
if (filename[new_filename_l] == G_DIR_SEPARATOR)
*reason = g_strdup_printf (_("A folder named \"%s\" already exists.\n\n%s"), utf8_name, _("Please use a different name."));
......@@ -5265,7 +5267,7 @@ window_rename_selection (FRWindow *window)
g_free (utf8_new_name);
if (! valid_name (new_name, old_name, &reason)) {
char *utf8_name = g_filename_to_utf8 (new_name, -1, NULL, NULL, NULL);
char *utf8_name = g_filename_display_name (new_name);
GtkWidget *dlg;
dlg = _gtk_message_dialog_new (GTK_WINDOW (window->app),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment