Re: [evolution-patches] patch for bug 48759
- From: Jeffrey Stedfast <fejj ximian com>
- To: Charles Zhang <Charles Zhang Sun Com>
- Cc: evolution-patches <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] patch for bug 48759
- Date: Fri, 26 Sep 2003 15:44:45 -0400
attached is the correct fix.
appologies for including part of another patch, but I didn't feel like
separating them.
changing the bahaviour of the filesel dialog to not allow the user to
hit OK until a valid filename has been selected is:
1. inconsistant with the rest of gnome/evolution
2. confusing to the user (unless maybe you popped up a dialog to tell
them WHY OK wasn't working... either that or maybe gray out the OK
button until something valid has been input? but you'd also need to
handle the case where the user hits Enter in the entry box which has the
same effect as hitting OK)
the proper fix, attached below, fixes the error dialog shown to the user
so that it doesn't always show "file exists, overwrite?" even if that is
not the problem.
Jeff
On Fri, 2003-09-26 at 14:21, Jeffrey Stedfast wrote:
> your patch does not fix the problem, I just tested it.
>
> Jeff
--
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com - www.ximian.com
? 47638.patch
? 48759.patch
? select-file.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.544.2.15
diff -u -r1.544.2.15 ChangeLog
--- ChangeLog 23 Sep 2003 08:35:32 -0000 1.544.2.15
+++ ChangeLog 26 Sep 2003 19:35:47 -0000
@@ -1,3 +1,23 @@
+2003-09-26 Jeffrey Stedfast <fejj ximian com>
+
+ * e-msg-composer.c (save): Don't blindly claim that the file
+ exists and then ask the user if he/she would like to overwrite
+ it. First check that the file even exists, if not - then we've got
+ a different error. Fixes bug #48759.
+
+ * e-msg-composer-select-file.c (e_msg_composer_select_file): Use
+ the proper selector title, otherwise it says "Attach files" when
+ we are trying to save a message.
+
+2003-09-24 Jeffrey Stedfast <fejj ximian com>
+
+ * e-msg-composer-attachment-bar.c (get_default_charset): Same as
+ below.
+
+ * e-msg-composer.c (composer_get_default_charset_setting): Handle
+ empty-string as the charset value gotten from gconf as this can
+ happen. Partial fix for bug #47638.
+
2003-09-23 Charles Zhang <charles zhang sun com>
* e-msg-composer-attachment-bar.c (remove_attachment): Add some
Index: e-msg-composer-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
retrieving revision 1.67.4.5
diff -u -r1.67.4.5 e-msg-composer-attachment-bar.c
--- e-msg-composer-attachment-bar.c 23 Sep 2003 08:35:32 -0000 1.67.4.5
+++ e-msg-composer-attachment-bar.c 26 Sep 2003 19:35:47 -0000
@@ -735,6 +735,11 @@
gconf = gconf_client_get_default ();
buf = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL);
+ if (buf && buf[0] == '\0') {
+ g_free (buf);
+ buf = NULL;
+ }
+
g_object_unref (gconf);
if (buf != NULL) {
Index: e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.395.2.7
diff -u -r1.395.2.7 e-msg-composer.c
--- e-msg-composer.c 29 Aug 2003 05:57:25 -0000 1.395.2.7
+++ e-msg-composer.c 26 Sep 2003 19:35:47 -0000
@@ -242,8 +242,14 @@
gconf = gconf_client_get_default ();
buf = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL);
- if (buf == NULL)
+ if (buf == NULL || buf[0] == '\0') {
+ g_free (buf);
buf = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
+ if (buf && buf[0] == '\0') {
+ g_free (buf);
+ buf = NULL;
+ }
+ }
g_object_unref (gconf);
@@ -1159,33 +1165,45 @@
}
static void
-save (EMsgComposer *composer, const char *file_name)
+save (EMsgComposer *composer, const char *default_filename)
{
CORBA_Environment ev;
- char *my_file_name;
+ char *filename;
int fd;
- if (file_name != NULL)
- my_file_name = g_strdup (file_name);
+ if (default_filename != NULL)
+ filename = g_strdup (default_filename);
else
- my_file_name = e_msg_composer_select_file (composer, _("Save as..."));
+ filename = e_msg_composer_select_file (composer, _("Save as..."));
- if (my_file_name == NULL)
+ if (filename == NULL)
return;
- /* check to see if we already have the file */
- if ((fd = open (my_file_name, O_RDONLY | O_CREAT | O_EXCL, 0777)) == -1) {
+ /* check to see if we already have the file and that we can create it */
+ if ((fd = open (filename, O_RDONLY | O_CREAT | O_EXCL, 0777)) == -1) {
+ int resp, errnosav = errno;
GtkWidget *dialog;
- int resp;
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- _("File exists, overwrite?"));
- resp = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- if (resp != GTK_RESPONSE_YES) {
- g_free(my_file_name);
+ struct stat st;
+
+ if (stat (filename, &st) == 0 && S_ISREG (st.st_mode)) {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (composer),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+ _("File exists, overwrite?"));
+ resp = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ if (resp != GTK_RESPONSE_YES) {
+ g_free (filename);
+ return;
+ }
+ } else {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (composer),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ _("Error saving file: %s"), g_strerror (errnosav));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_free (filename);
return;
}
} else
@@ -1193,20 +1211,19 @@
CORBA_exception_init (&ev);
- Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev);
+ Bonobo_PersistFile_save (composer->persist_file_interface, filename, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- char *tmp = g_path_get_basename(my_file_name);
-
- e_notice (composer, GTK_MESSAGE_ERROR,
- _("Error saving file: %s"), tmp);
+ char *tmp = g_path_get_basename (filename);
+
+ e_notice (composer, GTK_MESSAGE_ERROR, _("Error saving file: %s"), tmp);
g_free(tmp);
} else
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "saved", &ev);
CORBA_exception_free (&ev);
- g_free (my_file_name);
+ g_free (filename);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]