fix bug 605957 'shortcuts in popup-menu'
[claws.git] / src / mainwindow.c
index 4f2297b5e9da0a4e5ffa85d1bf4887574086a6af..ddedc9d3fc5dd4e75e61ca7eb4c5f85859494766 100644 (file)
@@ -84,6 +84,8 @@
 #include "selective_download.h"
 #include "ssl_manager.h"
 #include "sslcertwindow.h"
+#include "prefswindow.h"
+#include "pluginwindow.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -371,6 +373,11 @@ static void new_account_cb  (MainWindow    *mainwin,
 static void account_menu_cb     (GtkMenuItem   *menuitem,
                                  gpointer       data);
 
+static void prefs_open_cb      (GtkMenuItem    *menuitem,
+                                gpointer        data);
+static void plugins_open_cb    (GtkMenuItem    *menuitem,
+                                gpointer        data);
+
 static void online_switch_clicked(GtkButton     *btn, 
                                  gpointer data);
 
@@ -692,6 +699,9 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, account_edit_open, 0, NULL},
        {N_("/_Configuration/C_hange current account"),
                                                NULL, NULL, 0, "<Branch>"},
+       {N_("/_Configuration/---"),             NULL, NULL, 0, "<Separator>"},
+       {N_("/_Configuration/Preferences..."),  NULL, prefs_open_cb, 0, NULL},
+       {N_("/_Configuration/Plugins..."),      NULL, plugins_open_cb, 0, NULL},
 
        {N_("/_Help"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_Help/_Manual (Local)"),          NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
@@ -963,6 +973,20 @@ MainWindow *main_window_create(SeparateType type)
        /* create actions menu */
        update_mainwin_actions_menu(ifactory, mainwin);
 
+       /* attach accel groups to main window */
+#define        ADD_MENU_ACCEL_GROUP_TO_WINDOW(menu,win)        \
+       gtk_window_add_accel_group                      \
+               (GTK_WINDOW(win),                       \
+                gtk_item_factory_from_widget(menu)->accel_group)                
+       
+       ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu,mainwin->window);
+       
+       /* connect the accelerators for equivalent 
+          menu items in different menus             */
+       menu_connect_identical_items();
+
+
+       
        /* show main window */
        gtk_widget_set_uposition(mainwin->window,
                                 prefs_common.mainwin_x,
@@ -2597,6 +2621,16 @@ static void account_menu_cb(GtkMenuItem  *menuitem, gpointer data)
        main_window_reflect_prefs_all();
 }
 
+static void prefs_open_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       prefswindow_create();
+}
+
+static void plugins_open_cb(GtkMenuItem *menuitem, gpointer data)
+{
+       pluginwindow_create();
+}
+
 static void manual_open_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
@@ -2628,6 +2662,10 @@ static gboolean mainwindow_focus_in_event(GtkWidget *widget, GdkEventFocus *focu
        SummaryView *summary;
 
        g_return_val_if_fail(data, FALSE);
+
+       if (gtk_grab_get_current()) 
+               return FALSE;
+       
        summary = ((MainWindow *)data)->summaryview;
        g_return_val_if_fail(summary, FALSE);
        if (summary->selected != summary->displayed)