Bug 797185 - Add Reload button for Transaction associations

Currently to refresh the list the dialog needs to be closed and
re-opened so add a button to reload the model instead. Also added
another button that does a reload and location check in one.
This commit is contained in:
Robert Fewell 2020-05-18 15:06:05 +01:00
parent 1884ae2093
commit d282e645a7
2 changed files with 77 additions and 17 deletions

View File

@ -599,20 +599,6 @@ assoc_dialog_update (AssocDialog *assoc_dialog)
g_object_unref (G_OBJECT(model));
}
static void
gnc_assoc_dialog_check_button_cb (GtkWidget * widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
assoc_dialog_update (assoc_dialog);
}
static void
gnc_assoc_dialog_close_button_cb (GtkWidget * widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
gnc_close_gui_component (assoc_dialog->component_id);
}
static void
row_selected_cb (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer user_data)
@ -750,6 +736,47 @@ get_trans_info (AssocDialog *assoc_dialog)
g_object_unref (G_OBJECT(assoc_dialog->model));
}
static void
gnc_assoc_dialog_reload_button_cb (GtkWidget *widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
gchar *path_head = assoc_get_path_head ();
if (g_strcmp0 (path_head, assoc_dialog->path_head) != 0)
{
g_free (assoc_dialog->path_head);
assoc_dialog->path_head = g_strdup (path_head);
// display path head text and test if present
assoc_set_path_head_label (assoc_dialog->path_head_label);
}
g_free (path_head);
get_trans_info (assoc_dialog);
}
static void
gnc_assoc_dialog_reload_check_button_cb (GtkWidget *widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
gnc_assoc_dialog_reload_button_cb (widget, user_data);
assoc_dialog_update (assoc_dialog);
}
static void
gnc_assoc_dialog_check_button_cb (GtkWidget *widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
assoc_dialog_update (assoc_dialog);
}
static void
gnc_assoc_dialog_close_button_cb (GtkWidget *widget, gpointer user_data)
{
AssocDialog *assoc_dialog = user_data;
gnc_close_gui_component (assoc_dialog->component_id);
}
static void
gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
{
@ -768,6 +795,11 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
assoc_dialog->window = window;
assoc_dialog->session = gnc_get_current_session();
button = GTK_WIDGET(gtk_builder_get_object (builder, "reload_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_reload_button_cb), assoc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "reload_and_check_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_reload_check_button_cb), assoc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "check_button"));
g_signal_connect(button, "clicked", G_CALLBACK(gnc_assoc_dialog_check_button_cb), assoc_dialog);
button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));

View File

@ -316,9 +316,37 @@
<object class="GtkButtonBox" id="buttonbox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="reload_and_check_button">
<property name="label" translatable="yes">Reload and Locate _Associations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reload_button">
<property name="label" translatable="yes">_Reload</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="check_button">
<property name="label" translatable="yes">_Locate Association</property>
<property name="label" translatable="yes">_Locate Associations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -327,7 +355,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -343,7 +371,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>