* gnome-file-property-dialog.c: Use MSG_ERROR instead of "Error" as
message()'s second parameter. (apply_name_change): Release base_name after use.
Этот коммит содержится в:
родитель
edc1de7d15
Коммит
ac5a82ac35
@ -199,18 +199,10 @@ create_general_properties (GnomeFilePropertyDialog *fp_dlg)
|
|||||||
/* File statistics */
|
/* File statistics */
|
||||||
/* File type first */
|
/* File type first */
|
||||||
if (S_ISREG (fp_dlg->st.st_mode)) {
|
if (S_ISREG (fp_dlg->st.st_mode)) {
|
||||||
if (use_magic)
|
gen_string = g_strconcat (_("File Type: "), use_magic ?
|
||||||
{
|
gnome_mime_type_or_default_of_file (fp_dlg->file_name, "text/plain") :
|
||||||
gen_string = g_strconcat (_("File Type: "),
|
gnome_mime_type (fp_dlg->file_name),
|
||||||
gnome_mime_type_or_default_of_file (fp_dlg->file_name, "text/plain"),
|
NULL);
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gen_string = g_strconcat (_("File Type: "),
|
|
||||||
gnome_mime_type (fp_dlg->file_name),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
label = gtk_label_new (gen_string);
|
label = gtk_label_new (gen_string);
|
||||||
g_free (gen_string);
|
g_free (gen_string);
|
||||||
} else if (S_ISLNK (fp_dlg->st.st_mode)) {
|
} else if (S_ISLNK (fp_dlg->st.st_mode)) {
|
||||||
@ -1161,7 +1153,7 @@ apply_uid_group_change (GnomeFilePropertyDialog *fpd)
|
|||||||
if (!p) {
|
if (!p) {
|
||||||
uid = atoi (new_user_name);
|
uid = atoi (new_user_name);
|
||||||
if (uid == 0) {
|
if (uid == 0) {
|
||||||
message (1, "Error", _("You entered an invalid username"));
|
message (1, MSG_ERROR, _("You entered an invalid username"));
|
||||||
uid = fpd->st.st_uid;
|
uid = fpd->st.st_uid;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -1172,7 +1164,7 @@ apply_uid_group_change (GnomeFilePropertyDialog *fpd)
|
|||||||
if (!p) {
|
if (!p) {
|
||||||
uid = atoi (new_user_name);
|
uid = atoi (new_user_name);
|
||||||
if (uid == 0) {
|
if (uid == 0) {
|
||||||
message (1, "Error", _("You entered an invalid username"));
|
message (1, MSG_ERROR, _("You entered an invalid username"));
|
||||||
uid = fpd->st.st_uid;
|
uid = fpd->st.st_uid;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -1192,7 +1184,7 @@ apply_uid_group_change (GnomeFilePropertyDialog *fpd)
|
|||||||
if (!g) {
|
if (!g) {
|
||||||
gid = atoi (new_group_name);
|
gid = atoi (new_group_name);
|
||||||
if (gid == 0) {
|
if (gid == 0) {
|
||||||
message (1, "Error", "You entered an invalid group name");
|
message (1, MSG_ERROR, _("You entered an invalid group name"));
|
||||||
gid = fpd->st.st_gid;
|
gid = fpd->st.st_gid;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -1209,25 +1201,25 @@ static gint
|
|||||||
apply_name_change (GnomeFilePropertyDialog *fpd)
|
apply_name_change (GnomeFilePropertyDialog *fpd)
|
||||||
{
|
{
|
||||||
char *new_name;
|
char *new_name;
|
||||||
char *base_name;
|
|
||||||
char *full_target;
|
|
||||||
FileOpContext *ctx;
|
FileOpContext *ctx;
|
||||||
long count = 0;
|
long count = 0;
|
||||||
double bytes = 0;
|
double bytes = 0;
|
||||||
|
|
||||||
new_name = gtk_entry_get_text (GTK_ENTRY (fpd->file_entry));
|
new_name = gtk_entry_get_text (GTK_ENTRY (fpd->file_entry));
|
||||||
if (!*new_name) {
|
if (!*new_name) {
|
||||||
message (1, "Error", _("You must rename your file to something"));
|
message (1, MSG_ERROR, _("You must rename your file to something"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* has it changed? */
|
/* has it changed? */
|
||||||
if (strcmp (strrchr(fpd->file_name, '/') + 1, new_name)) {
|
if (strcmp (strrchr(fpd->file_name, '/') + 1, new_name)) {
|
||||||
if (strchr (new_name, '/')) {
|
if (strchr (new_name, '/')) {
|
||||||
message (1, "Error", _("You cannot rename a file to something containing a '/' character"));
|
message (1, MSG_ERROR, _("You cannot rename a file to something containing a '/' character"));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
char *p;
|
char *p;
|
||||||
int s;
|
int s;
|
||||||
|
char *base_name;
|
||||||
|
char *full_target;
|
||||||
|
|
||||||
/* create the files. */
|
/* create the files. */
|
||||||
base_name = g_strdup (fpd->file_name);
|
base_name = g_strdup (fpd->file_name);
|
||||||
@ -1238,6 +1230,7 @@ apply_name_change (GnomeFilePropertyDialog *fpd)
|
|||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
full_target = concat_dir_and_file (base_name, new_name);
|
full_target = concat_dir_and_file (base_name, new_name);
|
||||||
|
g_free (base_name);
|
||||||
|
|
||||||
ctx = file_op_context_new ();
|
ctx = file_op_context_new ();
|
||||||
file_op_context_create_ui (ctx, OP_MOVE, FALSE);
|
file_op_context_create_ui (ctx, OP_MOVE, FALSE);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user