2005-10-16 [colin] 1.9.15cvs60
authorColin Leroy <colin@colino.net>
Sun, 16 Oct 2005 15:07:23 +0000 (15:07 +0000)
committerColin Leroy <colin@colino.net>
Sun, 16 Oct 2005 15:07:23 +0000 (15:07 +0000)
* src/wizard.c
Add a welcome email in the first empty mailbox
* src/prefs_common.c
Change one more default

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/prefs_common.c
src/wizard.c

index ef06606123ef9095efda07d7ecdd73508af3487f..961c670b92205230287db220a2ff76ad78521b4c 100644 (file)
@@ -1,3 +1,10 @@
+2005-10-16 [colin]     1.9.15cvs60
+
+       * src/wizard.c
+               Add a welcome email in the first empty mailbox
+       * src/prefs_common.c
+               Change one more default
+
 2005-10-16 [colin]     1.9.15cvs59
 
        * src/wizard.c
index b87536bd41d9ebe2ca294f1453a96f4d90a0970d..6fe4b476057a2ba2bd3596323bbdce7ad95b2000 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.43.2.29 -r 1.43.2.30 src/toolbar.c;  cvs diff -u -r 1.204.2.63 -r 1.204.2.64 src/prefs_common.c;  ) > 1.9.15cvs57.patchset
 ( cvs diff -u -r 1.43.2.29 -r 1.43.2.30 src/toolbar.c;  cvs diff -u -r 1.204.2.63 -r 1.204.2.64 src/prefs_common.c;  ) > 1.9.15cvs58.patchset
 ( cvs diff -u -r 1.1.2.16 -r 1.1.2.17 src/wizard.c;  ) > 1.9.15cvs59.patchset
+( cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/wizard.c;  cvs diff -u -r 1.204.2.64 -r 1.204.2.65 src/prefs_common.c;  ) > 1.9.15cvs60.patchset
index 25717850ca90f348b78109e6cda5413bb95eb5f3..2e27960cf0eb560caf2ecf9a46a244f8877d9c8a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=59
+EXTRA_VERSION=60
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 93891f4cd7b558bd40892fd843be23a8a9d79c11..f268959ef29ba49597dbe9d4a7d81498fe40767b 100644 (file)
@@ -228,7 +228,7 @@ static PrefParam param[] = {
        {"inline_image", "TRUE", &prefs_common.inline_img, P_BOOL,
         NULL, NULL, NULL},
 
-       {"display_folder_unread_num", "TRUE",
+       {"display_folder_unread_num", "FALSE",
         &prefs_common.display_folder_unread, P_BOOL,
         NULL, NULL, NULL},
        {"newsgroup_abbrev_len", "16",
index d8929fcfef2807ed210977022bebd3674c1ae20f..7f32814817f01e1c6726cfa087dfec4e9a24163f 100644 (file)
@@ -105,6 +105,72 @@ typedef struct
 
 } WizardWindow;
 
+static void initialize_fonts(WizardWindow *wizard)
+{
+       GtkWidget *widget = wizard->email;
+       gint size = pango_font_description_get_size(
+                       widget->style->font_desc)
+                     /PANGO_SCALE;
+       gchar *tmp, *new;
+       
+       tmp = g_strdup(prefs_common.textfont);
+       if (strrchr(tmp, ' ')) {
+               *(strrchr(tmp, ' ')) = '\0';
+               new = g_strdup_printf("%s %d", tmp, size);
+               g_free(prefs_common.textfont);
+               prefs_common.textfont = new;
+       }
+       g_free(tmp);
+       
+       tmp = g_strdup(prefs_common.smallfont);
+       if (strrchr(tmp, ' ')) {
+               *(strrchr(tmp, ' ')) = '\0';
+               new = g_strdup_printf("%s %d", tmp, size);
+               g_free(prefs_common.smallfont);
+               prefs_common.smallfont = new;
+       }
+       g_free(tmp);
+       
+       tmp = g_strdup(prefs_common.normalfont);
+       if (strrchr(tmp, ' ')) {
+               *(strrchr(tmp, ' ')) = '\0';
+               new = g_strdup_printf("%s %d", tmp, size);
+               g_free(prefs_common.normalfont);
+               prefs_common.normalfont = new;
+       }
+       g_free(tmp);
+}
+
+static void write_welcome_email(WizardWindow *wizard)
+{
+       gchar buf_date[64];
+       gchar *body=NULL;
+       const gchar *mailbox = gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name));
+       Folder *folder = folder_find_from_path(mailbox);
+       FolderItem *inbox = folder ? folder->inbox:NULL;
+       gchar *file = get_tmp_file();
+       
+       get_rfc822_date(buf_date, sizeof(buf_date));
+
+       body = g_strdup_printf(
+               "From: Sylpheed-Claws Team <sylpheed-claws-users@lists.sf.net>\n"
+               "To: %s <%s>\n"
+               "Date: %s\n"
+               "Subject: Welcome to Sylpheed-Claws.\n"
+               "\n"
+               "Welcome!\n", 
+               gtk_entry_get_text(GTK_ENTRY(wizard->full_name)),
+               gtk_entry_get_text(GTK_ENTRY(wizard->email)),
+               buf_date);
+       
+       if (inbox && inbox->total_msgs == 0
+        && str_write_to_file(body, file) >= 0) {
+               MsgFlags flags = { MSG_UNREAD|MSG_NEW, 0};
+               folder_item_add_msg(inbox, file, &flags, FALSE);
+       }
+       g_free(body);
+       g_unlink(file); 
+}
 static gboolean wizard_write_config(WizardWindow *wizard)
 {
        gboolean mailbox_ok = FALSE;
@@ -116,7 +182,7 @@ static gboolean wizard_write_config(WizardWindow *wizard)
        menuitem = gtk_menu_get_active(GTK_MENU(menu));
        prefs_account->protocol = GPOINTER_TO_INT
                        (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
-
+       
        if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
                mailbox_ok = setup_write_mailbox_path(wizard->mainwin, 
                                gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
@@ -182,6 +248,10 @@ static gboolean wizard_write_config(WizardWindow *wizard)
        prefs_account_write_config_all(account_list);
        prefs_account_free(prefs_account);
        account_read_config_all();
+
+       initialize_fonts(wizard);
+       if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4)
+               write_welcome_email(wizard);
        
        return TRUE;
 }
@@ -515,42 +585,6 @@ static GtkWidget* ssl_page (WizardWindow * wizard)
 }
 #endif
 
-static void initialize_fonts(WizardWindow *wizard)
-{
-       GtkWidget *widget = wizard->email;
-       gint size = pango_font_description_get_size(
-                       widget->style->font_desc)
-                     /PANGO_SCALE;
-       gchar *tmp, *new;
-       
-       tmp = g_strdup(prefs_common.textfont);
-       if (strrchr(tmp, ' ')) {
-               *(strrchr(tmp, ' ')) = '\0';
-               new = g_strdup_printf("%s %d", tmp, size);
-               g_free(prefs_common.textfont);
-               prefs_common.textfont = new;
-       }
-       g_free(tmp);
-       
-       tmp = g_strdup(prefs_common.smallfont);
-       if (strrchr(tmp, ' ')) {
-               *(strrchr(tmp, ' ')) = '\0';
-               new = g_strdup_printf("%s %d", tmp, size);
-               g_free(prefs_common.smallfont);
-               prefs_common.smallfont = new;
-       }
-       g_free(tmp);
-       
-       tmp = g_strdup(prefs_common.normalfont);
-       if (strrchr(tmp, ' ')) {
-               *(strrchr(tmp, ' ')) = '\0';
-               new = g_strdup_printf("%s %d", tmp, size);
-               g_free(prefs_common.normalfont);
-               prefs_common.normalfont = new;
-       }
-       g_free(tmp);
-}
-
 static void
 wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
 {
@@ -585,7 +619,6 @@ wizard_response_cb (GtkDialog * dialog, int response, gpointer data)
                }
                wizard->result = TRUE;
                wizard->finished = TRUE;
-               initialize_fonts(wizard);
                gtk_widget_destroy (GTK_WIDGET(dialog));
        }
        else