Fix Transient parent warnings for SX editor

This commit is contained in:
Robert Fewell 2017-12-30 17:13:22 +00:00
parent dc1ec68646
commit b8a85ab80a
11 changed files with 60 additions and 32 deletions

View File

@ -1114,8 +1114,8 @@ sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud )
* Create the Schedule Editor Dialog *
************************************/
GncSxEditorDialog *
gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx,
gboolean newSX)
gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
SchedXaction *sx, gboolean newSX)
{
GncSxEditorDialog *sxed;
GtkBuilder *builder;
@ -1192,12 +1192,13 @@ gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx,
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog");
gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent);
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box"));
sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL),
FALSE, FALSE));
sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE));
gtk_widget_show(GTK_WIDGET(sxed->endDateEntry));
g_signal_connect( sxed->endDateEntry, "date-changed",
G_CALLBACK( sxed_excal_update_adapt_cb ), sxed );
@ -1714,6 +1715,7 @@ typedef struct _acct_deletion_handler_data
{
GList *affected_sxes;
GtkWidget *dialog;
GtkWindow *parent;
} acct_deletion_handler_data;
@ -1726,8 +1728,8 @@ _open_editors(GtkDialog *dialog, gint response_code, gpointer data)
GList *sx_iter;
for (sx_iter = adhd->affected_sxes; sx_iter; sx_iter = sx_iter->next)
{
gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)sx_iter->data,
FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(adhd->parent),
(SchedXaction*)sx_iter->data, FALSE);
}
}
g_list_free(adhd->affected_sxes);
@ -1759,6 +1761,7 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_
acct_deletion_handler_data *data;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWindow *parent;
GtkListStore *name_list;
GtkTreeView *list;
GtkTreeViewColumn *name_column;
@ -1768,6 +1771,9 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_
gnc_builder_add_from_file (builder, "dialog-sx.glade", "account_deletion_dialog");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "account_deletion_dialog"));
parent = gnc_ui_get_main_window (NULL);
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
list = GTK_TREE_VIEW(gtk_builder_get_object (builder, "sx_list"));
@ -1776,6 +1782,7 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_
data = (acct_deletion_handler_data*)g_new0(acct_deletion_handler_data, 1);
data->dialog = dialog;
data->parent = parent;
data->affected_sxes = affected_sxes;
name_list = gtk_list_store_new(1, G_TYPE_STRING);
for (sx_iter = affected_sxes; sx_iter != NULL; sx_iter = sx_iter->next)

View File

@ -24,6 +24,7 @@
#define DIALOG_SX_EDITOR_H
#include "SchedXaction.h"
#include <gtk/gtk.h>
#define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions"
#define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor"
@ -36,8 +37,8 @@
typedef struct _GncSxEditorDialog GncSxEditorDialog;
GncSxEditorDialog* gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx,
gboolean newSX);
GncSxEditorDialog* gnc_ui_scheduled_xaction_editor_dialog_create(GtkWindow *parent,
SchedXaction *sx, gboolean newSX);
void gnc_ui_scheduled_xaction_editor_dialog_destroy(GncSxEditorDialog *sxd);

View File

