Index: /home/manfred/projects/gnucash/src/import-export/generic-import.glade
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/generic-import.glade	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/generic-import.glade	(working copy)
@@ -417,10 +417,10 @@
               <widget class="GtkLabel" id="explanation_label">
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">For a new transaction, click on the "Other Account" entry to choose the other (destination) account of this transaction.
-For a transaction that is a duplicate of an existing one, click on the "Other Account" or "Description" entry to
+For a transaction that is a duplicate of an existing one, click on the "Other Account" or "Description" entry to
 check whether GnuCash chose the right existing transaction.
 To switch transactions between both states, click on the checkmark in the "New" column.
-When all new transactions have the correct destination account and all duplicates are matched with the right existing transaction,
+When all new transactions have the correct destination account and all duplicates are matched with the right existing transaction,
 click "OK".</property>
               </widget>
               <packing>
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.c
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.c	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.c	(working copy)
@@ -40,12 +40,14 @@
 #include "gnc-ab-transfer.h"
 #include "gnc-ab-utils.h"
 #include "gnc-ab-kvp.h"
+#include "gnc-gwen-gui.h"
 #include "gnc-file-aqb-import.h"
 #include "gnc-gconf-utils.h"
 #include "gnc-plugin-aqbanking.h"
 #include "gnc-plugin-manager.h"
 #include "gnc-plugin-page-account-tree.h"
 #include "gnc-plugin-page-register.h"
+#include "gnc-main-window.h"

 /* This static indicates the debugging module that this .o belongs to.  */
 static QofLogModule log_module = G_LOG_DOMAIN;
@@ -70,6 +72,7 @@
 static void gnc_plugin_ab_cmd_issue_transaction(GtkAction *action, GncMainWindowActionData *data);
 static void gnc_plugin_ab_cmd_issue_inttransaction(GtkAction *action, GncMainWindowActionData *data);
 static void gnc_plugin_ab_cmd_issue_direct_debit(GtkAction *action, GncMainWindowActionData *data);
+static void gnc_plugin_ab_cmd_view_logwindow(GtkToggleAction *action, GncMainWindow *window);
 static void gnc_plugin_ab_cmd_mt940_import(GtkAction *action, GncMainWindowActionData *data);
 static void gnc_plugin_ab_cmd_mt942_import(GtkAction *action, GncMainWindowActionData *data);
 static void gnc_plugin_ab_cmd_dtaus_import(GtkAction *action, GncMainWindowActionData *data);
@@ -78,6 +81,9 @@
 #define PLUGIN_ACTIONS_NAME "gnc-plugin-aqbanking-actions"
 #define PLUGIN_UI_FILENAME  "gnc-plugin-aqbanking-ui.xml"

+#define MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW "ABViewLogwindowAction"
+
+
 static GtkActionEntry gnc_plugin_actions [] =
 {
     /* Menus */
@@ -147,6 +153,17 @@
 };
 static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);

+static GtkToggleActionEntry gnc_plugin_toggle_actions [] =
+{
+    {
+        MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW, NULL,
+        N_("Show _log window"), NULL,
+        N_("Show the online banking log window."),
+        G_CALLBACK(gnc_plugin_ab_cmd_view_logwindow), TRUE
+    },
+};
+static guint gnc_plugin_n_toggle_actions = G_N_ELEMENTS(gnc_plugin_toggle_actions);
+
 static const gchar *need_account_actions[] =
 {
     "ABGetBalanceAction",
@@ -157,6 +174,8 @@
     NULL
 };

+static GncMainWindow *gnc_main_window = NULL;
+
 /************************************************************
  *                   Object Implementation                  *
  ************************************************************/
@@ -181,6 +200,8 @@
     plugin_class->actions_name       = PLUGIN_ACTIONS_NAME;
     plugin_class->actions            = gnc_plugin_actions;
     plugin_class->n_actions          = gnc_plugin_n_actions;
+    plugin_class->toggle_actions     = gnc_plugin_toggle_actions;
+    plugin_class->n_toggle_actions   = gnc_plugin_n_toggle_actions;
     plugin_class->ui_filename        = PLUGIN_UI_FILENAME;
     plugin_class->add_to_window      = gnc_plugin_aqbanking_add_to_window;
     plugin_class->remove_from_window = gnc_plugin_aqbanking_remove_from_window;
@@ -199,12 +220,20 @@
 gnc_plugin_aqbanking_add_to_window(GncPlugin *plugin, GncMainWindow *window,
                                    GQuark type)
 {
+    GtkAction *action;
+
+    gnc_main_window = window;
+
     g_signal_connect(window, "page_added",
                      G_CALLBACK(gnc_plugin_ab_main_window_page_added),
                      plugin);
     g_signal_connect(window, "page_changed",
                      G_CALLBACK(gnc_plugin_ab_main_window_page_changed),
                      plugin);
+
+    action = gnc_main_window_find_action(window, MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW);
+
+    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), FALSE);
 }

 static void
