Merge Bob Fewell's 'fixes9' into maint.

This commit is contained in:
John Ralls 2018-09-06 15:21:36 -07:00
commit 148f24135b
56 changed files with 411 additions and 111 deletions

View File

@ -716,6 +716,8 @@ attach_element (GtkWidget *element, GNCSearchWindow *sw, int row)
data = g_object_get_data (G_OBJECT (element), "data");
gnc_search_core_type_pass_parent (data->element, GTK_WINDOW(sw->dialog));
gtk_grid_attach (GTK_GRID (sw->criteria_table), element, 0, row, 1, 1);
gtk_widget_set_hexpand (element, TRUE);
gtk_widget_set_halign (element, GTK_ALIGN_FILL);
@ -774,6 +776,8 @@ combo_box_changed (GtkComboBox *combo_box, struct _crit_data *data)
FALSE, FALSE, 0);
}
gnc_search_core_type_pass_parent (data->element, GTK_WINDOW(data->dialog));
/* Make sure it's visible */
gtk_widget_show_all (data->container);
@ -1345,7 +1349,7 @@ gnc_search_dialog_create (GtkWindow *parent,
gnc_search_dialog_init_widgets (sw, title);
if (sw->prefs_group)
gnc_restore_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog));
gnc_restore_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog), parent);
gtk_window_set_transient_for(GTK_WINDOW(sw->dialog), parent);
gtk_widget_show(sw->dialog);

View File