@ -1087,8 +1087,8 @@ sxed_delete_event (GtkWidget *widget, GdkEvent *event, gpointer ud)
* Create the Schedule Editor Dialog *
************************************/
GncSxEditorDialog2 *
gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx,
gboolean newSX)
gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent,
SchedXaction *sx, gboolean newSX)
{
GncSxEditorDialog2 *sxed;
GtkBuilder *builder;
@ -1166,11 +1166,12 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx,
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog");
gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent);
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box"));
sxed->endDateEntry = GNC_DATE_EDIT (gnc_date_edit_new (gnc_time (NULL),
FALSE, FALSE));
sxed->endDateEntry = GNC_DATE_EDIT (gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE));
gtk_widget_show (GTK_WIDGET (sxed->endDateEntry));
g_signal_connect (sxed->endDateEntry, "date-changed",
G_CALLBACK (sxed_excal_update_adapt_cb), sxed);
@ -1665,6 +1666,7 @@ typedef struct _acct_deletion_handler_data
{
GList *affected_sxes;
GtkWidget *dialog;
GtkWindow *parent;
} acct_deletion_handler_data;
@ -1677,8 +1679,8 @@ _open_editors (GtkDialog *dialog, gint response_code, gpointer data)
GList *sx_iter;
for (sx_iter = adhd->affected_sxes; sx_iter; sx_iter = sx_iter->next)
{
gnc_ui_scheduled_xaction_editor_dialog_create2 ((SchedXaction*)sx_iter->data,
FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create2 (GTK_WINDOW(adhd->parent),
(SchedXaction*)sx_iter->data, FALSE);
}
}
g_list_free (adhd->affected_sxes);
@ -1710,6 +1712,7 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user
acct_deletion_handler_data *data;
GtkBuilder *builder;
GtkWidget *dialog;
GtkWindow *parent;
GtkListStore *name_list;
GtkTreeView *list;
GtkTreeViewColumn *name_column;
@ -1719,6 +1722,9 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user
gnc_builder_add_from_file (builder, "dialog-sx.glade", "account_deletion_dialog");
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "account_deletion_dialog"));
parent = gnc_ui_get_main_window (NULL);
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
list = GTK_TREE_VIEW (gtk_builder_get_object (builder, "sx_list"));
@ -1727,6 +1733,7 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user
data = (acct_deletion_handler_data*)g_new0 (acct_deletion_handler_data, 1);
data->dialog = dialog;
data->parent = parent;
data->affected_sxes = affected_sxes;
name_list = gtk_list_store_new (1, G_TYPE_STRING);
for (sx_iter = affected_sxes; sx_iter != NULL; sx_iter = sx_iter->next)

View File

@ -36,8 +36,8 @@
typedef struct _GncSxEditorDialog2 GncSxEditorDialog2;
GncSxEditorDialog2* gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx,
gboolean newSX);
GncSxEditorDialog2* gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent,
SchedXaction *sx, gboolean newSX);
void gnc_ui_scheduled_xaction_editor_dialog_destroy2 (GncSxEditorDialog2 *sxd);

View File

