Change the Tax Table dialogue to be based on a GtkWindow

When using Gnucash on Microsoft Windows and a dialog opens a further
dialog when you switch away from the application and back the last
dialog that has the focus is behind the parent and it appears like the
application has froze. To fix this try to use only one level of dialogue
 so change the Tax Table to use a GtkWindow with no transient parent.
This commit is contained in:
Robert Fewell 2020-05-08 14:03:53 +01:00
parent ccc1247e25
commit 8500f36c44
2 changed files with 43 additions and 44 deletions

View File

@ -30,6 +30,7 @@
#include "dialog-utils.h"
#include "gnc-component-manager.h"
#include "gnc-session.h"
#include "gnc-ui.h"
#include "gnc-gui-query.h"
#include "gnc-gtk-utils.h"
@ -78,6 +79,7 @@ struct _taxtable_window
GncTaxTableEntry * current_entry;
QofBook * book;
gint component_id;
QofSession *session;
};
typedef struct _new_taxtable
@ -804,16 +806,15 @@ gnc_ui_tax_table_window_new (GtkWindow *parent, QofBook *book)
/* Didn't find one -- create a new window */
ttw = g_new0 (TaxTableWindow, 1);
ttw->book = book;
ttw->session = gnc_get_current_session();
/* Open and read the Glade File */
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-tax-table.glade", "tax_table_window_dialog");
ttw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "tax_table_window_dialog"));
gnc_builder_add_from_file (builder, "dialog-tax-table.glade", "tax_table_window");
ttw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "tax_table_window"));
ttw->names_view = GTK_WIDGET(gtk_builder_get_object (builder, "tax_tables_view"));
ttw->entries_view = GTK_WIDGET(gtk_builder_get_object (builder, "tax_table_entries"));
gtk_window_set_transient_for (GTK_WINDOW (ttw->dialog), parent);
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(ttw->dialog), "gnc-id-new-tax-table");
gnc_widget_style_context_add_class (GTK_WIDGET(ttw->dialog), "gnc-class-taxes");
@ -878,6 +879,8 @@ gnc_ui_tax_table_window_new (GtkWindow *parent, QofBook *book)
tax_table_window_close_handler,
ttw);
gnc_gui_component_set_session (ttw->component_id, ttw->session);
tax_table_window_refresh (ttw);
gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW (ttw->dialog), parent);
gtk_widget_show_all (ttw->dialog);

View File

@ -2,49 +2,18 @@
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="tax_table_window_dialog">
<object class="GtkWindow" id="tax_table_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Tax Tables</property>
<property name="type_hint">normal</property>
<signal name="destroy" handler="tax_table_window_destroy_cb" swapped="no"/>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox4">
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="tax_table_window_close" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox4">
<property name="visible">True</property>
@ -84,7 +53,7 @@
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
@ -194,7 +163,7 @@
<property name="headers_visible">False</property>
<property name="rules_hint">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2"/>
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
@ -274,14 +243,41 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="dialog-action_area">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="tax_table_window_close" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">close_button</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="type_liststore">
<columns>