@ -39,6 +39,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
static gboolean gncs_validate (GNCSearchCoreType *fe);
static GtkWidget *gncs_get_widget(GNCSearchCoreType *fe);
@ -54,6 +55,7 @@ struct _GNCSearchAccountPrivate
{
gboolean match_all;
GList * selected_accounts;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -102,6 +104,7 @@ gnc_search_account_class_init (GNCSearchAccountClass *klass)
object_class->finalize = gnc_search_account_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->validate = gncs_validate;
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
@ -170,10 +173,11 @@ gncs_validate (GNCSearchCoreType *fe)
g_return_val_if_fail (IS_GNCSEARCH_ACCOUNT (fi), FALSE);
priv = _PRIVATE(fi);
if (priv->selected_accounts == NULL && fi->how )
{
valid = FALSE;
gnc_error_dialog (NULL, "%s", _("You have not selected any accounts"));
gnc_error_dialog (GTK_WINDOW(priv->parent), "%s", _("You have not selected any accounts"));
}
/* XXX */
@ -257,7 +261,7 @@ button_clicked (GtkButton *button, GNCSearchAccount *fi)
/* Create the dialog */
dialog =
GTK_DIALOG(gtk_dialog_new_with_buttons(_("Select the Accounts to Compare"),
NULL,
GTK_WINDOW(priv->parent),
0,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
@ -356,3 +360,16 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
return (GNCSearchCoreType *)se;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchAccount *fi = (GNCSearchAccount *)fe;
GNCSearchAccountPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_ACCOUNT (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}

View File

@ -35,6 +35,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
static gboolean gncs_validate (GNCSearchCoreType *fe);
static GtkWidget *gncs_get_widget(GNCSearchCoreType *fe);
@ -48,6 +49,7 @@ typedef struct _GNCSearchBooleanPrivate GNCSearchBooleanPrivate;
struct _GNCSearchBooleanPrivate
{
GtkWindow *parent;
gpointer dummy;
};
@ -96,6 +98,7 @@ gnc_search_boolean_class_init (GNCSearchBooleanClass *klass)
object_class->finalize = gnc_search_boolean_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->validate = gncs_validate;
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
@ -142,6 +145,19 @@ gnc_search_boolean_set_value (GNCSearchBoolean *fi, gboolean value)
fi->value = value;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchBoolean *fi = (GNCSearchBoolean *)fe;
GNCSearchBooleanPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_BOOLEAN (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -149,6 +149,12 @@ gnc_search_core_type_grab_focus (GNCSearchCoreType *fe)
GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->grab_focus (fe);
}
void
gnc_search_core_type_pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->pass_parent (fe, parent);
}
gboolean
gnc_search_core_type_validate (GNCSearchCoreType *fe)
{

View File

@ -46,6 +46,7 @@ typedef struct
/* virtual methods */
void (*grab_focus) (GNCSearchCoreType *fe);
void (*editable_enters) (GNCSearchCoreType *fe);
void (*pass_parent) (GNCSearchCoreType *fe, gpointer parent);
gboolean (*validate) (GNCSearchCoreType *fe);
GNCSearchCoreType * (*clone) (GNCSearchCoreType *fe);
GtkWidget * (*get_widget) (GNCSearchCoreType *);
@ -64,6 +65,7 @@ GNCSearchCoreType * gnc_search_core_type_new_type_name (const char *type);
/* methods */
void gnc_search_core_type_grab_focus (GNCSearchCoreType *fe);
void gnc_search_core_type_editable_enters (GNCSearchCoreType *fe);
void gnc_search_core_type_pass_parent (GNCSearchCoreType *fe, gpointer parent);
gboolean gnc_search_core_type_validate (GNCSearchCoreType *fe);
GNCSearchCoreType * gnc_search_core_type_clone (GNCSearchCoreType *fe);
GtkWidget * gnc_search_core_type_get_widget (GNCSearchCoreType *fe);

View File

@ -37,6 +37,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static void editable_enters (GNCSearchCoreType *fe);
static void grab_focus (GNCSearchCoreType *fe);
static GNCSearchCoreType *gncs_clone (GNCSearchCoreType *fe);
@ -53,6 +54,7 @@ typedef struct _GNCSearchDatePrivate GNCSearchDatePrivate;
struct _GNCSearchDatePrivate
{
GtkWidget *entry;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -100,6 +102,7 @@ gnc_search_date_class_init (GNCSearchDateClass *klass)
object_class->finalize = gnc_search_date_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->editable_enters = editable_enters;
gnc_search_core_type->grab_focus = grab_focus;
gnc_search_core_type->validate = gncs_validate;
@ -164,6 +167,19 @@ gnc_search_date_set_how (GNCSearchDate *fi, QofQueryCompare how)
fi->how = how;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_DATE (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -36,6 +36,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static void editable_enters (GNCSearchCoreType *fe);
static void grab_focus (GNCSearchCoreType *fe);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
@ -53,6 +54,7 @@ struct _GNCSearchDoublePrivate
{
GtkWidget * entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -100,6 +102,7 @@ gnc_search_double_class_init (GNCSearchDoubleClass *klass)
object_class->finalize = gnc_search_double_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->editable_enters = editable_enters;
gnc_search_core_type->grab_focus = grab_focus;
gnc_search_core_type->validate = gncs_validate;
@ -156,6 +159,19 @@ gnc_search_double_set_how (GNCSearchDouble *fi, QofQueryCompare how)
fi->how = how;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
GNCSearchDoublePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -36,6 +36,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static void editable_enters (GNCSearchCoreType *fe);
static void grab_focus (GNCSearchCoreType *fe);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
@ -54,6 +55,7 @@ struct _GNCSearchInt64Private
{
GtkWidget *entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -101,6 +103,7 @@ gnc_search_int64_class_init (GNCSearchInt64Class *klass)
object_class->finalize = gnc_search_int64_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->editable_enters = editable_enters;
gnc_search_core_type->grab_focus = grab_focus;
gnc_search_core_type->validate = gncs_validate;
@ -157,6 +160,19 @@ gnc_search_int64_set_how (GNCSearchInt64 *fi, QofQueryCompare how)
fi->how = how;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
GNCSearchInt64Private *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -36,6 +36,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static void editable_enters (GNCSearchCoreType *fe);
static void grab_focus (GNCSearchCoreType *fe);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
@ -54,6 +55,7 @@ struct _GNCSearchNumericPrivate
gboolean is_debcred;
GtkWidget * entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -101,6 +103,7 @@ gnc_search_numeric_class_init (GNCSearchNumericClass *klass)
object_class->finalize = gnc_search_numeric_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->editable_enters = editable_enters;
gnc_search_core_type->grab_focus = grab_focus;
gnc_search_core_type->validate = gncs_validate;
@ -186,6 +189,19 @@ gnc_search_numeric_set_option (GNCSearchNumeric *fi, QofNumericMatch option)
fi->option = option;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -36,6 +36,7 @@
#define d(x)
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
static gboolean gncs_validate (GNCSearchCoreType *fe);
static GtkWidget *gncs_get_widget(GNCSearchCoreType *fe);
@ -49,6 +50,7 @@ typedef struct _GNCSearchReconciledPrivate GNCSearchReconciledPrivate;
struct _GNCSearchReconciledPrivate
{
GtkWindow *parent;
gpointer dummy;
};
@ -97,6 +99,7 @@ gnc_search_reconciled_class_init (GNCSearchReconciledClass *klass)
object_class->finalize = gnc_search_reconciled_finalize;
/* override methods */
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->validate = gncs_validate;
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
@ -152,6 +155,19 @@ gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofCharMatch how)
fi->how = how;
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchReconciled *fi = (GNCSearchReconciled *)fe;
GNCSearchReconciledPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_RECONCILED (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{

View File

@ -38,6 +38,7 @@
#define d(x)
static void editable_enters (GNCSearchCoreType *fe);
static void pass_parent (GNCSearchCoreType *fe, gpointer parent);
static void grab_focus (GNCSearchCoreType *fe);
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe);
static gboolean gncs_validate (GNCSearchCoreType *fe);
@ -53,6 +54,7 @@ typedef struct _GNCSearchStringPrivate GNCSearchStringPrivate;
struct _GNCSearchStringPrivate
{
GtkWidget *entry;
GtkWindow *parent;
};
#define _PRIVATE(o) \
@ -101,6 +103,7 @@ gnc_search_string_class_init (GNCSearchStringClass *klass)
/* override methods */
gnc_search_core_type->editable_enters = editable_enters;
gnc_search_core_type->pass_parent = pass_parent;
gnc_search_core_type->grab_focus = grab_focus;
gnc_search_core_type->validate = gncs_validate;
gnc_search_core_type->get_widget = gncs_get_widget;
@ -175,15 +178,18 @@ static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchString *fi = (GNCSearchString *)fe;
GNCSearchStringPrivate *priv;
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (IS_GNCSEARCH_STRING (fi), FALSE);
priv = _PRIVATE(fi);
if (!fi->value || *(fi->value) == '\0')
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
dialog = gtk_message_dialog_new (GTK_WINDOW(priv->parent),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
@ -221,7 +227,7 @@ gncs_validate (GNCSearchCoreType *fe)
fi->value, regmsg);
g_free (regmsg);
dialog = gtk_message_dialog_new (NULL,
dialog = gtk_message_dialog_new (GTK_WINDOW(priv->parent),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
@ -301,6 +307,19 @@ editable_enters (GNCSearchCoreType *fe)
gtk_entry_set_activates_default(GTK_ENTRY (priv->entry), TRUE);
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchString *fi = (GNCSearchString *)fe;
GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (IS_GNCSEARCH_STRING (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
}
static GtkWidget *
gncs_get_widget (GNCSearchCoreType *fe)
{

View File

@ -1435,7 +1435,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
}
gnc_account_type_view_create (aw, compat_types);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(aw->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(aw->dialog), parent);
gtk_widget_grab_focus(GTK_WIDGET(aw->name_entry));

View File

@ -322,7 +322,7 @@ gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
LEAVE("");
}
void gnc_ui_close_book (QofBook* book)
void gnc_ui_close_book (QofBook* book, GtkWindow *parent)
{
struct CloseBookWindow *cbw;
GtkBuilder* builder;
@ -343,6 +343,10 @@ void gnc_ui_close_book (QofBook* book)
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(cbw->dialog), "GncBookCloseDialog");
/* parent */
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW(cbw->dialog), GTK_WINDOW(parent));
PINFO("Closed Book Window is %p, Dialog is %p", cbw, cbw->dialog);
/* close date */

View File

@ -40,8 +40,9 @@
*
* @param book This parameter specifies the book whose data
* will be closed.
* @param parent This parameter specifies the parent window
*/
void gnc_ui_close_book (QofBook* book);
void gnc_ui_close_book (QofBook* book, GtkWindow *parent);
/** @} */

View File

@ -165,6 +165,7 @@ void gnc_option_changed_gain_loss_account_widget_cb(GtkTreeSelection *selection,
gpointer data);
void gnc_option_changed_gain_loss_account_del_button_widget_cb (GtkButton *button,
gpointer data);
static void component_close_handler (gpointer data);
GtkWidget *
gnc_option_get_gtk_widget (GNCOption *option)
@ -2028,6 +2029,8 @@ gnc_options_dialog_help_button_cb(GtkWidget * widget, GNCOptionWin *win)
static void
gnc_options_dialog_cancel_button_cb(GtkWidget * widget, GNCOptionWin *win)
{
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->window));
if (win->close_cb)
(win->close_cb)(win, win->close_cb_data);
else
@ -2077,6 +2080,20 @@ gnc_options_dialog_destroy_cb (GtkWidget *object, GNCOptionWin *win)
}
}
static gboolean
gnc_options_dialog_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
GNCOptionWin *win = data;
if (event->keyval == GDK_KEY_Escape)
{
component_close_handler (win);
return TRUE;
}
else
return FALSE;
}
static void
gnc_options_dialog_reset_cb(GtkWidget * w, gpointer data)
{
@ -2139,6 +2156,7 @@ static void
component_close_handler (gpointer data)
{
GNCOptionWin *win = data;
gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(win->window));
gnc_options_dialog_cancel_button_cb (NULL, win);
}
@ -2250,7 +2268,7 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, retval);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(retval->window));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(retval->window), parent);
if (title)
gtk_window_set_title(GTK_WINDOW(retval->window), title);
@ -2291,6 +2309,9 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
g_signal_connect (retval->window, "destroy",
G_CALLBACK(gnc_options_dialog_destroy_cb), retval);
g_signal_connect (retval->window, "key_press_event",
G_CALLBACK(gnc_options_dialog_window_key_press_cb), retval);
g_object_unref(G_OBJECT(builder));
retval->destroyed = FALSE;

View File

@ -1442,7 +1442,7 @@ gnc_preferences_dialog (GtkWindow *parent)
dialog = gnc_preferences_dialog_create(parent);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog), parent);
gtk_widget_show(dialog);
gnc_register_gui_component(DIALOG_PREFERENCES_CM_CLASS,

View File

@ -413,7 +413,7 @@ gnc_reset_warnings_dialog (GtkWindow *parent)
/* Record the pointer to the rw data structure and clean up after */
g_object_set_data_full(G_OBJECT(rw_dialog->dialog), "dialog-structure", rw_dialog, g_free);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(rw_dialog->dialog), parent);
gnc_register_gui_component (DIALOG_RESET_WARNINGS_CM_CLASS,
NULL, close_handler, rw_dialog);