@ -612,7 +612,8 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti)
context = g_main_context_default();
while (g_main_context_iteration(context, FALSE));
gnc_ui_scheduled_xaction_editor_dialog_create(sxfti->sx, TRUE /* newSX */);
gnc_ui_scheduled_xaction_editor_dialog_create(gnc_ui_get_main_window (sxfti->dialog),
sxfti->sx, TRUE /* newSX */);
/* close ourself, since advanced editing entails us, and there are sync
* issues otherwise. */
sxftd_close(sxfti, FALSE);
@ -752,7 +753,7 @@ sxftd_update_excal_adapt( GObject *o, gpointer ud )
* Create the dialog *
********************/
void
gnc_sx_create_from_trans( Transaction *trans )
gnc_sx_create_from_trans( GtkWindow *parent, Transaction *trans )
{
#ifndef __MINGW32__
int errno;
@ -771,6 +772,8 @@ gnc_sx_create_from_trans( Transaction *trans )
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncSxFromTransDialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
sxfti->builder = builder;
sxfti->dialog = dialog;
sxfti->trans = trans;

View File

@ -27,6 +27,6 @@
#include "Transaction.h"
void gnc_sx_create_from_trans(Transaction *trans);
void gnc_sx_create_from_trans(GtkWindow *parent, Transaction *trans);
#endif

View File

@ -3799,13 +3799,15 @@ gnc_plugin_page_register_cmd_schedule (GtkAction *action,
GncPluginPageRegister *plugin_page)
{
GncPluginPageRegisterPrivate *priv;
GtkWindow *window;
ENTER("(action %p, plugin_page %p)", action, plugin_page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
gsr_default_schedule_handler(priv->gsr, NULL);
gsr_default_schedule_handler(priv->gsr, window);
LEAVE(" ");
}

View File

@ -3622,6 +3622,7 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
Transaction *trans;
GtkWindow *window;
ENTER("(action %p, plugin_page %p)", action, plugin_page);
@ -3629,6 +3630,7 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
trans = gnc_tree_view_split_reg_get_current_trans (view);
@ -3682,12 +3684,12 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
if (theSX)
{
gnc_ui_scheduled_xaction_editor_dialog_create2 (theSX, FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create2 (window, theSX, FALSE);
LEAVE(" ");
return;
}
}
gnc_sx_create_from_trans (trans);
gnc_sx_create_from_trans (window, trans);
LEAVE(" ");
}

View File

@ -639,6 +639,7 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window,
static void
gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
{
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
SchedXaction *new_sx;
gboolean new_sx_flag = TRUE;
@ -655,7 +656,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
schedule = g_list_append(schedule, r);
gnc_sx_set_schedule(new_sx, schedule);
}
gnc_ui_scheduled_xaction_editor_dialog_create(new_sx, new_sx_flag);
gnc_ui_scheduled_xaction_editor_dialog_create(window, new_sx, new_sx_flag);
}
#ifdef REGISTER2_ENABLED
@ -663,6 +664,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page)
static void
gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page)
{
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
SchedXaction *new_sx;
gboolean new_sx_flag = TRUE;
@ -679,7 +681,7 @@ gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page)
schedule = g_list_append (schedule, r);
gnc_sx_set_schedule (new_sx, schedule);
}
gnc_ui_scheduled_xaction_editor_dialog_create2 (new_sx, new_sx_flag);
gnc_ui_scheduled_xaction_editor_dialog_create2 (window, new_sx, new_sx_flag);
}
/*################## Added for Reg2 #################*/
#endif
@ -687,7 +689,8 @@ gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page)
static void
_edit_sx(gpointer data, gpointer user_data)
{
gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)data, FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(user_data),
(SchedXaction*)data, FALSE);
}
#ifdef REGISTER2_ENABLED
@ -695,7 +698,8 @@ _edit_sx(gpointer data, gpointer user_data)
static void
_edit_sx2 (gpointer data, gpointer user_data)
{
gnc_ui_scheduled_xaction_editor_dialog_create2 ((SchedXaction*)data, FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create2 (GTK_WINDOW(user_data),
(SchedXaction*)data, FALSE);
}
/*################## Added for Reg2 #################*/
#endif
@ -711,6 +715,7 @@ static void
gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
{
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
GtkTreeSelection *selection;
GList *selected_paths, *to_edit;
GtkTreeModel *model;
@ -726,7 +731,7 @@ gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page)
to_edit = gnc_g_list_map(selected_paths,
(GncGMapFunc)_argument_reorder_fn,
priv->tree_view);
g_list_foreach(to_edit, (GFunc)_edit_sx, NULL);
g_list_foreach(to_edit, (GFunc)_edit_sx, window);
g_list_free(to_edit);
g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL);
g_list_free(selected_paths);
@ -738,6 +743,7 @@ static void
gnc_plugin_page_sx_list_cmd_edit2 (GtkAction *action, GncPluginPageSxList *page)
{
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE (page);
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
GtkTreeSelection *selection;
GList *selected_paths, *to_edit;
GtkTreeModel *model;
@ -753,7 +759,7 @@ gnc_plugin_page_sx_list_cmd_edit2 (GtkAction *action, GncPluginPageSxList *page)
to_edit = gnc_g_list_map (selected_paths,
(GncGMapFunc)_argument_reorder_fn,
priv->tree_view);
g_list_foreach(to_edit, (GFunc)_edit_sx2, NULL);
g_list_foreach(to_edit, (GFunc)_edit_sx2, window);
g_list_free (to_edit);
g_list_foreach (selected_paths, (GFunc)gtk_tree_path_free, NULL);
g_list_free (selected_paths);
@ -769,9 +775,10 @@ gppsl_row_activated_cb(GtkTreeView *tree_view,
{
GncPluginPageSxList *page = GNC_PLUGIN_PAGE_SX_LIST(user_data);
GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page);
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
SchedXaction *sx = gnc_tree_view_sx_list_get_sx_from_path(GNC_TREE_VIEW_SX_LIST(priv->tree_view), path);
gnc_ui_scheduled_xaction_editor_dialog_create(sx, FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create(window, sx, FALSE);
}

View File

@ -1363,10 +1363,10 @@ gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data )
if ( theSX )
{
gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE);
gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(data), theSX, FALSE);
return;
}
gnc_sx_create_from_trans(pending_trans);
gnc_sx_create_from_trans(GTK_WINDOW(data), pending_trans);
}
void

View File

@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="account_deletion_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Account Deletion</property>