0.8.10claws76
[claws.git] / src / mainwindow.c
index b290f4141a09d42e3606dfa3e150d230ae9b6897..8aeeadbb0b8a6b29d88be47d53607b693667fd73 100644 (file)
@@ -85,6 +85,8 @@
 #include "sslcertwindow.h"
 #include "prefs_gtk.h"
 #include "pluginwindow.h"
+#include "hooks.h"
+#include "progressindicator.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -400,6 +402,8 @@ static gboolean mainwindow_focus_in_event   (GtkWidget      *widget,
 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[] =
@@ -1009,6 +1013,9 @@ MainWindow *main_window_create(SeparateType type)
        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);
 
@@ -2155,9 +2162,21 @@ static void toggle_toolbar_cb(MainWindow *mainwin, guint action,
 void main_window_reply_cb(MainWindow *mainwin, guint action,
                          GtkWidget *widget)
 {
-       toolbar_menu_reply(TOOLBAR_MAIN, mainwin, action);
+       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);
 }
-/* END Toolbar Stuff */
+
 
 static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
                                GtkWidget *widget)
@@ -2727,6 +2746,25 @@ MainWindow *mainwindow_get_mainwindow(void)
                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.
 */