View File

@ -768,7 +768,7 @@ gnc_ui_tax_table_window_new (GtkWindow *parent, QofBook *book)
ttw);
tax_table_window_refresh (ttw);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (ttw->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (ttw->dialog), parent);
gtk_widget_show_all (ttw->dialog);
g_object_unref(G_OBJECT(builder));

View File

@ -366,7 +366,7 @@ gnc_totd_dialog (GtkWindow *parent, gboolean startup)
gnc_new_tip_number(totd_dialog, 1);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(totd_dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(totd_dialog->dialog), parent);
gtk_widget_show(GTK_WIDGET (totd_dialog->dialog));
gnc_register_gui_component(DIALOG_TOTD_CM_CLASS,

View File

@ -2046,7 +2046,8 @@ gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData)
}
gtk_builder_connect_signals(builder, xferData);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (xferData->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW (xferData->dialog), GTK_WINDOW (parent));
LEAVE(" ");
}

View File

@ -85,10 +85,12 @@ gnc_set_label_color(GtkWidget *label, gnc_numeric value)
* Args: group - the preferences group to look in for saved coords *
* window - the window for which the coords are to be *
* restored *
* parent - the parent window that can be used to position *
* window when it still has default entries *
* Returns: nothing *
\*******************************************************************/
void
gnc_restore_window_size(const char *group, GtkWindow *window)
gnc_restore_window_size(const char *group, GtkWindow *window, GtkWindow *parent)
{
gint wpos[2], wsize[2];
GVariant *geometry;
@ -104,47 +106,88 @@ gnc_restore_window_size(const char *group, GtkWindow *window)
geometry = gnc_prefs_get_value (group, GNC_PREF_LAST_GEOMETRY);
if (g_variant_is_of_type (geometry, (const GVariantType *) "(iiii)") )
{
gint screen_width;
gint screen_height;
#if GTK_CHECK_VERSION(3,22,0)
GdkWindow *win = gdk_screen_get_root_window (gtk_window_get_screen (window));
GdkMonitor *mon = gdk_display_get_monitor_at_window (gtk_widget_get_display (GTK_WIDGET(window)), win);
GdkRectangle monitor_size;
gdk_monitor_get_geometry (mon, &monitor_size);
screen_width = monitor_size.width;
screen_height = monitor_size.height;
#if GTK_CHECK_VERSION(3,22,0)
GdkDisplay *display = gdk_display_get_default ();
GdkMonitor *mon;
#else
screen_width = gdk_screen_width(); //default screen
screen_height = gdk_screen_height(); //default screen
GdkScreen *screen = gdk_screen_get_default ();
gint mon_num;
#endif
g_variant_get (geometry, "(iiii)",
&wpos[0], &wpos[1],
&wsize[0], &wsize[1]);
DEBUG("geometry from preferences - wpos[0]: %d, wpos[1]: %d, wsize[0]: %d, wsize[1]: %d",
wpos[0], wpos[1], wsize[0], wsize[1]);
#if GTK_CHECK_VERSION(3,22,0)
mon = gdk_display_get_monitor_at_point (display, wpos[0], wpos[1]);
gdk_monitor_get_geometry (mon, &monitor_size);
#else
mon_num = gdk_screen_get_monitor_at_point (screen, wpos[0], wpos[1]);
gdk_screen_get_monitor_geometry (screen, mon_num, &monitor_size);
#endif
DEBUG("monitor left top corner x: %d, y: %d, width: %d, height: %d",
monitor_size.x, monitor_size.y, monitor_size.width, monitor_size.height);
DEBUG("geometry from preferences - group, %s, wpos[0]: %d, wpos[1]: %d, wsize[0]: %d, wsize[1]: %d",
group, wpos[0], wpos[1], wsize[0], wsize[1]);
/* (-1, -1) means no geometry was saved (default preferences value) */
if ((wpos[0] != -1) && (wpos[1] != -1))
{
/* Keep the window on screen if possible */
if (screen_width != 0)
wpos[0] = wpos[0] % screen_width;
if (screen_height != 0)
wpos[1] = wpos[1] % screen_height;
if (wpos[0] - monitor_size.x + wsize[0] > monitor_size.x + monitor_size.width)
wpos[0] = monitor_size.x + monitor_size.width - wsize[0];
if (wpos[1] - monitor_size.y + wsize[1] > monitor_size.y + monitor_size.height)
wpos[1] = monitor_size.y + monitor_size.height - wsize[1];
/* make sure the cordinates have not left the monitor */
if (wpos[0] < monitor_size.x)
wpos[0] = monitor_size.x;
if (wpos[1] < monitor_size.y)
wpos[1] = monitor_size.y;
DEBUG("geometry after screen adaption - wpos[0]: %d, wpos[1]: %d, wsize[0]: %d, wsize[1]: %d",
wpos[0], wpos[1], wsize[0], wsize[1]);
gtk_window_move(window, wpos[0], wpos[1]);
}
else
{
/* preference is at default value -1,-1,-1,-1 */
if (parent != NULL)
{
gint parent_wpos[2], parent_wsize[2], window_wsize[2];
gtk_window_get_position (GTK_WINDOW(parent), &parent_wpos[0], &parent_wpos[1]);
gtk_window_get_size (GTK_WINDOW(parent), &parent_wsize[0], &parent_wsize[1]);
gtk_window_get_size (GTK_WINDOW(window), &window_wsize[0], &window_wsize[1]);
DEBUG("parent window - wpos[0]: %d, wpos[1]: %d, wsize[0]: %d, wsize[1]: %d - window size is %dx%d",
parent_wpos[0], parent_wpos[1], parent_wsize[0], parent_wsize[1],
window_wsize[0], window_wsize[1]);
/* check for gtk default size, no window size specified, let gtk decide location */
if ((window_wsize[0] == 200) && (window_wsize[1] == 200))
DEBUG("window size not specified, let gtk locate it");
else
gtk_window_move (window, parent_wpos[0] + (parent_wsize[0] - window_wsize[0])/2,
parent_wpos[1] + (parent_wsize[1] - window_wsize[1])/2);
}
}
/* Don't attempt to restore invalid sizes */
if ((wsize[0] > 0) && (wsize[1] > 0))
{
wsize[0] = MIN(wsize[0], monitor_size.width - 10);
wsize[1] = MIN(wsize[1], monitor_size.height - 10);
gtk_window_resize(window, wsize[0], wsize[1]);
}
}
g_variant_unref (geometry);
LEAVE("");
}
@ -152,7 +195,7 @@ gnc_restore_window_size(const char *group, GtkWindow *window)
/********************************************************************\
* gnc_save_window_size *
* save the window position and size into options whose names are *
* prefixed by the group name. *
* prefixed by the group name. *
* *
* Args: group - preferences group to save the options in *
* window - the window for which current position and size *
@ -165,6 +208,8 @@ gnc_save_window_size(const char *group, GtkWindow *window)
gint wpos[2], wsize[2];
GVariant *geometry;
ENTER("");
g_return_if_fail(group != NULL);
g_return_if_fail(window != NULL);
@ -173,10 +218,15 @@ gnc_save_window_size(const char *group, GtkWindow *window)
gtk_window_get_position(GTK_WINDOW(window), &wpos[0], &wpos[1]);
gtk_window_get_size(GTK_WINDOW(window), &wsize[0], &wsize[1]);
DEBUG("save geometry - wpos[0]: %d, wpos[1]: %d, wsize[0]: %d, wsize[1]: %d",
wpos[0], wpos[1], wsize[0], wsize[1]);
geometry = g_variant_new ("(iiii)", wpos[0], wpos[1],
wsize[0], wsize[1]);
gnc_prefs_set_value (group, GNC_PREF_LAST_GEOMETRY, geometry);
/* Don't unref geometry here, it is consumed by gnc_prefs_set_value */
LEAVE("");
}
@ -190,16 +240,21 @@ gnc_save_window_size(const char *group, GtkWindow *window)
void
gnc_window_adjust_for_screen(GtkWindow * window)
{
#if GTK_CHECK_VERSION(3,22,0)
GdkWindow *win;
GdkMonitor *mon;
GdkRectangle monitor_size;
#endif
gint screen_width;
gint screen_height;
gint wpos[2];
gint width;
gint height;
#if GTK_CHECK_VERSION(3,22,0)
GdkDisplay *display = gdk_display_get_default ();
GdkMonitor *mon;
#else
GdkScreen *screen = gdk_screen_get_default ();
gint mon_num;
#endif
ENTER("");
if (window == NULL)
return;
@ -207,31 +262,50 @@ gnc_window_adjust_for_screen(GtkWindow * window)
if (gtk_widget_get_window (GTK_WIDGET(window)) == NULL)
return;
gtk_window_get_position(GTK_WINDOW(window), &wpos[0], &wpos[1]);
gtk_window_get_size(GTK_WINDOW(window), &width, &height);
#if GTK_CHECK_VERSION(3,22,0)
win = gdk_screen_get_root_window (gtk_window_get_screen (window));
mon = gdk_display_get_monitor_at_window (gtk_widget_get_display (GTK_WIDGET(window)), win);
mon = gdk_display_get_monitor_at_point (display, wpos[0], wpos[1]);
gdk_monitor_get_geometry (mon, &monitor_size);
screen_width = monitor_size.width;
screen_height = monitor_size.height;
#else
screen_width = gdk_screen_width();
screen_height = gdk_screen_height();
mon_num = gdk_screen_get_monitor_at_point (screen, wpos[0], wpos[1]);
gdk_screen_get_monitor_geometry (screen, mon_num, &monitor_size);
#endif
width = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET(window)));
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET(window)));
if ((width <= screen_width) && (height <= screen_height))
DEBUG("monitor width is %d, height is %d; wwindow width is %d, height is %d",
monitor_size.width, monitor_size.height, width, height);
if ((width <= monitor_size.width) && (height <= monitor_size.height))
return;
width = MIN(width, screen_width - 10);
width = MAX(width, 0);
/* Keep the window on screen if possible */
if (wpos[0] - monitor_size.x + width > monitor_size.x + monitor_size.width)
wpos[0] = monitor_size.x + monitor_size.width - width;
height = MIN(height, screen_height - 10);
height = MAX(height, 0);
if (wpos[1] - monitor_size.y + height > monitor_size.y + monitor_size.height)
wpos[1] = monitor_size.y + monitor_size.height - height;
gdk_window_resize(gtk_widget_get_window (GTK_WIDGET(window)), width, height);
/* make sure the cordinates have not left the monitor */
if (wpos[0] < monitor_size.x)
wpos[0] = monitor_size.x;
if (wpos[1] < monitor_size.y)
wpos[1] = monitor_size.y;
DEBUG("move window to position %d, %d", wpos[0], wpos[1]);
gtk_window_move(window, wpos[0], wpos[1]);
/* if window is bigger, set it to monitor sizes */
width = MIN(width, monitor_size.width - 10);
height = MIN(height, monitor_size.height - 10);
DEBUG("resize window to width %d, height %d", width, height);
gtk_window_resize(GTK_WINDOW(window), width, height);
gtk_widget_queue_resize(GTK_WIDGET(window));
LEAVE("");
}
/********************************************************************\

View File

@ -36,19 +36,19 @@ void gnc_set_label_color (GtkWidget *label, gnc_numeric value);
* if window sizes are being saved, otherwise returns 0 for both. *
* *
* Args: prefix - the option name prefix *
* width - pointer to width *
* height - pointer to height *
* window - the window being restored *
* parent - the parent window for first use alignment *
* Returns: nothing *
\*******************************************************************/
void gnc_restore_window_size (const char *prefix, GtkWindow *window);
void gnc_restore_window_size (const char *prefix, GtkWindow *window,
GtkWindow *parent);
/********************************************************************\
* Save the window size into options whose names are determined *
* by the string prefix. *
* *
* Args: prefix - determines the options used to save the values *
* width - width of the window to save *
* height - height of the window to save *
* window - the window being saved *
* Returns: nothing *
\********************************************************************/
void gnc_save_window_size (const char *section, GtkWindow *window);

