From 632764e1e27ffbe99b94a335fecb68cc44e455da Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sun, 2 Jul 2017 09:50:02 +0100 Subject: [PATCH] Add grid line preference to various tree views I have tried to add the grid line preference to tree views with more than one column. There maybe more required. With the addition of css classes, individual tree view grids maybe turned off by setting the border colour to transparent. --- src/business/business-gnome/dialog-payment.c | 3 +++ src/gnome-utils/gnc-query-view.c | 3 +++ src/gnome-utils/gnc-tree-view.c | 4 ++++ src/gnome/assistant-loan.c | 3 +++ src/gnome/assistant-stock-split.c | 3 +++ src/gnome/dialog-find-account.c | 3 +++ src/gnome/dialog-imap-editor.c | 4 ++++ src/gnome/dialog-lot-viewer.c | 9 +++++++++ src/gnome/dialog-sx-editor.c | 3 +++ src/gnome/dialog-sx-editor2.c | 3 +++ src/gnome/dialog-sx-since-last-run.c | 3 +++ src/gnome/dialog-trans-assoc.c | 4 ++++ src/gnome/gnc-budget-view.c | 3 +++ 13 files changed, 48 insertions(+) diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c index c1f54a7ebd0..b535ffc74e0 100644 --- a/src/business/business-gnome/dialog-payment.c +++ b/src/business/business-gnome/dialog-payment.c @@ -993,6 +993,9 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(pw->docs_list_tree_view), gnc_tree_view_get_grid_lines_pref ()); + /* Configure date column */ renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_get_column (GTK_TREE_VIEW (pw->docs_list_tree_view), 0); diff --git a/src/gnome-utils/gnc-query-view.c b/src/gnome-utils/gnc-query-view.c index 1f0d473bdfe..a04ca510155 100644 --- a/src/gnome-utils/gnc-query-view.c +++ b/src/gnome-utils/gnc-query-view.c @@ -322,6 +322,9 @@ gnc_query_view_init_view (GNCQueryView *qview) /* compute the number of columns and fill in the rest of the view */ qview->num_columns = g_list_length (qview->column_params); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ()); + for (i = 0, node = qview->column_params; node; node = node->next, i++) { const char *type; diff --git a/src/gnome-utils/gnc-tree-view.c b/src/gnome-utils/gnc-tree-view.c index 1966566b41d..d6ff651fe0d 100644 --- a/src/gnome-utils/gnc-tree-view.c +++ b/src/gnome-utils/gnc-tree-view.c @@ -44,6 +44,7 @@ #include "gnc-gobject-utils.h" #include "gnc-cell-renderer-date.h" #include "gnc-state.h" +#include "dialog-utils.h" /* The actual state key for a particular column visibility. This is * attached to the menu items that are in the column selection menu. @@ -266,6 +267,9 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass) gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ()); + /* Create the last column which contains the column selection * widget. gnc_tree_view_add_text_column will do most of the * work. */ diff --git a/src/gnome/assistant-loan.c b/src/gnome/assistant-loan.c index c45b88ba9df..668c2fc96a3 100644 --- a/src/gnome/assistant-loan.c +++ b/src/gnome/assistant-loan.c @@ -1822,6 +1822,9 @@ loan_rev_prep( GtkAssistant *assistant, gpointer user_data ) gtk_tree_view_new_with_model( GTK_TREE_MODEL(store) )); g_object_unref(store); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(ldd->revView), gnc_tree_view_get_grid_lines_pref ()); + renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Date"), renderer, "text", LOAN_COL_DATE, diff --git a/src/gnome/assistant-stock-split.c b/src/gnome/assistant-stock-split.c index 5185b3a89fb..b583805aae7 100644 --- a/src/gnome/assistant-stock-split.c +++ b/src/gnome/assistant-stock-split.c @@ -564,6 +564,9 @@ gnc_stock_split_assistant_create (StockSplitInfo *info) view = GTK_TREE_VIEW(info->account_view); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ()); + store = gtk_list_store_new(NUM_SPLIT_COLS, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model(view, GTK_TREE_MODEL(store)); diff --git a/src/gnome/dialog-find-account.c b/src/gnome/dialog-find-account.c index 1e3217a6ef5..f247e66dbb0 100644 --- a/src/gnome/dialog-find-account.c +++ b/src/gnome/dialog-find-account.c @@ -301,6 +301,9 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(facc_dialog->view), TRUE); #endif + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(facc_dialog->view), gnc_tree_view_get_grid_lines_pref ()); + /* default to 'close' button */ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE); diff --git a/src/gnome/dialog-imap-editor.c b/src/gnome/dialog-imap-editor.c index 57ac250f0b2..b1236c1f358 100644 --- a/src/gnome/dialog-imap-editor.c +++ b/src/gnome/dialog-imap-editor.c @@ -691,6 +691,10 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog) #if !GTK_CHECK_VERSION(3, 14, 0) gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(imap_dialog->view), TRUE); #endif + + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(imap_dialog->view), gnc_tree_view_get_grid_lines_pref ()); + /* default to 'close' button */ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE); diff --git a/src/gnome/dialog-lot-viewer.c b/src/gnome/dialog-lot-viewer.c index a4ebcbe4fb9..da85377a5d2 100644 --- a/src/gnome/dialog-lot-viewer.c +++ b/src/gnome/dialog-lot-viewer.c @@ -1017,6 +1017,15 @@ lv_create (GNCLotViewer *lv) lv->remove_split_from_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "remove_split_from_lot_button")); lv_init_split_buttons(lv); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(lv->lot_view), gnc_tree_view_get_grid_lines_pref ()); + + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(lv->split_in_lot_view), gnc_tree_view_get_grid_lines_pref ()); + + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(lv->split_free_view), gnc_tree_view_get_grid_lines_pref ()); + if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c index a10c275dddc..52025bd8dc6 100644 --- a/src/gnome/dialog-sx-editor.c +++ b/src/gnome/dialog-sx-editor.c @@ -1774,6 +1774,9 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ list = GTK_TREE_VIEW(gtk_builder_get_object (builder, "sx_list")); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(list), gnc_tree_view_get_grid_lines_pref ()); + data = (acct_deletion_handler_data*)g_new0(acct_deletion_handler_data, 1); data->dialog = dialog; data->affected_sxes = affected_sxes; diff --git a/src/gnome/dialog-sx-editor2.c b/src/gnome/dialog-sx-editor2.c index 1a47a25b4bc..18e1f87adab 100644 --- a/src/gnome/dialog-sx-editor2.c +++ b/src/gnome/dialog-sx-editor2.c @@ -1722,6 +1722,9 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user list = GTK_TREE_VIEW (gtk_builder_get_object (builder, "sx_list")); + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(list), gnc_tree_view_get_grid_lines_pref ()); + data = (acct_deletion_handler_data*)g_new0 (acct_deletion_handler_data, 1); data->dialog = dialog; data->affected_sxes = affected_sxes; diff --git a/src/gnome/dialog-sx-since-last-run.c b/src/gnome/dialog-sx-since-last-run.c index 6d85d4d1f1d..5795ed78a49 100644 --- a/src/gnome/dialog-sx-since-last-run.c +++ b/src/gnome/dialog-sx-since-last-run.c @@ -1029,6 +1029,9 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr gtk_tree_view_expand_all(dialog->instance_view); } + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(dialog->instance_view), gnc_tree_view_get_grid_lines_pref ()); + 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); diff --git a/src/gnome/dialog-trans-assoc.c b/src/gnome/dialog-trans-assoc.c index ffb38db2475..dc087a9c371 100644 --- a/src/gnome/dialog-trans-assoc.c +++ b/src/gnome/dialog-trans-assoc.c @@ -438,6 +438,10 @@ gnc_assoc_dialog_create (AssocDialog *assoc_dialog) #if !GTK_CHECK_VERSION(3, 14, 0) gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(assoc_dialog->view), TRUE); #endif + + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(assoc_dialog->view), gnc_tree_view_get_grid_lines_pref ()); + /* default to 'close' button */ gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE); diff --git a/src/gnome/gnc-budget-view.c b/src/gnome/gnc-budget-view.c index 01548f1d20a..0952ba7a0bd 100644 --- a/src/gnome/gnc-budget-view.c +++ b/src/gnome/gnc-budget-view.c @@ -399,6 +399,9 @@ gbv_create_widget(GncBudgetView *view) totals_tree_view = GTK_TREE_VIEW(gtk_tree_view_new()); priv->totals_tree_view = totals_tree_view; + // Set grid lines option to preference + gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(totals_tree_view), gnc_tree_view_get_grid_lines_pref ()); + gtk_widget_show(GTK_WIDGET(totals_tree_view)); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(totals_tree_view), GTK_SELECTION_NONE);