#include "sslcertwindow.h"
#include "prefs_gtk.h"
#include "pluginwindow.h"
+#include "hooks.h"
+#include "progressindicator.h"
#define AC_LABEL_WIDTH 240
static gboolean mainwindow_focus_in_event (GtkWidget *widget,
GdkEventFocus *focus,
gpointer data);
-
+void main_window_reply_cb (MainWindow *mainwin,
+ guint action,
+ GtkWidget *widget);
+gboolean mainwindow_progressindicator_hook (gpointer source,
+ gpointer userdata);
#define SEPARATE_ACTION 500
static GtkItemFactoryEntry mainwin_entries[] =
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/Compose a_n email message"), "<control>M", compose_mail_cb, 0, NULL},
{N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL},
- {N_("/_Message/_Reply"), "<control>R", reply_cb, COMPOSE_REPLY, NULL},
+ {N_("/_Message/_Reply"), "<control>R", main_window_reply_cb, COMPOSE_REPLY, NULL},
{N_("/_Message/Repl_y to"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Message/Repl_y to/_all"), "<shift><control>R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
- {N_("/_Message/Repl_y to/_sender"), NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
+ {N_("/_Message/Repl_y to/_all"), "<shift><control>R", main_window_reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
+ {N_("/_Message/Repl_y to/_sender"), NULL, main_window_reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
{N_("/_Message/Repl_y to/mailing _list"),
- "<control>L", reply_cb, COMPOSE_REPLY_TO_LIST, NULL},
- {N_("/_Message/Follow-up and reply to"),NULL, reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
+ "<control>L", main_window_reply_cb, COMPOSE_REPLY_TO_LIST, NULL},
+ {N_("/_Message/Follow-up and reply to"),NULL, main_window_reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
- {N_("/_Message/_Forward"), "<control><alt>F", reply_cb, COMPOSE_FORWARD, NULL},
- {N_("/_Message/Redirect"), NULL, reply_cb, COMPOSE_REDIRECT, NULL},
+ {N_("/_Message/_Forward"), "<control><alt>F", main_window_reply_cb, COMPOSE_FORWARD, NULL},
+ {N_("/_Message/Redirect"), NULL, main_window_reply_cb, COMPOSE_REDIRECT, NULL},
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/Re-_edit"), NULL, reedit_cb, 0, NULL},
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
mainwin->menu_lock_count = 0;
mainwin->cursor_count = 0;
+ mainwin->progressindicator_hook =
+ hooks_register_hook(PROGRESSINDICATOR_HOOKLIST, mainwindow_progressindicator_hook, mainwin);
+
if (!watch_cursor)
watch_cursor = gdk_cursor_new(GDK_WATCH);
g_free(path);
return;
}
- if (!strcmp(path, "Mail"))
- folder = folder_new(F_MH, _("Mailbox"), path);
- else
- folder = folder_new(F_MH, g_basename(path), path);
+ folder = folder_new(folder_get_class_from_string("mh"),
+ !strcmp(path, "Mail") ? _("Mailbox") : g_basename(path),
+ path);
g_free(path);
- if (folder->create_tree(folder) < 0) {
+ if (folder->class->create_tree(folder) < 0) {
alertpanel_error(_("Creation of the mailbox failed.\n"
"Maybe some files already exist, or you don't have the permission to write there."));
folder_destroy(folder);
return;
}
- /*
- if (!strcmp(path, "Mail"))
- folder = folder_new(F_MBOX, _("Mailbox"), path);
- else
- */
-
- folder = folder_new(F_MBOX, g_basename(path), path);
+ folder = folder_new(folder_get_class_from_string("mbox"),
+ g_basename(path), path);
g_free(path);
- if (folder->create_tree(folder) < 0) {
+ if (folder->class->create_tree(folder) < 0) {
alertpanel_error(_("Creation of the mailbox failed."));
folder_destroy(folder);
return;
if (selection == SUMMARY_SELECTED_SINGLE)
state |= M_SINGLE_TARGET_EXIST;
if (mainwin->summaryview->folder_item &&
- mainwin->summaryview->folder_item->folder->type == F_NEWS)
+ mainwin->summaryview->folder_item->folder->class->type == F_NEWS)
state |= M_NEWS;
else
state |= M_NOT_NEWS;
toolbar_toggle(action, mainwin);
}
-/* END Toolbar Stuff */
+void main_window_reply_cb(MainWindow *mainwin, guint action,
+ GtkWidget *widget)
+{
+ MessageView *msgview = (MessageView*)mainwin->messageview;
+ GSList *msginfo_list = NULL;
+ gchar *body;
+
+ g_return_if_fail(msgview != NULL);
+
+ msginfo_list = summary_get_selection(mainwin->summaryview);
+ g_return_if_fail(msginfo_list != NULL);
+
+ body = messageview_get_selection(msgview);
+ compose_reply_mode((ComposeMode)action, msginfo_list, body);
+ g_free(body);
+ g_slist_free(msginfo_list);
+}
+
static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
return NULL;
}
+gboolean mainwindow_progressindicator_hook(gpointer source, gpointer userdata)
+{
+ ProgressData *data = (ProgressData *) source;
+ MainWindow *mainwin = (MainWindow *) userdata;
+
+ switch (data->cmd) {
+ case PROGRESS_COMMAND_START:
+ case PROGRESS_COMMAND_STOP:
+ gtk_progress_set_percentage(GTK_PROGRESS(mainwin->progressbar), 0.0);
+ break;
+ case PROGRESS_COMMAND_SET_PERCENTAGE:
+ gtk_progress_set_percentage(GTK_PROGRESS(mainwin->progressbar), data->value);
+ break;
+ }
+ while (gtk_events_pending()) gtk_main_iteration ();
+
+ return FALSE;
+}
+
/*
* End of Source.
*/