View File

@ -1317,7 +1317,8 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
data->balance_hash = g_hash_table_new(NULL, NULL);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(data->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(data->dialog), gnc_ui_get_main_window(NULL));
g_signal_connect (G_OBJECT(dialog), "destroy",
G_CALLBACK (gnc_hierarchy_destroy_cb), data);

View File

@ -362,7 +362,7 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), cd->show_currencies);
g_object_unref(G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog), GTK_WINDOW(parent));
}
static void

View File

@ -676,7 +676,7 @@ gnc_ui_fincalc_dialog_create(GtkWindow *parent)
gtk_builder_connect_signals(builder, fcd);
g_object_unref(G_OBJECT(builder));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(fcd->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(fcd->dialog), parent);
gtk_widget_show(fcd->dialog);
}

View File

@ -65,6 +65,8 @@ typedef struct
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
static void close_handler (gpointer user_data);
static void
gnc_find_account_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
@ -82,6 +84,20 @@ gnc_find_account_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data
LEAVE(" ");
}
static gboolean
gnc_find_account_dialog_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
FindAccountDialog *facc_dialog = user_data;
if (event->keyval == GDK_KEY_Escape)
{
close_handler (facc_dialog);
return TRUE;
}
else
return FALSE;
}
static void
jump_to_account (FindAccountDialog *facc_dialog, Account *jump_account)
{
@ -354,11 +370,14 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
g_signal_connect (facc_dialog->window, "destroy",
G_CALLBACK(gnc_find_account_dialog_window_destroy_cb), facc_dialog);
g_signal_connect (facc_dialog->window, "key_press_event",
G_CALLBACK(gnc_find_account_dialog_window_key_press_cb), facc_dialog);
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, facc_dialog);
g_object_unref (G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->window));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(facc_dialog->window), GTK_WINDOW(parent));
gtk_widget_show_all (GTK_WIDGET(facc_dialog->window));