@@ -375,6 +404,20 @@
     return account;
 }

+void
+gnc_plugin_aqbanking_set_logwindow_visible(gboolean logwindow_visible)
+{
+    GtkAction *action;
+
+    action = gnc_main_window_find_action(gnc_main_window,
+                                         MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW);
+    if (action)
+    {
+        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),
+                                     logwindow_visible);
+    }
+}
+
 /************************************************************
  *                    Command Callbacks                     *
  ************************************************************/
@@ -488,6 +531,24 @@
 }

 static void
+gnc_plugin_ab_cmd_view_logwindow(GtkToggleAction *action, GncMainWindow *window)
+{
+    if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
+    {
+        if (!gnc_GWEN_Gui_show_dialog())
+        {
+            /* Log window could not be made visible */
+            gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), FALSE);
+        }
+    }
+    else
+    {
+        gnc_GWEN_Gui_hide_dialog();
+    }
+}
+
+
+static void
 gnc_plugin_ab_cmd_mt940_import(GtkAction *action, GncMainWindowActionData *data)
 {
     gchar *format = gnc_gconf_get_string(GCONF_SECTION_AQBANKING,
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/aqbanking.glade
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/aqbanking.glade	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/aqbanking.glade	(working copy)
@@ -22,7 +22,7 @@
             <property name="title" translatable="yes">Initial Online Banking Setup</property>
             <property name="text" translatable="yes">This assistant helps you setting up your Online Banking connection with your bank.

-You first need to apply for Online Banking access at your bank. If your bank  decides to grant you electronic access, they will send you a letter containing
+You first need to apply for Online Banking access at your bank. If your bank  decides to grant you electronic access, they will send you a letter containing

 * The bank code of your bank
 * The user ID that identifies you to your bank
@@ -1131,6 +1131,7 @@
                 <property name="use_underline">True</property>
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="ggg_close_toggled_cb"/>
               </widget>
               <packing>
                 <property name="expand">False</property>
@@ -1745,8 +1746,8 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkCheckButton" id="gconf/dialogs/import/hbci/remember_pin">
-            <property name="label" translatable="yes">Remember _PIN</property>
+          <widget class="GtkCheckButton" id="gconf/dialogs/import/hbci/close_on_finish">
+            <property name="label" translatable="yes">_Close log window when finished</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -1763,8 +1764,8 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkCheckButton" id="checkbutton3">
-            <property name="label" translatable="yes">_Verbose debug messages</property>
+          <widget class="GtkCheckButton" id="gconf/dialogs/import/hbci/remember_pin">
+            <property name="label" translatable="yes">Remember _PIN</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
@@ -1780,6 +1781,24 @@
             <property name="x_padding">12</property>
           </packing>
         </child>
+        <child>
+          <widget class="GtkCheckButton" id="checkbutton3">
+            <property name="label" translatable="yes">_Verbose debug messages</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+          </widget>
+          <packing>
+            <property name="right_attach">4</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options"></property>
+            <property name="x_padding">12</property>
+          </packing>
+        </child>
       </widget>
     </child>
   </widget>
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.h
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.h	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking.h	(working copy)
@@ -77,6 +77,11 @@
  */
 void gnc_plugin_aqbanking_create_plugin(void);

+/**
+ * Set MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW
+ */
+void gnc_plugin_aqbanking_set_logwindow_visible(gboolean logwindow_visible);
+
 G_END_DECLS

 /** @} */
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.c
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.c	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.c	(working copy)
@@ -42,6 +42,7 @@
 #include "gnc-gwen-gui.h"
 #include "gnc-session.h"
 #include "gnc-ui.h"
+#include "gnc-plugin-aqbanking.h"
 #include "md5.h"
 #include "qof.h"

@@ -94,6 +95,30 @@
         GWEN_Gui_SetGui(NULL);
     }
 }
+void
+gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished)
+{
+    gnc_gconf_set_bool(
+        GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH,
+        close_when_finished,
+        NULL);
+}
+gboolean
+gnc_GWEN_Gui_get_close_flag()
+{
+    return gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL);
+}
+
+gboolean
+gnc_GWEN_Gui_show_dialog()
+{
+    return
+}
+
+void
+gnc_GWEN_Gui_hide_dialog()
+{
+}

 #else

@@ -191,6 +216,7 @@
                              gpointer user_data);
 void ggg_abort_clicked_cb(GtkButton *button, gpointer user_data);
 void ggg_close_clicked_cb(GtkButton *button, gpointer user_data);
+void ggg_close_toggled_cb(GtkToggleButton *button, gpointer user_data);

 enum _GuiState
 {
@@ -364,6 +390,71 @@
     LEAVE(" ");
 }

