Skip to content

Commit

Permalink
Bug 397927 - Save the window size/position for Qif Account picker dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-IT committed May 12, 2019
1 parent b41cb2f commit ac0eb00
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gnucash/gschemas/org.gnucash.dialogs.import.generic.gschema.xml.in
Expand Up @@ -42,6 +42,7 @@
</key>
<child name="match-picker" schema="org.gnucash.dialogs.import.generic.match-picker"/>
<child name="transaction-list" schema="org.gnucash.dialogs.import.generic.transaction-list"/>
<child name="account-picker" schema="org.gnucash.dialogs.import.generic.account-picker"/>
</schema>

<schema id="org.gnucash.dialogs.import.generic.match-picker" path="/org/gnucash/dialogs/import/generic/match-picker/">
Expand All @@ -59,6 +60,16 @@
</key>
</schema>

<schema id="org.gnucash.dialogs.import.generic.account-picker" path="/org/gnucash/dialogs/import/generic/account-picker/">
<key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default>
<summary>Last window position and size</summary>
<description>This setting describes the size and position of the window when it was last closed.
The numbers are the X and Y coordinates of the top left corner of the window
followed by the width and height of the window.</description>
</key>
</schema>

<schema id="org.gnucash.dialogs.import.generic.transaction-list" path="/org/gnucash/dialogs/import/generic/transaction-list/">
<key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default>
Expand Down
11 changes: 11 additions & 0 deletions gnucash/gschemas/org.gnucash.dialogs.import.qif.gschema.xml.in
Expand Up @@ -32,5 +32,16 @@
<summary>Show documentation</summary>
<description>Show some documentation-only pages in QIF Import assistant.</description>
</key>
<child name="account-picker" schema="org.gnucash.dialogs.import.qif.account-picker"/>
</schema>

<schema id="org.gnucash.dialogs.import.qif.account-picker" path="/org/gnucash/dialogs/import/qif/account-picker/">
<key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default>
<summary>Last window position and size</summary>
<description>This setting describes the size and position of the window when it was last closed.
The numbers are the X and Y coordinates of the top left corner of the window
followed by the width and height of the window.</description>
</key>
</schema>
</schemalist>
8 changes: 8 additions & 0 deletions gnucash/import-export/import-account-matcher.c
Expand Up @@ -40,13 +40,17 @@

#include "gnc-commodity.h"
#include "gnc-engine.h"
#include "gnc-prefs.h"
#include "gnc-tree-view-account.h"
#include "gnc-ui.h"

static QofLogModule log_module = GNC_MOD_IMPORT;

#define STATE_SECTION "dialogs/import/generic_matcher/account_matcher"

#define GNC_PREFS_GROUP "dialogs.import.generic.account-picker"


/*-******************************************************************\
* Functions needed by gnc_import_select_account
*
Expand Down Expand Up @@ -314,6 +318,9 @@ Account * gnc_import_select_account(GtkWidget *parent,
gtk_window_set_transient_for (GTK_WINDOW (picker->dialog),
GTK_WINDOW (parent));

gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(picker->dialog), GTK_WINDOW (parent));

/* Pack the content into the dialog vbox */
pbox = GTK_WIDGET(gtk_builder_get_object (builder, "account_picker_vbox"));
box = GTK_WIDGET(gtk_builder_get_object (builder, "account_picker_content"));
Expand Down Expand Up @@ -397,6 +404,7 @@ Account * gnc_import_select_account(GtkWidget *parent,
while (response == GNC_RESPONSE_NEW);

g_object_unref(G_OBJECT(builder));
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(picker->dialog));
gtk_widget_destroy(picker->dialog);
}
else
Expand Down
7 changes: 7 additions & 0 deletions gnucash/import-export/qif-imp/dialog-account-picker.c
Expand Up @@ -33,11 +33,14 @@
#include "dialog-utils.h"
#include "assistant-qif-import.h"
#include "gnc-gui-query.h"
#include "gnc-prefs.h"
#include "gnc-ui-util.h"
#include "guile-mappings.h"
#include "gnc-guile-utils.h"
#include "gnc-ui.h" /* for GNC_RESPONSE_NEW */

#define GNC_PREFS_GROUP "dialogs.import.qif.account-picker"

enum account_cols
{
ACCOUNT_COL_NAME = 0,
Expand Down Expand Up @@ -396,6 +399,9 @@ qif_account_picker_dialog(GtkWindow *parent, QIFImportWindow * qif_wind, SCM map
G_CALLBACK(gnc_ui_qif_account_picker_map_cb),
wind);

gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(wind->dialog), parent);

/* this is to get the checkmarks set up right.. it will get called
* again after the window is mapped. */
build_acct_tree(wind, wind->qif_wind);
Expand All @@ -405,6 +411,7 @@ qif_account_picker_dialog(GtkWindow *parent, QIFImportWindow * qif_wind, SCM map
response = gtk_dialog_run(GTK_DIALOG(wind->dialog));
}
while (response == GNC_RESPONSE_NEW);
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(wind->dialog));
gtk_widget_destroy(wind->dialog);
g_object_unref(G_OBJECT(builder));

Expand Down

0 comments on commit ac0eb00

Please sign in to comment.