View File

@ -716,7 +716,7 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
g_object_unref (G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(imap_dialog->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(imap_dialog->dialog), GTK_WINDOW(parent));
get_account_info (imap_dialog);
LEAVE(" ");

View File

@ -667,7 +667,6 @@ void
lv_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
GNCLotViewer *lv = user_data;
gnc_close_gui_component_by_data (LOT_VIEWER_CM_CLASS, lv);
gnc_unregister_gui_component_by_data (LOT_VIEWER_CM_CLASS, lv);
g_free (lv);
}
@ -732,7 +731,7 @@ lv_response_cb (GtkDialog *dialog, gint response, gpointer data)
switch (response)
{
case GTK_RESPONSE_CLOSE:
lv_close_handler(lv);
gnc_close_gui_component_by_data (LOT_VIEWER_CM_CLASS, lv);
return;
case RESPONSE_VIEW:
@ -979,7 +978,7 @@ lv_init_split_buttons (GNCLotViewer *lv)
/* ======================================================================== */
static void
lv_create (GNCLotViewer *lv)
lv_create (GNCLotViewer *lv, GtkWindow *parent)
{
gchar *win_title;
GtkBuilder *builder;
@ -989,6 +988,8 @@ lv_create (GNCLotViewer *lv)
lv->window = GTK_WIDGET(gtk_builder_get_object (builder, "lot_viewer_dialog"));
gtk_window_set_transient_for (GTK_WINDOW (lv->window), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(lv->window), "GncLotViewerDialog");
@ -1046,13 +1047,13 @@ lv_create (GNCLotViewer *lv)
lv_update_split_buttons(lv);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(lv->window));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(lv->window), parent);
}
/* ======================================================================== */
GNCLotViewer *
gnc_lot_viewer_dialog (Account *account)
gnc_lot_viewer_dialog (GtkWindow *parent, Account *account)
{
GNCLotViewer *lv;
gint component_id;
@ -1061,7 +1062,7 @@ gnc_lot_viewer_dialog (Account *account)
lv = g_new0 (GNCLotViewer, 1);
lv->account = account;
lv_create (lv);
lv_create (lv, parent);
gnc_lot_viewer_fill (lv);
lv_show_splits_free (lv);

View File

@ -30,6 +30,6 @@
typedef struct _GNCLotViewer GNCLotViewer;
/** Create and realize and show a lot-viewing dialog. */
GNCLotViewer * gnc_lot_viewer_dialog (Account *);
GNCLotViewer * gnc_lot_viewer_dialog (GtkWindow *parent, Account *account);
#endif /* LOT_VIEWER_H */

View File

@ -739,7 +739,7 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
g_object_unref(G_OBJECT(builder));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog), GTK_WINDOW (parent));
LEAVE(" ");
}