+void
+gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished)
+{
+    gnc_gconf_set_bool(
+        GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH,
+        close_when_finished,
+        NULL);
+
+    if (full_gui)
+    {
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(full_gui->close_checkbutton))
+            != close_when_finished)
+        {
+            gtk_toggle_button_set_active(
+                GTK_TOGGLE_BUTTON(full_gui->close_checkbutton),
+                close_when_finished);
+        }
+    }
+}
+
+gboolean
+gnc_GWEN_Gui_get_close_flag()
+{
+    return gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL);
+}
+
+gboolean
+gnc_GWEN_Gui_show_dialog()
+{
+    GncGWENGui *gui = full_gui;
+
+    if (!gui)
+    {
+        gnc_GWEN_Gui_get(NULL);
+    }
+
+    if (gui)
+    {
+        if (gui->state == HIDDEN)
+        {
+            gui->state = FINISHED;
+        }
+        gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(gui->close_checkbutton),
+            gnc_gconf_get_bool(GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH, NULL));
+
+        show_dialog(gui, FALSE);
+
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+void
+gnc_GWEN_Gui_hide_dialog()
+{
+    GncGWENGui *gui = full_gui;
+
+    if (gui)
+    {
+        hide_dialog(gui);
+    }
+}
+
 static void
 register_callbacks(GncGWENGui *gui)
 {
@@ -599,6 +690,8 @@

     gtk_widget_show(gui->dialog);

+    gnc_plugin_aqbanking_set_logwindow_visible(TRUE);
+
     /* Clear the log window */
     if (clear_log)
     {
@@ -619,6 +712,8 @@
     /* Hide the dialog */
     gtk_widget_hide(gui->dialog);

+    gnc_plugin_aqbanking_set_logwindow_visible(FALSE);
+
     /* Remember whether the dialog is to be closed when finished */
     gnc_gconf_set_bool(
         GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH,
@@ -1511,4 +1606,22 @@

     LEAVE(" ");
 }
+
+void
+ggg_close_toggled_cb(GtkToggleButton *button, gpointer user_data)
+{
+    GncGWENGui *gui = user_data;
+
+    g_return_if_fail(gui);
+    g_return_if_fail(gui->parent);
+
+    ENTER("gui=%p", gui);
+
+    gnc_gconf_set_bool(
+        GCONF_SECTION_AQBANKING, KEY_CLOSE_ON_FINISH,
+        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)),
+        NULL);
+
+    LEAVE(" ");
+}
 #endif
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.h
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.h	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-gwen-gui.h	(working copy)
@@ -72,6 +72,33 @@
  */
 void gnc_GWEN_Gui_shutdown(void);

+/**
+ * Set "Close when finished" flag
+ *
+ * @param gboolean close_when_finished
+ */
+void gnc_GWEN_Gui_set_close_flag(gboolean close_when_finished);
+
+/**
+ * Get "Close when finished" flag
+ *
+ * @return gboolean close_when_finished
+ */
+gboolean gnc_GWEN_Gui_get_close_flag(void);
+
+/**
+ * Unhides Online Banking Connection Window (Make log visible)
+ *
+ * @return gboolean window is visible
+ */
+gboolean gnc_GWEN_Gui_show_dialog(void);
+
+/**
+ * Hides Online Banking Connection Window (Close log window)
+ *
+ */
+void gnc_GWEN_Gui_hide_dialog(void);
+
 G_END_DECLS

 /** @} */
Index: /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking-ui.xml
===================================================================
--- /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking-ui.xml	(revision 20032)
+++ /home/manfred/projects/gnucash/src/import-export/aqbanking/gnc-plugin-aqbanking-ui.xml	(working copy)
@@ -19,9 +19,12 @@
         <menu name="OnlineActions" action="OnlineActionsAction">
           <menuitem name="ABGetBalance"         action="ABGetBalanceAction"/>
           <menuitem name="ABGetTrans"           action="ABGetTransAction"/>
+          <separator name="OnlineActionsSep1"/>
           <menuitem name="ABIssueTrans"         action="ABIssueTransAction"/>
           <menuitem name="ABIssueIntTrans"      action="ABIssueIntTransAction"/>
           <menuitem name="ABIssueDirectDebit"   action="ABIssueDirectDebitAction"/>
+          <separator name="OnlineActionsSep2"/>
+          <menuitem name="ABViewLogwindow"   action="ABViewLogwindowAction"/>
         </menu>
       </placeholder>
     </menu>
Index: /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.c
===================================================================
--- /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.c	(revision 20032)
+++ /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.c	(working copy)
@@ -179,9 +179,10 @@
     if (class->actions_name)
     {
         DEBUG ("%s: %d actions to merge with gui from %s",
-               class->actions_name, class->n_actions, class->ui_filename);
+               class->actions_name, (class->n_actions + class->n_toggle_actions), class->ui_filename);
         gnc_main_window_merge_actions (window, class->actions_name,
                                        class->actions, class->n_actions,
+                                       class->toggle_actions, class->n_toggle_actions,
                                        class->ui_filename, plugin);


@@ -260,7 +261,7 @@
     if (class->actions_name)
     {
         DEBUG ("%s: %d actions to unmerge",
-               class->actions_name, class->n_actions);
+               class->actions_name, (class->n_actions + class->n_toggle_actions));
         gnc_main_window_unmerge_actions (window, class->actions_name);
     }
     LEAVE ("");
