Merge branch 'matcher-help' into Bug797275

This commit is contained in:
David Cousens 2019-06-29 13:53:08 +10:00
commit 98cf760c6e
2 changed files with 78 additions and 40 deletions

View File

@ -740,6 +740,9 @@
<action-widget response="-5">ok_button1</action-widget> <action-widget response="-5">ok_button1</action-widget>
</action-widgets> </action-widgets>
</object> </object>
<object class="GtkTextBuffer" id="textbuffer1">
<property name="text" translatable="yes">Multiple transaction rows may be selected and a transfer account assigned to all selected rows. Use Ctrl Left Click or Shift-Click to select multiple rows and then Right Click to select a transfer account. Only rows with "A" checked can be added to a selection.</property>
</object>
<object class="GtkTextBuffer" id="textbuffer2"> <object class="GtkTextBuffer" id="textbuffer2">
<property name="text" translatable="yes">This transaction probably requires your intervention or it will be imported unbalanced.</property> <property name="text" translatable="yes">This transaction probably requires your intervention or it will be imported unbalanced.</property>
</object> </object>
@ -1095,6 +1098,35 @@
<property name="top_attach">3</property> <property name="top_attach">3</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow 36">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="textview6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="pixels_above_lines">5</property>
<property name="pixels_below_lines">5</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="left_margin">5</property>
<property name="right_margin">5</property>
<property name="cursor_visible">False</property>
<property name="buffer">textbuffer1</property>
<property name="accepts_tab">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
<property name="width">2</property>
</packing>
</child>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
@ -1257,9 +1289,9 @@
</object> </object>
</child> </child>
<action-widgets> <action-widgets>
<action-widget response="-11">matcher__help</action-widget>
<action-widget response="-6">matcher_cancel</action-widget> <action-widget response="-6">matcher_cancel</action-widget>
<action-widget response="-5">matcher_ok</action-widget> <action-widget response="-5">matcher_ok</action-widget>
<action-widget response="-11">matcher__help</action-widget>
</action-widgets> </action-widgets>
</object> </object>
</interface> </interface>

View File

