Allow custom window title for the folder selection dialog.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 16 Mar 2017 18:14:49 +0000 (19:14 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 16 Mar 2017 18:15:18 +0000 (19:15 +0100)
Fixes bug #3582 - Select folder dialogue does not tell what is
selecting for.

18 files changed:
src/compose.c
src/export.c
src/foldersel.c
src/foldersel.h
src/imap_gtk.c
src/import.c
src/mainwindow.c
src/messageview.c
src/mh_gtk.c
src/plugins/archive/archiver_gtk.c
src/plugins/bogofilter/bogofilter_gtk.c
src/plugins/bsfilter/bsfilter_gtk.c
src/plugins/clamd/clamav_plugin_gtk.c
src/plugins/mailmbox/plugin_gtk.c
src/plugins/spamassassin/spamassassin_gtk.c
src/prefs_account.c
src/prefs_filtering_action.c
src/summaryview.c

index 524e853..7cd0729 100644 (file)
@@ -7446,7 +7446,8 @@ static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose)
        FolderItem *dest;
        gchar * path;
 
-       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
+                       _("Select folder to save message to"));
        if (!dest) return;
 
        path = folder_item_get_identifier(dest);
index 29bd524..74e465e 100644 (file)
@@ -264,7 +264,8 @@ static void export_srcsel_cb(GtkWidget *widget, gpointer data)
 {
        FolderItem *src;
 
-       src = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
+       src = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE,
+                       _("Select folder which to export"));
        if (src && src->path)
                gtk_entry_set_text(GTK_ENTRY(src_entry), src->path);
 }
index faf8293..837763e 100644 (file)
@@ -83,7 +83,7 @@ static GtkTreeStore *tree_store;
 static gboolean cancelled;
 static gboolean finished;
 
-static void foldersel_create           (void);
+static void foldersel_create           (const gchar *title);
 static void foldersel_init             (void);
 
 static void foldersel_append_item      (GtkTreeStore   *store,
@@ -133,13 +133,14 @@ static gboolean tree_view_folder_item_func        (GtkTreeModel     *model,
                                                 FolderItemSearch *data);
 
 FolderItem *foldersel_folder_sel(Folder *cur_folder, FolderSelectionType type,
-                                const gchar *default_folder, gboolean can_sel_mailbox)
+                                const gchar *default_folder, gboolean can_sel_mailbox,
+                                const gchar *title)
 {
        selected_item = NULL;
        root_selectable = can_sel_mailbox;
 
        if (!window) {
-               foldersel_create();
+               foldersel_create(title);
                foldersel_init();
        }
 
@@ -234,7 +235,7 @@ static void foldersel_size_allocate_cb(GtkWidget *widget,
        prefs_common.folderselwin_height = allocation->height;
 }
 
-static void foldersel_create(void)
+static void foldersel_create(const gchar *title)
 {
        GtkWidget *vbox;
        GtkWidget *scrolledwin;
@@ -245,7 +246,8 @@ static void foldersel_create(void)
        static GdkGeometry geometry;
 
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "foldersel");
-       gtk_window_set_title(GTK_WINDOW(window), _("Select folder"));
+       gtk_window_set_title(GTK_WINDOW(window),
+                       title ? title : _("Select folder"));
        gtk_container_set_border_width(GTK_CONTAINER(window), 4);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
index 76d3ac2..4ab5b42 100644 (file)
@@ -35,7 +35,8 @@ typedef enum
 FolderItem *foldersel_folder_sel(Folder                        *cur_folder,
                                 FolderSelectionType     type,
                                 const gchar            *default_folder,
-                                gboolean                        can_sel_mailbox);
+                                gboolean                can_sel_mailbox,
+                                const gchar            *title);
 void foldersel_reflect_prefs_pixmap_theme(void);
 
 #endif /* __FOLDERSEL_H__ */
index 11f2d1f..26e3663 100644 (file)
@@ -313,7 +313,12 @@ static void move_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != imap_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE,
+                       ngettext(
+                               "Select folder to move selected message to",
+                               "Select folder to move selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
        
@@ -329,7 +334,12 @@ static void copy_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != imap_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE,
+                       ngettext(
+                               "Select folder to copy selected message to",
+                               "Select folder to copy selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
        
index a0e513f..b573bb1 100644 (file)
@@ -268,7 +268,8 @@ static void import_destsel_cb(GtkWidget *widget, gpointer data)
        FolderItem *dest;
        gchar *path;
 
-       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
+                       _("Select folder to import to"));
        if (!dest)
                 return;
        path = folder_item_get_identifier(dest);
index 2c34dce..e015642 100644 (file)
@@ -4932,7 +4932,8 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
        MainWindow *mainwin = (MainWindow *)data;
        FolderItem *to_folder;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE,
+                       _("Select folder to go to"));
 
        if (to_folder)
                folderview_select(mainwin->folderview, to_folder);