View File

@ -542,7 +542,7 @@ gnc_price_edit_dialog (GtkWidget * parent,
pedit_dialog = g_new0 (PriceEditDialog, 1);
gnc_price_pedit_dialog_create (parent, pedit_dialog, session);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pedit_dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pedit_dialog->dialog), GTK_WINDOW(parent));
pedit_dialog->type = type;
switch (type)

View File

@ -1732,7 +1732,7 @@ gnc_ui_print_check_dialog_create(GtkWidget *parent,
gtk_widget_destroy(GTK_WIDGET(gtk_builder_get_object (builder, "lower_left")));
gnc_ui_print_restore_dialog(pcd);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pcd->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pcd->dialog), GTK_WINDOW (parent));
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(pcd->dialog);

View File

@ -1240,7 +1240,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
/* Allow resize */
gtk_window_set_resizable (GTK_WINDOW(sxed->dialog), TRUE);
gnc_restore_window_size(GNC_PREFS_GROUP_SXED, GTK_WINDOW(sxed->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP_SXED, GTK_WINDOW(sxed->dialog), parent);
/* create the frequency-selection widget and example [dense-]calendar. */
schedXact_editor_create_freq_sel( sxed );

View File

@ -1213,7 +1213,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent,
/* Allow resize */
gtk_window_set_resizable (GTK_WINDOW (sxed->dialog), TRUE);
gnc_restore_window_size (GNC_PREFS_GROUP_SXED, GTK_WINDOW (sxed->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP_SXED, GTK_WINDOW (sxed->dialog), parent);
/* create the frequency-selection widget and example [dense-]calendar. */
schedXact_editor_create_freq_sel (sxed);

View File

@ -1040,7 +1040,7 @@ gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_insta
g_signal_connect(G_OBJECT(dialog->dialog), "response", G_CALLBACK(dialog_response_cb), dialog);
g_signal_connect(G_OBJECT(dialog->dialog), "destroy", G_CALLBACK(dialog_destroy_cb), dialog);
gnc_restore_window_size(GNC_PREFS_GROUP_STARTUP, GTK_WINDOW(dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP_STARTUP, GTK_WINDOW(dialog->dialog), parent);
dialog->component_id = gnc_register_gui_component
(DIALOG_SX_SINCE_LAST_RUN_CM_CLASS, NULL, close_handler, dialog);

View File

@ -1456,7 +1456,8 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
clear_gui (ti_dialog);
gnc_tax_info_set_changed (ti_dialog, FALSE);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP,
GTK_WINDOW(ti_dialog->dialog), GTK_WINDOW (parent));
if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))

View File

