fix bug 653231 (mainwin's handler problem when in quicksearch)
[claws.git] / src / mainwindow.c
index 5a4bdf05a8363658bc7142571a09b5f1f17369b5..c07e01c93588e815cd68d503b79a45575263cd37 100644 (file)
@@ -83,6 +83,7 @@
 #include "version.h"
 #include "selective_download.h"
 #include "ssl_manager.h"
+#include "sslcertwindow.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -464,7 +465,7 @@ static void prefs_scoring_open_cb   (MainWindow     *mainwin,
 static void prefs_filtering_open_cb    (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
-#ifdef USE_SSL
+#ifdef USE_OPENSSL
 static void ssl_manager_open_cb        (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -487,10 +488,6 @@ static void scan_tree_func  (Folder        *folder,
                                  FolderItem    *item,
                                  gpointer       data);
                                  
-static void key_pressed (GtkWidget *widget, 
-                               GdkEventKey *event,
-                               gpointer data);
-
 static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget);
 
 static void addr_harvest_cb     ( MainWindow  *mainwin,
@@ -762,7 +759,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, delete_duplicated_cb,   0, NULL},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/E_xecute"),                "X", execute_summary_cb, 0, NULL},
-#ifdef USE_SSL
+#ifdef USE_OPENSSL
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/SSL certi_ficates..."),    
                                                NULL, ssl_manager_open_cb, 0, NULL},
@@ -889,7 +886,7 @@ MainWindow *main_window_create(SeparateType type)
                           GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                               GTK_SIGNAL_FUNC(key_pressed), mainwin);
+                               GTK_SIGNAL_FUNC(mainwindow_key_pressed), mainwin);
 
        gtk_widget_realize(window);
        gtk_widget_add_events(window, GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK);
@@ -1033,7 +1030,7 @@ MainWindow *main_window_create(SeparateType type)
        gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
        for (i = 0; i < 4; i++) {
                if (success[i] == FALSE)
-                       g_warning(_("MainWindow: color allocation %d failed\n"), i);
+                       g_warning("MainWindow: color allocation %d failed\n", i);
        }
 
        debug_print("done.\n");
@@ -1103,7 +1100,9 @@ MainWindow *main_window_create(SeparateType type)
        summary_init(summaryview);
        messageview_init(messageview);
        log_window_init(mainwin->logwin);
-
+#ifdef USE_OPENSSL
+       sslcertwindow_register_hook();
+#endif
        mainwin->lock_count = 0;
        mainwin->menu_lock_count = 0;
        mainwin->cursor_count = 0;
@@ -1776,51 +1775,18 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
 
 void main_window_popup(MainWindow *mainwin)
 {
-       gint x, y;
-       gint sx, sy;
-       GtkWidget *widget;
-
-       gdk_window_get_origin(mainwin->window->window, &x, &y);
-       sx = gdk_screen_width();
-       sy = gdk_screen_height();
-       x %= sx; if (x < 0) x = 0;
-       y %= sy; if (y < 0) y = 0;
-       gdk_window_move(mainwin->window->window, x, y);
-       gdk_window_raise(mainwin->window->window);
-       gdk_window_show(mainwin->window->window);
-
-       debug_print("window position: x = %d, y = %d\n", x, y);
+       gtkut_window_popup(mainwin->window);
 
        switch (mainwin->type) {
        case SEPARATE_FOLDER:
-               widget = mainwin->win.sep_folder.folderwin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_folder.folderwin);
                break;
        case SEPARATE_MESSAGE:
-               widget = mainwin->win.sep_message.messagewin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_message.messagewin);
                break;
        case SEPARATE_BOTH:
-               widget = mainwin->win.sep_both.folderwin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
-               widget = mainwin->win.sep_both.messagewin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_both.folderwin);
+               gtkut_window_popup(mainwin->win.sep_both.messagewin);
                break;
        default:
                break;
@@ -3077,7 +3043,6 @@ void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                        if (procmsg_send_queue
                                (folder->queue, prefs_common.savemsg) < 0)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
-                       statusbar_pop_all();
                        folder_item_scan(folder->queue);
                        folder_update_item(folder->queue, TRUE);
                }
@@ -3480,7 +3445,7 @@ static void prefs_actions_open_cb(MainWindow *mainwin, guint action,
 {
        prefs_actions_open(mainwin);
 }
-#ifdef USE_SSL
+#ifdef USE_OPENSSL
 static void ssl_manager_open_cb(MainWindow *mainwin, guint action,
                                  GtkWidget *widget)
 {
@@ -3538,7 +3503,8 @@ static void scan_tree_func(Folder *folder, FolderItem *item, gpointer data)
 #define BREAK_ON_MODIFIER_KEY() \
        if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
 
-static void key_pressed (GtkWidget *widget, GdkEventKey *event,        gpointer data)
+void mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
+                                   gpointer data)
 {
        MainWindow *mainwin = (MainWindow*) data;