sync with 0.9.8cvs1
authorPaul Mangan <paul@claws-mail.org>
Sun, 28 Dec 2003 10:36:32 +0000 (10:36 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sun, 28 Dec 2003 10:36:32 +0000 (10:36 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/inc.c
src/inc.h
src/mainwindow.c
src/prefs_common.c

index 869ec1c..1c07e66 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-17
+
+       * src/inc.[ch]: made inc_account_mail() public.
+       * src/mainwindow.c: moved receive menus into submenu, and added
+         dynamic menus for receiving from each account.
+
 2003-12-15
 
        * version 0.9.8a
index add7c72..9ebd0ea 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-28 [paul]      0.9.8claws10
+
+       * sync with 0.9.8cvs1
+               see ChangeLog 2003-12-17
+
 2003-12-27 [christoph] 0.9.8claws9
 
        * src/common/utils.[ch]
index d900068..60e7d0b 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-17
+
+       * src/inc.[ch]: inc_account_mail() ¤ò public ¤Ë¤·¤¿¡£
+       * src/mainwindow.c: ¼õ¿®¥á¥Ë¥å¡¼¤ò¥µ¥Ö¥á¥Ë¥å¡¼¤Ë¤·¡¢³Æ¥¢¥«¥¦¥ó¥È¤«¤é
+         ¤Î¼õ¿®¤Î¤¿¤á¤ÎưŪ¤Ê¥á¥Ë¥å¡¼¤òÄɲá£
+
 2003-12-15
 
        * version 0.9.8a
index b97099a..08a8cdf 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=9
+EXTRA_VERSION=10
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index c577963..eee6079 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -81,8 +81,8 @@ static GdkBitmap *okxpmmask;
 
 static void inc_finished               (MainWindow             *mainwin,
                                         gboolean                new_messages);
-static gint inc_account_mail           (PrefsAccount           *account,
-                                        MainWindow             *mainwin);
+static gint inc_account_mail_real      (MainWindow             *mainwin,
+                                        PrefsAccount           *account);
 
 static IncProgressDialog *inc_progress_dialog_create
                                        (gboolean                autocheck);
@@ -181,7 +181,7 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
                        return;
                }
        } else {
-               account_new_msgs = inc_account_mail(cur_account, mainwin);
+               account_new_msgs = inc_account_mail_real(mainwin, cur_account);
                if (account_new_msgs > 0)
                        new_msgs += account_new_msgs;
        }
@@ -196,10 +196,10 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
 void inc_pop_before_smtp(PrefsAccount *acc)
 {
        /* FIXME: assumes to attach to first main window */
-       inc_account_mail(acc, mainwindow_get_mainwindow());
+       inc_account_mail(mainwindow_get_mainwindow(), acc);
 }
 
-static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
+static gint inc_account_mail_real(MainWindow *mainwin, PrefsAccount *account)
 {
        IncProgressDialog *inc_dialog;
        IncSession *session;
@@ -245,6 +245,30 @@ static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
        return 0;
 }
 
+gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account)
+{
+       gint new_msgs;
+
+       if (inc_lock_count) return 0;
+
+       if (prefs_common.work_offline)
+               if (alertpanel(_("Offline warning"), 
+                              _("You're working offline. Override?"),
+                              _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+               return;
+
+       inc_autocheck_timer_remove();
+       main_window_lock(mainwin);
+
+       new_msgs = inc_account_mail_real(mainwin, account);
+
+       inc_finished(mainwin, new_msgs > 0);
+       main_window_unlock(mainwin);
+       inc_autocheck_timer_set();
+
+       return new_msgs;
+}
+
 void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
                          gboolean notify)
 {
index 045bb11..09c352b 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -73,7 +73,9 @@ struct _IncSession
 #define TIMEOUT_ITV    200
 
 void inc_mail                  (MainWindow     *mainwin,
-                                gboolean notify);
+                                gboolean        notify);
+gint inc_account_mail          (MainWindow     *mainwin,
+                                PrefsAccount   *account);
 void inc_all_account_mail      (MainWindow     *mainwin,
                                 gboolean        autocheck,
                                 gboolean        notify);
index c875852..836babe 100644 (file)
@@ -381,8 +381,10 @@ static void new_account_cb  (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void account_menu_cb     (GtkMenuItem   *menuitem,
-                                 gpointer       data);
+static void account_selector_menu_cb    (GtkMenuItem   *menuitem,
+                                         gpointer       data);
+static void account_receive_menu_cb     (GtkMenuItem   *menuitem,
+                                         gpointer       data);
 
 static void prefs_open_cb      (GtkMenuItem    *menuitem,
                                 gpointer        data);
@@ -617,11 +619,14 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/_Update summary"),          "<control><alt>U", update_summary_cb,  0, NULL},
 
        {N_("/_Message"),                       NULL, NULL, 0, "<Branch>"},
-       {N_("/_Message/Get new ma_il"),         "<control>I",   inc_mail_cb, 0, NULL},
-       {N_("/_Message/Get from _all accounts"),
+       {N_("/_Message/Recei_ve"),              NULL, NULL, 0, "<Branch>"},
+       {N_("/_Message/Recei_ve/Get from _current account"),
+                                               "<control>I",   inc_mail_cb, 0, NULL},
+       {N_("/_Message/Recei_ve/Get from _all accounts"),
                                                "<shift><control>I", inc_all_account_mail_cb, 0, NULL},
-       {N_("/_Message/Cancel receivin_g"),     NULL, inc_cancel_cb, 0, NULL},
-       {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
+       {N_("/_Message/Recei_ve/Cancel receivin_g"),
+                                               NULL, inc_cancel_cb, 0, NULL},
+       {N_("/_Message/Recei_ve/---"),          NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/Compose a_n email message"),     "<control>M", compose_mail_cb, 0, NULL},
@@ -1185,38 +1190,86 @@ void main_window_set_summary_column(void)
        }
 }
 
-void main_window_set_account_menu(GList *account_list)
+static void main_window_set_account_selector_menu(MainWindow *mainwin,
+                                                 GList *account_list)
 {
-       GList *cur, *cur_ac, *cur_item;
+       GList *cur_ac, *cur_item;
        GtkWidget *menuitem;
-       MainWindow *mainwin;
        PrefsAccount *ac_prefs;
 
-       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
-               mainwin = (MainWindow *)cur->data;
+       /* destroy all previous menu item */
+       cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
+       while (cur_item != NULL) {
+               GList *next = cur_item->next;
+               gtk_widget_destroy(GTK_WIDGET(cur_item->data));
+               cur_item = next;
+       }
 
-               /* destroy all previous menu item */
-               cur_item = GTK_MENU_SHELL(mainwin->ac_menu)->children;
-               while (cur_item != NULL) {
-                       GList *next = cur_item->next;
-                       gtk_widget_destroy(GTK_WIDGET(cur_item->data));
-                       cur_item = next;
-               }
+       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+               ac_prefs = (PrefsAccount *)cur_ac->data;
+
+               menuitem = gtk_menu_item_new_with_label
+                       (ac_prefs->account_name
+                        ? ac_prefs->account_name : _("Untitled"));
+               gtk_widget_show(menuitem);
+               gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
+               gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+                                  GTK_SIGNAL_FUNC(account_selector_menu_cb),
+                                  ac_prefs);
+       }
+}
 
-               for (cur_ac = account_list; cur_ac != NULL;
-                    cur_ac = cur_ac->next) {
-                       ac_prefs = (PrefsAccount *)cur_ac->data;
-
-                       menuitem = gtk_menu_item_new_with_label
-                               (ac_prefs->account_name
-                                ? ac_prefs->account_name : _("Untitled"));
-                       gtk_widget_show(menuitem);
-                       gtk_menu_append(GTK_MENU(mainwin->ac_menu), menuitem);
-                       gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
-                                          GTK_SIGNAL_FUNC(account_menu_cb),
-                                          ac_prefs);
+static void main_window_set_account_receive_menu(MainWindow *mainwin,
+                                                GList *account_list)
+{
+       GList *cur_ac, *cur_item;
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+       PrefsAccount *ac_prefs;
+
+       menu = gtk_item_factory_get_widget(mainwin->menu_factory,
+                                          "/Message/Receive");
+
+       /* search for separator */
+       for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL;
+            cur_item = cur_item->next) {
+               if (GTK_BIN(cur_item->data)->child == NULL) {
+                       cur_item = cur_item->next;
+                       break;
                }
        }
+
+       /* destroy all previous menu item */
+       while (cur_item != NULL) {
+               GList *next = cur_item->next;
+               gtk_widget_destroy(GTK_WIDGET(cur_item->data));
+               cur_item = next;
+       }
+
+       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+               ac_prefs = (PrefsAccount *)cur_ac->data;
+
+               menuitem = gtk_menu_item_new_with_label
+                       (ac_prefs->account_name ? ac_prefs->account_name
+                        : _("Untitled"));
+               gtk_widget_show(menuitem);
+               gtk_menu_append(GTK_MENU(menu), menuitem);
+               gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+                                  GTK_SIGNAL_FUNC(account_receive_menu_cb),
+                                  ac_prefs);
+       }
+}
+
+void main_window_set_account_menu(GList *account_list)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               main_window_set_account_selector_menu(mainwin, account_list);
+               main_window_set_account_receive_menu(mainwin, account_list);
+       }
 }
 
 static void main_window_show_cur_account(MainWindow *mainwin)
@@ -1583,10 +1636,12 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        GtkItemFactory *ifactory = mainwin->menu_factory;
        SensitiveCond state;
        gboolean sensitive;
+       GtkWidget *menu;
        GtkWidget *menuitem;
        SummaryView *summaryview;
        gchar *menu_path;
        gint i;