@ -57,6 +57,8 @@ typedef struct
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
static void close_handler (gpointer user_data);
static void
gnc_assoc_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
@ -73,6 +75,20 @@ gnc_assoc_dialog_window_destroy_cb (GtkWidget *object, gpointer user_data)
LEAVE(" ");
}
static gboolean
gnc_assoc_dialog_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
if (event->keyval == GDK_KEY_Escape)
{
close_handler (assoc_dialog);
return TRUE;
}
else
return FALSE;
}
static gint
sort_iter_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
@ -372,7 +388,7 @@ get_trans_info (AssocDialog *assoc_dialog)
}
static void
gnc_assoc_dialog_create (AssocDialog *assoc_dialog)
gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
{
GtkWidget *window;
GtkBuilder *builder;
@ -453,11 +469,14 @@ gnc_assoc_dialog_create (AssocDialog *assoc_dialog)
g_signal_connect (assoc_dialog->window, "destroy",
G_CALLBACK(gnc_assoc_dialog_window_destroy_cb), assoc_dialog);
g_signal_connect (assoc_dialog->window, "key_press_event",
G_CALLBACK(gnc_assoc_dialog_window_key_press_cb), assoc_dialog);
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, assoc_dialog);
g_object_unref (G_OBJECT(builder));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->window));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(assoc_dialog->window), parent);
get_trans_info (assoc_dialog);
gtk_widget_show_all (GTK_WIDGET(window));
@ -507,7 +526,7 @@ show_handler (const char *klass, gint component_id,
* Return: nothing *
\********************************************************************/
void
gnc_trans_assoc_dialog (void)
gnc_trans_assoc_dialog (GtkWindow *parent)
{
AssocDialog *assoc_dialog;
@ -519,12 +538,11 @@ gnc_trans_assoc_dialog (void)
}
assoc_dialog = g_new0 (AssocDialog, 1);
gnc_assoc_dialog_create (assoc_dialog);
gnc_assoc_dialog_create (parent, assoc_dialog);
gnc_register_gui_component (DIALOG_ASSOC_CM_CLASS,
refresh_handler, close_handler,
assoc_dialog);
// gtk_widget_show (assoc_dialog->window);
LEAVE(" ");
}

View File

@ -23,6 +23,6 @@
#ifndef DIALOG_TRANS_ASSOC_H
#define DIALOG_TRANS_ASSOC_H
void gnc_trans_assoc_dialog (void);
void gnc_trans_assoc_dialog (GtkWindow *parent);
#endif

View File

@ -624,7 +624,7 @@ static void
gnc_main_window_cmd_tools_trans_assoc (GtkAction *action, GncMainWindowActionData *data)
{
gnc_set_busy_cursor (NULL, TRUE);
gnc_trans_assoc_dialog ();
gnc_trans_assoc_dialog (GTK_WINDOW (data->window));
gnc_unset_busy_cursor (NULL);
}
@ -653,7 +653,7 @@ gnc_main_window_cmd_tools_financial_calculator (GtkAction *action, GncMainWindow
static void
gnc_main_window_cmd_tools_close_book (GtkAction *action, GncMainWindowActionData *data)
{
gnc_ui_close_book(gnc_get_current_book());
gnc_ui_close_book(gnc_get_current_book(), GTK_WINDOW (data->window));
}
static void

View File

@ -1749,10 +1749,9 @@ static void
gnc_plugin_page_account_tree_cmd_lots (GtkAction *action,
GncPluginPageAccountTree *page)
{
Account *account;
account = gnc_plugin_page_account_tree_get_current_account (page);
gnc_lot_viewer_dialog (account);
Account *account = gnc_plugin_page_account_tree_get_current_account (page);
GtkWidget *window = GNC_PLUGIN_PAGE (page)->window;
gnc_lot_viewer_dialog (GTK_WINDOW(window), account);
}
static void

View File

@ -4075,14 +4075,16 @@ static void
gnc_plugin_page_register_cmd_lots (GtkAction *action,
GncPluginPageRegister *page)
{
GtkWindow *window;
Account *account;
ENTER("(action %p, plugin_page %p)", action, page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
account = gnc_plugin_page_register_get_account (page);
gnc_lot_viewer_dialog (account);
gnc_lot_viewer_dialog (window, account);
LEAVE(" ");
}

View File

@ -3347,14 +3347,16 @@ static void
gnc_plugin_page_register2_cmd_lots (GtkAction *action,
GncPluginPageRegister2 *page) // this works
{
GtkWindow *window;
Account *account;
ENTER("(action %p, plugin_page %p)", action, page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
account = gnc_plugin_page_register2_get_account (page);
gnc_lot_viewer_dialog (account);
gnc_lot_viewer_dialog (window, account);
LEAVE(" ");
}

View File

@ -1672,7 +1672,7 @@ recnWindow (GtkWidget *parent, Account *account)
enable_subaccounts))
return NULL;
return recnWindowWithBalance (account, new_ending, statement_date);
return recnWindowWithBalance (parent, account, new_ending, statement_date);
}
@ -1699,13 +1699,14 @@ recnWindow_add_widget (GtkUIManager *merge,
* Opens up the window to reconcile an account, but with ending
* balance and statement date already given.
*
* Args: account - The account to reconcile
* Args: parent - The parent widget of the new window
* account - The account to reconcile
* new_ending - The amount for ending balance
* statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow
\********************************************************************/
RecnWindow *
recnWindowWithBalance (Account *account, gnc_numeric new_ending,
recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_ending,
time64 statement_date)
{
RecnWindow *recnData;
@ -1822,7 +1823,8 @@ recnWindowWithBalance (Account *account, gnc_numeric new_ending,
/* Force a reasonable starting size */
gtk_window_set_default_size(GTK_WINDOW(recnData->window), 800, 600);
gnc_restore_window_size (GNC_PREFS_GROUP_RECONCILE, GTK_WINDOW(recnData->window));
gnc_restore_window_size (GNC_PREFS_GROUP_RECONCILE,
GTK_WINDOW(recnData->window), GTK_WINDOW(parent));
gtk_container_add(GTK_CONTAINER(frame), main_area);
gtk_container_set_border_width(GTK_CONTAINER(main_area), 10);

View File

@ -52,12 +52,13 @@ RecnWindow *recnWindow (GtkWidget *parent, Account *account);
* Opens up the window to reconcile an account, but with ending
* balance and statement date already given.
*
* Args: account - The account to reconcile
* Args: parent - The parent widget of the new window
* account - The account to reconcile
* new_ending - The amount for ending balance
* statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow
\********************************************************************/
RecnWindow *recnWindowWithBalance (Account *account,
RecnWindow *recnWindowWithBalance (GtkWidget *parent, Account *account,
gnc_numeric new_ending,
time64 statement_date);

View File

@ -1764,7 +1764,8 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
/* Force a reasonable starting size */
gtk_window_set_default_size (GTK_WINDOW (recnData->window), 800, 600);
gnc_restore_window_size (GNC_PREFS_GROUP_RECONCILE, GTK_WINDOW (recnData->window));
gnc_restore_window_size (GNC_PREFS_GROUP_RECONCILE,
GTK_WINDOW (recnData->window), GTK_WINDOW(parent));
gtk_container_add(GTK_CONTAINER(frame), main_area);
gtk_container_set_border_width(GTK_CONTAINER(main_area), 10);

View File

@ -898,7 +898,8 @@ gnc_ab_initial_assistant_new(void)
selection = gtk_tree_view_get_selection(info->account_view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(info->window), gnc_ui_get_main_window(NULL));
g_signal_connect(info->account_view, "row-activated",
G_CALLBACK(account_list_clicked_cb), info);

View File

@ -1060,7 +1060,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
/* Show reconciliation window */
if (show_recn_window)
recnWindowWithBalance(gnc_acc, value, booked_tt);
recnWindowWithBalance(GTK_WIDGET (data->parent), gnc_acc, value, booked_tt);
return NULL;
}

View File

@ -626,7 +626,8 @@ reset_dialog(GncGWENGui *gui)
if (gui->parent)
gtk_window_set_transient_for(GTK_WINDOW(gui->dialog),
GTK_WINDOW(gui->parent));
gnc_restore_window_size(GNC_PREFS_GROUP_CONNECTION, GTK_WINDOW(gui->dialog));
gnc_restore_window_size(GNC_PREFS_GROUP_CONNECTION,
GTK_WINDOW(gui->dialog), GTK_WINDOW(gui->parent));
gui->keep_alive = TRUE;
gui->state = INIT;

View File

@ -944,7 +944,8 @@ csv_export_assistant_create (CsvExportInfo *info)
g_signal_connect (G_OBJECT(window), "destroy",
G_CALLBACK(csv_export_assistant_destroy_cb), info);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(info->window), gnc_ui_get_main_window(NULL));
if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
{
GObject *object = gtk_builder_get_object (builder, "paned");

View File

@ -668,7 +668,8 @@ csv_import_assistant_create (CsvImportInfo *info)
g_signal_connect (G_OBJECT(window), "destroy",
G_CALLBACK(csv_import_assistant_destroy_cb), info);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(info->window), gnc_ui_get_main_window(NULL));
gtk_builder_connect_signals (builder, info);
g_object_unref (G_OBJECT(builder));

View File

@ -654,7 +654,8 @@ CsvImpPriceAssist::CsvImpPriceAssist ()
summary_page = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page"));
summary_label = GTK_WIDGET(gtk_builder_get_object (builder, "summary_label"));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(csv_imp_asst));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(csv_imp_asst), gnc_ui_get_main_window(nullptr));
gtk_builder_connect_signals (builder, this);
g_object_unref (G_OBJECT(builder));