index aaca56d..68e9038 100644 (file)
@@ -2653,7 +2653,8 @@ static void goto_folder_cb(GtkAction *action, gpointer data)
        MessageView *messageview = (MessageView *)data;
        FolderItem *to_folder;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE,
+                       _("Select folder to go to"));
 
        if (to_folder) {
                folderview_select(messageview->mainwin->folderview, to_folder);
index 985f05e..605ef13 100644 (file)
@@ -303,7 +303,12 @@ static void move_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != mh_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE,
+                       ngettext(
+                               "Select folder to move selected message to",
+                               "Select folder to move selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
        
@@ -319,7 +324,12 @@ static void copy_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != mh_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, TRUE,
+                       ngettext(
+                               "Select folder to copy selected message to",
+                               "Select folder to copy selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
        
index 11c166f..1f31ac4 100644 (file)
@@ -913,7 +913,8 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        gint newpos = 0;
        struct ArchivePage* page = (struct ArchivePage *) data;
 
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       _("Select folder to archive"));
        if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
                gtk_editable_delete_text(GTK_EDITABLE(page->folder), 0, -1);
                gtk_editable_insert_text(GTK_EDITABLE(page->folder),
index 10aadb8..fdae7f1 100644 (file)
@@ -71,7 +71,7 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        gchar *item_id;
        gint newpos = 0;
        
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE, NULL);
        if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
                gtk_editable_delete_text(GTK_EDITABLE(entry), 0, -1);
                gtk_editable_insert_text(GTK_EDITABLE(entry), item_id, strlen(item_id), &newpos);
index 9593378..c329d68 100644 (file)
@@ -69,7 +69,7 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        gchar *item_id;
        gint newpos = 0;
        
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE, NULL);
        if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
                gtk_editable_delete_text(GTK_EDITABLE(entry), 0, -1);
                gtk_editable_insert_text(GTK_EDITABLE(entry), item_id, strlen(item_id), &newpos);
index 77d5d8f..e94a3a8 100644 (file)
@@ -68,7 +68,8 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        gchar *item_id;
        gint newpos = 0;
        
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       _("Select folder to store infected messages in"));
        if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
                gtk_editable_delete_text(GTK_EDITABLE(page->save_folder), 0, -1);
                gtk_editable_insert_text(GTK_EDITABLE(page->save_folder), item_id, strlen(item_id), &newpos);
index 282c263..47b7684 100644 (file)
@@ -368,7 +368,12 @@ static void move_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != claws_mailmbox_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       ngettext(
+                               "Select folder to move selected message to",
+                               "Select folder to move selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
 
@@ -384,7 +389,12 @@ static void copy_folder_cb(GtkAction *action, gpointer data)
        if (!from_folder || from_folder->folder->klass != claws_mailmbox_get_class())
                return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       ngettext(
+                               "Select folder to copy selected message to",
+                               "Select folder to copy selected messages to",
+                               summary_get_selection_count(folderview->summaryview))
+       );
        if (!to_folder)
                return;
 
index d73a9c6..102aaff 100644 (file)
@@ -115,7 +115,8 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
        gchar *item_id;
        gint newpos = 0;
        
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       _("Select folder to save spam to"));
        if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
                gtk_editable_delete_text(GTK_EDITABLE(page->save_folder), 0, -1);
                gtk_editable_insert_text(GTK_EDITABLE(page->save_folder), item_id, strlen(item_id), &newpos);
index 185e24d..59d9049 100644 (file)
@@ -3882,7 +3882,7 @@ static void prefs_account_select_folder_cb(GtkWidget *widget, gpointer data)
        FolderItem *item;
        gchar *id;
 
-       item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+       item = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE, NULL);
        if (item && item->path) {
                id = folder_item_get_identifier(item);
                if (id) {
index e105bdd..fa1cb08 100644 (file)
@@ -1293,7 +1293,8 @@ static void prefs_filtering_action_select_dest(void)
        FolderItem *dest;
        gchar * path;
 
-       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+       dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
+                       _("Select destination folder"));
        if (!dest) return;
 
        path = folder_item_get_identifier(dest);
index b563297..268047f 100644 (file)
@@ -4617,7 +4617,12 @@ void summary_move_to(SummaryView *summaryview)
        if (!summaryview->folder_item ||
            FOLDER_TYPE(summaryview->folder_item->folder) == F_NEWS) return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL, FALSE,
+                       ngettext(
+                               "Select folder to move selected message to",
+                               "Select folder to move selected messages to",
+                               g_list_length(GTK_CMCLIST(summaryview->ctree)->selection))
+       );
        summary_move_selected_to(summaryview, to_folder);
 }
 
@@ -4697,7 +4702,12 @@ void summary_copy_to(SummaryView *summaryview)
 
        if (!summaryview->folder_item) return;
 
-       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE);
+       to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
+                       ngettext(
+                               "Select folder to copy selected message to",
+                               "Select folder to copy selected messages to",
+                               g_list_length(GTK_CMCLIST(summaryview->ctree)->selection))
+       );
        summary_copy_selected_to(summaryview, to_folder);
 }