Index: /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.h
===================================================================
--- /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.h	(revision 20032)
+++ /home/manfred/projects/gnucash/src/gnome-utils/gnc-plugin.h	(working copy)
@@ -123,6 +123,11 @@
     GtkActionEntry *actions;
     /** The number of actions in the actions array. */
     guint n_actions;
+    /** An array of toggle actions that should automatically be added to
+     *  any GnuCash "main" content window that is opened. */
+    GtkToggleActionEntry *toggle_actions;
+    /** The number of toggle actions in the toggle actions array. */
+    guint n_toggle_actions;
     /** A NULL terminated list of actions that should be considered
      *  important.  In the toolbar, these actions will display the
      *  action name when the toolbar is in "text beside icons"
Index: /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.c
===================================================================
--- /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.c	(revision 20032)
+++ /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.c	(working copy)
@@ -150,7 +150,6 @@
 static void do_popup_menu(GncPluginPage *page, GdkEventButton *event);
 static gboolean gnc_main_window_popup_menu_cb (GtkWidget *widget, GncPluginPage *page);

-static GtkAction *gnc_main_window_find_action (GncMainWindow *window, const gchar *name);
 #ifdef MAC_INTEGRATION
 static void gtk_quartz_shutdown(GtkOSXApplication *theApp, gpointer data);
 static gboolean gtk_quartz_should_quit(GtkOSXApplication *theApp, GncMainWindow *window);
@@ -2774,6 +2773,8 @@
                                const gchar *group_name,
                                GtkActionEntry *actions,
                                guint n_actions,
+                               GtkToggleActionEntry *toggle_actions,
+                               guint n_toggle_actions,
                                const gchar *filename,
                                gpointer user_data)
 {
@@ -2802,6 +2803,12 @@
     entry->action_group = gtk_action_group_new (group_name);
     gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
     gtk_action_group_add_actions (entry->action_group, actions, n_actions, data);
+    if (toggle_actions != NULL && n_toggle_actions > 0)
+    {
+        gtk_action_group_add_toggle_actions (entry->action_group,
+                                             toggle_actions, n_toggle_actions,
+                                             data);
+    }
     gtk_ui_manager_insert_action_group (window->ui_merge, entry->action_group, 0);
     entry->merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge, pathname, &error);
     g_assert(entry->merge_id || error);
@@ -2876,7 +2883,7 @@
 }


-static GtkAction *
+GtkAction *
 gnc_main_window_find_action (GncMainWindow *window, const gchar *name)
 {
     GtkAction *action = NULL;
Index: /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.h
===================================================================
--- /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.h	(revision 20032)
+++ /home/manfred/projects/gnucash/src/gnome-utils/gnc-main-window.h	(working copy)
@@ -221,6 +221,11 @@
  *
  *  @param n_entries The number of actions in the array.
  *
+ *  @param toggle_entries A pointer to an array of GtkToggleActionEntry.
+ *  These are the toggle actions that will be added to the user interface.
+ *
+ *  @param n_toggle_entries The number of toggle actions in the array.
+ *
  *  @param filename The filename containing the user interface
  *  definition that goes with this set of actions.
  *
@@ -231,6 +236,8 @@
                                     const gchar *group_name,
                                     GtkActionEntry *entries,
                                     guint n_entries,
+                                    GtkToggleActionEntry *toggle_entries,
+                                    guint n_toggle_entries,
                                     const gchar *filename,
                                     gpointer user_data);

@@ -381,6 +388,18 @@
  *  this action. */
 void gnc_main_window_all_action_set_sensitive (const gchar *action_name, gboolean sensitive);

+/** Find action in main window.
+ *
+ *  @param window Whe window which should be checked for the action.
+ *
+ *  @param name The name of the command to be retrieved.
+ *
+ *  @return A pointer to a GtkAction that was added with the
+ *  specified name. If the name cannot be found, then NULL will be
+ *  returned.
+ */
+GtkAction *gnc_main_window_find_action (GncMainWindow *window, const gchar *name);
+
 /**
  * Shows all main windows.
  **/

