mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 799343 - Dialog boxes won't remain sized and positioned - part2
Allow the Due Bills/Invoice Reminder dialogs to save and restore the size and position.
This commit is contained in:
parent
4fc3a0cb83
commit
8795233afb
@ -43,6 +43,7 @@ struct _DialogQueryView
|
||||
GtkWidget * qview;
|
||||
GtkWidget * button_box;
|
||||
GNCDisplayViewButton * buttons;
|
||||
const gchar * pref_group;
|
||||
gpointer user_data;
|
||||
GList * books;
|
||||
gint component_id;
|
||||
@ -120,11 +121,22 @@ gnc_dialog_query_view_double_click_entry (GNCQueryView *qview, gpointer item,
|
||||
gnc_dialog_query_run_callback (dqv->buttons, item, dqv);
|
||||
}
|
||||
|
||||
static void
|
||||
dqv_save_window_size (DialogQueryView *dqv)
|
||||
{
|
||||
g_return_if_fail (dqv);
|
||||
|
||||
if (dqv->pref_group)
|
||||
gnc_save_window_size (dqv->pref_group, GTK_WINDOW(dqv->dialog));
|
||||
}
|
||||
|
||||
static int
|
||||
gnc_dialog_query_view_delete_cb (GtkDialog *dialog, GdkEvent *event, DialogQueryView *dqv)
|
||||
{
|
||||
g_return_val_if_fail (dqv, TRUE);
|
||||
|
||||
dqv_save_window_size (dqv);
|
||||
|
||||
gnc_unregister_gui_component (dqv->component_id);
|
||||
|
||||
/* destroy the book list */
|
||||
@ -169,15 +181,29 @@ gnc_dialog_query_view_refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
static void
|
||||
gnc_dialog_query_view_close (GtkButton *button, DialogQueryView *dqv)
|
||||
{
|
||||
dqv_save_window_size (dqv);
|
||||
|
||||
/* Don't select anything */
|
||||
gnc_dialog_query_view_destroy (dqv);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dqv_window_key_press_cb (GtkWidget *widget, GdkEventKey *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
DialogQueryView *dqv = user_data;
|
||||
|
||||
if (event->keyval == GDK_KEY_Escape)
|
||||
dqv_save_window_size (dqv);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
/* PUBLIC INTERFACES */
|
||||
|
||||
DialogQueryView *
|
||||
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
|
||||
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q, const gchar *pref_group)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
DialogQueryView *dqv;
|
||||
@ -187,6 +213,7 @@ gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
|
||||
dqv = g_new0 (DialogQueryView, 1);
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-query-view.glade", "query_view_dialog");
|
||||
dqv->pref_group = pref_group;
|
||||
|
||||
/* Grab the dialog, save the dialog info */
|
||||
dqv->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "query_view_dialog"));
|
||||
@ -248,6 +275,13 @@ gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
|
||||
gnc_gui_component_watch_entity (dqv->component_id, (GncGUID*)node->data,
|
||||
QOF_EVENT_DESTROY);
|
||||
|
||||
g_signal_connect (G_OBJECT (dqv->dialog), "key_press_event",
|
||||
G_CALLBACK (dqv_window_key_press_cb), dqv);
|
||||
|
||||
if (pref_group)
|
||||
gnc_restore_window_size (pref_group, GTK_WINDOW(dqv->dialog), GTK_WINDOW(parent));
|
||||
|
||||
|
||||
g_object_unref(G_OBJECT(builder));
|
||||
|
||||
return dqv;
|
||||
@ -318,14 +352,15 @@ gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
|
||||
const char *title, const char *label,
|
||||
gboolean abs, gboolean inv_sort,
|
||||
gint sort_column, GtkSortType order,
|
||||
GNCDisplayViewButton *buttons, gpointer user_data)
|
||||
GNCDisplayViewButton *buttons,
|
||||
const gchar *pref_group, gpointer user_data)
|
||||
{
|
||||
DialogQueryView *dqv;
|
||||
|
||||
if (!param_list || !q)
|
||||
return NULL;
|
||||
|
||||
dqv = gnc_dialog_query_view_new (parent, param_list, q);
|
||||
dqv = gnc_dialog_query_view_new (parent, param_list, q, pref_group);
|
||||
if (!dqv)
|
||||
return NULL;
|
||||
|
||||
|
@ -39,7 +39,7 @@ typedef struct
|
||||
} GNCDisplayViewButton;
|
||||
|
||||
DialogQueryView *
|
||||
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q);
|
||||
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q, const gchar *pref_group);
|
||||
|
||||
void gnc_dialog_query_view_set_title (DialogQueryView *dqv, const char *title);
|
||||
void gnc_dialog_query_view_set_label (DialogQueryView *dqv, const char *label);
|
||||
@ -57,7 +57,8 @@ gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
|
||||
const char *title, const char *label,
|
||||
gboolean abs, gboolean inv_sort,
|
||||
gint sort_column, GtkSortType order,
|
||||
GNCDisplayViewButton *buttons, gpointer user_data);
|
||||
GNCDisplayViewButton *buttons,
|
||||
const gchar *pref_group, gpointer user_data);
|
||||
|
||||
|
||||
#endif /* GNC_DIALOG_QUERY_VIEW_H */
|
||||
|
@ -84,6 +84,9 @@
|
||||
#define DIALOG_NEW_INVOICE_CM_CLASS "dialog-new-invoice"
|
||||
#define DIALOG_VIEW_INVOICE_CM_CLASS "dialog-view-invoice"
|
||||
|
||||
#define GNC_PREFS_GROUP_CUSTOMER "dialogs.customer-due"
|
||||
#define GNC_PREFS_GROUP_VENDOR "dialogs.vendor-due"
|
||||
|
||||
#define GNC_PREFS_GROUP_SEARCH "dialogs.business.invoice-search"
|
||||
#define GNC_PREF_NOTIFY_WHEN_DUE "notify-when-due"
|
||||
#define GNC_PREF_ACCUM_SPLITS "accumulate-splits"
|
||||
@ -3782,6 +3785,7 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
|
||||
time64 end_date;
|
||||
GList *res;
|
||||
gchar *message, *title;
|
||||
gchar *prefs_group;
|
||||
DialogQueryView *dialog;
|
||||
gint len;
|
||||
static GList *param_list = NULL;
|
||||
@ -3891,6 +3895,7 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
|
||||
|
||||
if (duetype == DUE_FOR_VENDOR)
|
||||
{
|
||||
prefs_group = GNC_PREFS_GROUP_VENDOR;
|
||||
message = g_strdup_printf
|
||||
(/* Translators: %d is the number of bills/credit notes due. This is a
|
||||
ngettext(3) message. */
|
||||
@ -3902,6 +3907,7 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
|
||||
}
|
||||
else
|
||||
{
|
||||
prefs_group = GNC_PREFS_GROUP_CUSTOMER;
|
||||
message = g_strdup_printf
|
||||
(/* Translators: %d is the number of invoices/credit notes due. This is a
|
||||
ngettext(3) message. */
|
||||
@ -3919,7 +3925,8 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
|
||||
1, GTK_SORT_ASCENDING,
|
||||
duetype == DUE_FOR_VENDOR ?
|
||||
vendorbuttons :
|
||||
customerbuttons, NULL);
|
||||
customerbuttons,
|
||||
prefs_group, NULL);
|
||||
|
||||
g_free(message);
|
||||
qof_query_destroy(q);
|
||||
|
@ -7,6 +7,7 @@
|
||||
<child name="price-editor" schema="org.gnucash.GnuCash.dialogs.price-editor"/>
|
||||
<child name="pricedb-editor" schema="org.gnucash.GnuCash.dialogs.pricedb-editor"/>
|
||||
<child name="process-payment" schema="org.gnucash.GnuCash.dialogs.process-payment"/>
|
||||
<child name="customer-due" schema="org.gnucash.GnuCash.dialogs.customer-due"/>
|
||||
<child name="reset-warnings" schema="org.gnucash.GnuCash.dialogs.reset-warnings"/>
|
||||
<child name="tax-info" schema="org.gnucash.GnuCash.dialogs.tax-info"/>
|
||||
<child name="fincalc" schema="org.gnucash.GnuCash.dialogs.fincalc"/>
|
||||
@ -27,6 +28,7 @@
|
||||
<child name="trans-doclink" schema="org.gnucash.GnuCash.dialogs.trans-doclink"/>
|
||||
<child name="style-sheet" schema="org.gnucash.GnuCash.dialogs.style-sheet"/>
|
||||
<child name="options" schema="org.gnucash.GnuCash.dialogs.options"/>
|
||||
<child name="vendor-due" schema="org.gnucash.GnuCash.dialogs.vendor-due"/>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnucash.GnuCash.dialogs.account" path="/org/gnucash/GnuCash/dialogs/account/">
|
||||
@ -49,6 +51,16 @@
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnucash.GnuCash.dialogs.customer-due" path="/org/gnucash/GnuCash/dialogs/customer-due/">
|
||||
<key type="(iiii)" name="last-geometry">
|
||||
<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.GnuCash.dialogs.imap-editor" path="/org/gnucash/GnuCash/dialogs/imap-editor/">
|
||||
<key type="(iiii)" name="last-geometry">
|
||||
<default>(-1,-1,-1,-1)</default>
|
||||
@ -311,4 +323,14 @@
|
||||
followed by the width and height of the window.</description>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnucash.GnuCash.dialogs.vendor-due" path="/org/gnucash/GnuCash/dialogs/vendor-due/">
|
||||
<key type="(iiii)" name="last-geometry">
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user