View File

@ -648,7 +648,8 @@ CsvImpTransAssist::CsvImpTransAssist ()
summary_page = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page"));
summary_label = GTK_WIDGET(gtk_builder_get_object (builder, "summary_label"));
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(csv_imp_asst));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(csv_imp_asst), gnc_ui_get_main_window(nullptr));
gtk_builder_connect_signals (builder, this);
g_object_unref (G_OBJECT(builder));

View File

@ -573,7 +573,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
if (heading)
gtk_label_set_text (GTK_LABEL (heading_label), heading);
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->main_widget));
gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->main_widget), GTK_WINDOW (parent));
gtk_widget_show_all (GTK_WIDGET (info->main_widget));
info->transaction_processed_cb = NULL;

View File

@ -492,7 +492,7 @@ init_match_picker_gui(GtkWidget *parent, GNCImportMatchPicker * matcher)
g_signal_connect((GObject *)matcher->reconciled_chk, "toggled", G_CALLBACK(match_show_reconciled_changed_cb), matcher);
gnc_restore_window_size(GNC_PREFS_GROUP,
GTK_WINDOW (matcher->transaction_matcher));
GTK_WINDOW (matcher->transaction_matcher), GTK_WINDOW(parent));
gtk_widget_show(matcher->transaction_matcher);
g_object_unref(G_OBJECT(builder));

View File

@ -3655,7 +3655,8 @@ gnc_ui_qif_import_assistant_make(QIFImportWindow *qif_win)
box = GTK_WIDGET(gtk_builder_get_object (builder, "currency_picker_hbox"));
gtk_box_pack_start(GTK_BOX(box), qif_win->currency_picker, TRUE, TRUE, 0);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(qif_win->window));
gnc_restore_window_size (GNC_PREFS_GROUP,
GTK_WINDOW(qif_win->window), gnc_ui_get_main_window(NULL));
g_signal_connect( qif_win->window, "destroy",
G_CALLBACK(gnc_ui_qif_import_assistant_destroy), qif_win );

View File

@ -533,7 +533,8 @@ gnc_ui_custom_report_internal(GncMainWindow * window)
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(crd->dialog), "GncCustomReportDialog");
gnc_restore_window_size (GNC_PREFS_GROUP_REPORT_SAVED_CONFIGS, GTK_WINDOW(crd->dialog));
gnc_restore_window_size (GNC_PREFS_GROUP_REPORT_SAVED_CONFIGS,
GTK_WINDOW(crd->dialog), GTK_WINDOW(window));
/* connect the signals */
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, crd);