@ -104,31 +104,32 @@ void on_matcher_help_close_clicked (GtkButton *button, gpointer user_data);
/* Local prototypes */ /* Local prototypes */
static void gnc_gen_trans_assign_transfer_account ( static void gnc_gen_trans_assign_transfer_account (
GtkTreeView *treeview, GtkTreeView *treeview,
gboolean *first, gboolean *first,
gboolean is_selection, gboolean is_selection,
GtkTreePath *path, GtkTreePath *path,
Account **new_acc, Account **new_acc,
GNCImportMainMatcher *info); GNCImportMainMatcher *info);
static void gnc_gen_trans_assign_transfer_account_to_selection_cb ( static void gnc_gen_trans_assign_transfer_account_to_selection_cb (
GtkMenuItem *menuitem, GtkMenuItem *menuitem,
GNCImportMainMatcher *info); GNCImportMainMatcher *info);
static void gnc_gen_trans_view_popup_menu (GtkTreeView *treeview, static void gnc_gen_trans_view_popup_menu (
GdkEvent *event, GtkTreeView *treeview,
GNCImportMainMatcher *info); GdkEvent *event,
static gboolean gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview, GNCImportMainMatcher *info);
GdkEvent *event, static gboolean gnc_gen_trans_onButtonPressed_cb (
GNCImportMainMatcher *info); GtkTreeView *treeview,
static gboolean gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview, GdkEvent *event,
GdkEvent *event, GNCImportMainMatcher *info);
GNCImportMainMatcher *info); static gboolean gnc_gen_trans_onPopupMenu_cb (
static gboolean view_selection_function (GtkTreeSelection *selection, GtkTreeView *treeview,
GtkTreeModel *model, GdkEvent *event,
GtkTreePath *path, GNCImportMainMatcher *info);
gboolean path_currently_selected, static void refresh_model_row (
gpointer data); GNCImportMainMatcher *gui,
static void refresh_model_row (GNCImportMainMatcher *gui, GtkTreeModel *model, GtkTreeModel *model,
GtkTreeIter *iter, GNCImportTransInfo *info); GtkTreeIter *iter,
GNCImportTransInfo *info);
/* end local prototypes */ /* end local prototypes */
void gnc_gen_trans_list_delete (GNCImportMainMatcher *info) void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
@ -243,6 +244,7 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer3"); gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer3");
gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer4"); gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer4");
gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5"); gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer5");
gnc_builder_add_from_file (builder, "dialog-import.glade", "textbuffer1");
gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog"); gnc_builder_add_from_file (builder, "dialog-import.glade", "matcher_help_dialog");
if (info->dark_theme == TRUE) if (info->dark_theme == TRUE)
@ -287,14 +289,15 @@ run_account_picker_dialog (GNCImportMainMatcher *info,
g_assert (trans_info); g_assert (trans_info);
old_acc = gnc_import_TransInfo_get_destacc (trans_info); old_acc = gnc_import_TransInfo_get_destacc (trans_info);
new_acc = gnc_import_select_account (info->main_widget, new_acc = gnc_import_select_account (
NULL, info->main_widget,
TRUE, NULL,
_("Destination account for the auto-balance split."), TRUE,
xaccTransGetCurrency (gnc_import_TransInfo_get_trans (trans_info)), _("Destination account for the auto-balance split."),
ACCT_TYPE_NONE, xaccTransGetCurrency (gnc_import_TransInfo_get_trans (trans_info)),
old_acc, ACCT_TYPE_NONE,
&ok_pressed); old_acc,
&ok_pressed);
if (ok_pressed) if (ok_pressed)
gnc_import_TransInfo_set_destacc (trans_info, new_acc, TRUE); gnc_import_TransInfo_set_destacc (trans_info, new_acc, TRUE);
} }
@ -464,8 +467,9 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
} }
static void static void
gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem, gnc_gen_trans_assign_transfer_account_to_selection_cb (
GNCImportMainMatcher *info) GtkMenuItem *menuitem,
GNCImportMainMatcher *info)
{ {
GtkTreeView *treeview; GtkTreeView *treeview;
GtkTreeSelection *selection; GtkTreeSelection *selection;
@ -494,13 +498,15 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
{ {
gchar *path_str = gtk_tree_path_to_string (l->data); gchar *path_str = gtk_tree_path_to_string (l->data);
DEBUG("passing first = %s", first ? "true" : "false"); DEBUG("passing first = %s", first ? "true" : "false");
DEBUG("passing is_selection = %s", is_selection ? "true" : "false"); DEBUG("passing is_selection = %s",
is_selection ? "true" : "false");
DEBUG("passing path = %s", path_str); DEBUG("passing path = %s", path_str);
g_free (path_str); g_free (path_str);
DEBUG("passing account value = %s", DEBUG("passing account value = %s",
gnc_account_get_full_name (assigned_account)); gnc_account_get_full_name (assigned_account));
gnc_gen_trans_assign_transfer_account (treeview, gnc_gen_trans_assign_transfer_account (treeview,
&first, is_selection, l->data, &assigned_account, info); &first, is_selection, l->data,
&assigned_account, info);
DEBUG("returned value of account = %s", DEBUG("returned value of account = %s",
gnc_account_get_full_name (assigned_account)); gnc_account_get_full_name (assigned_account));
DEBUG("returned value of first = %s", first ? "true" : "false"); DEBUG("returned value of first = %s", first ? "true" : "false");
@ -575,7 +581,8 @@ gnc_gen_trans_view_popup_menu (GtkTreeView *treeview,
ENTER (""); ENTER ("");
menu = gtk_menu_new(); menu = gtk_menu_new();
menuitem = gtk_menu_item_new_with_label (_("Assign a transfer account.")); menuitem = gtk_menu_item_new_with_label (
_("Assign a transfer account to the selection."));
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",
G_CALLBACK( G_CALLBACK(
gnc_gen_trans_assign_transfer_account_to_selection_cb), gnc_gen_trans_assign_transfer_account_to_selection_cb),
@ -617,7 +624,7 @@ gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview,
selection = gtk_tree_view_get_selection (treeview); selection = gtk_tree_view_get_selection (treeview);
if (gtk_tree_selection_count_selected_rows (selection) > 0) if (gtk_tree_selection_count_selected_rows (selection) > 0)
{ {
gnc_gen_trans_view_popup_menu (treeview, event, info); gnc_gen_trans_view_popup_menu (treeview, event, info);
} }
LEAVE("return TRUE"); LEAVE("return TRUE");
return TRUE; return TRUE;
@ -646,7 +653,6 @@ gnc_gen_trans_onPopupMenu_cb (GtkTreeView *treeview,
return TRUE; return TRUE;
} }
static GtkTreeViewColumn * static GtkTreeViewColumn *
add_text_column(GtkTreeView *view, const gchar *title, int col_num) add_text_column(GtkTreeView *view, const gchar *title, int col_num)
{ {