+       GList *cur_item;
 
        static const struct {
                gchar *const entry;
@@ -1624,9 +1679,13 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/View/Show all headers"          , M_SINGLE_TARGET_EXIST},
                {"/View/Message source"            , M_SINGLE_TARGET_EXIST},
 
-               {"/Message/Get new mail"          , M_HAVE_ACCOUNT|M_UNLOCKED},
-               {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED},
-               {"/Message/Cancel receiving"      , M_INC_ACTIVE},
+               {"/Message/Receive/Get from current account"
+                                                , M_HAVE_ACCOUNT|M_UNLOCKED},
+               {"/Message/Receive/Get from all accounts"
+                                                , M_HAVE_ACCOUNT|M_UNLOCKED},
+               {"/Message/Receive/Cancel receiving"
+                                                , M_INC_ACTIVE},
+
                {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
                {"/Message/Reply"                 , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Reply to"             , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
@@ -1660,6 +1719,22 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                menu_set_sensitive(ifactory, entry[i].entry, sensitive);
        }
 
+       menu = gtk_item_factory_get_widget(ifactory, "/Message/Receive");
+
+       /* search for separator */
+       for (cur_item = GTK_MENU_SHELL(menu)->children; cur_item != NULL;
+            cur_item = cur_item->next) {
+               if (GTK_BIN(cur_item->data)->child == NULL) {
+                       cur_item = cur_item->next;
+                       break;
+               }
+       }
+
+       for (; cur_item != NULL; cur_item = cur_item->next) {
+               gtk_widget_set_sensitive(GTK_WIDGET(cur_item->data),
+                                        (M_UNLOCKED & state) != 0);
+       }
+
        main_window_menu_callback_block(mainwin);
 
 #define SET_CHECK_MENU_ACTIVE(path, active) \
@@ -2774,12 +2849,20 @@ static void new_account_cb(MainWindow *mainwin, guint action,
        if (!compose_get_compose_list()) account_add();
 }
 
-static void account_menu_cb(GtkMenuItem        *menuitem, gpointer data)
+static void account_selector_menu_cb(GtkMenuItem *menuitem, gpointer data)
 {
        cur_account = (PrefsAccount *)data;
        main_window_reflect_prefs_all();
 }
 
+static void account_receive_menu_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       MainWindow *mainwin = (MainWindow *)mainwin_list->data;
+       PrefsAccount *account = (PrefsAccount *)data;
+
+       inc_account_mail(mainwin, account);
+}
+
 static void prefs_open_cb(GtkMenuItem *menuitem, gpointer data)
 {
        prefs_gtk_open();
index 5c9e1bd..64dad09 100644 (file)
@@ -3256,8 +3256,8 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
                "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
 
-               "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
-               "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get new mail\" \"<control>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get from all accounts\" \"<shift><control>I\")\n"
                "(menu-path \"<Main>/Message/Compose an email message\" \"<control>M\")\n"
                "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
                "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><control>R\")\n"
@@ -3309,8 +3309,8 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/View/Show all headers\" \"<shift>H\")\n"
                "(menu-path \"<Main>/View/Update\" \"<shift>S\")\n"
 
-               "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
-               "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get new mail\" \"<control>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get from all accounts\" \"<shift><control>I\")\n"
                "(menu-path \"<Main>/Message/Compose an email message\" \"W\")\n"
                "(menu-path \"<Main>/Message/Reply\" \"<control>R\")\n"
                "(menu-path \"<Main>/Message/Reply to/all\" \"<shift>A\")\n"
@@ -3361,9 +3361,9 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
                "(menu-path \"<Main>/View/Update\" \"<control><alt>U\")\n"
 
-               "(menu-path \"<Main>/Message/Get new mail\" \"<control>I\")\n"
-               "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><control>I\")\n"
-               "(menu-path \"<Main>/Message/Compose new message\" \"M\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get new mail\" \"<control>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get from all accounts\" \"<shift><control>I\")\n"
+               "(menu-path \"<Main>/Message/Compose an email message\" \"M\")\n"
                "(menu-path \"<Main>/Message/Reply\" \"R\")\n"
                "(menu-path \"<Main>/Message/Reply to/all\" \"G\")\n"
                "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
@@ -3414,8 +3414,8 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Main>/View/Show all headers\" \"<control>H\")\n"
                "(menu-path \"<Main>/View/Update\" \"<alt>U\")\n"
 
-               "(menu-path \"<Main>/Message/Get new mail\" \"<alt>I\")\n"
-               "(menu-path \"<Main>/Message/Get from all accounts\" \"<shift><alt>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get new mail\" \"<alt>I\")\n"
+               "(menu-path \"<Main>/Message/Receive/Get from all accounts\" \"<shift><alt>I\")\n"
                "(menu-path \"<Main>/Message/Compose an email message\" \"<alt>N\")\n"
                "(menu-path \"<Main>/Message/Reply\" \"<alt>R\")\n"
                "(menu-path \"<Main>/Message/Reply to/all\" \"<shift><alt>R\")\n"