Skip to content

Commit

Permalink
Add grid line preference to various tree views
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Bob-IT committed Jul 2, 2017
1 parent 4cd13a0 commit 632764e
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/business/business-gnome/dialog-payment.c
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/gnome-utils/gnc-query-view.c
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/gnome-utils/gnc-tree-view.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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. */
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/assistant-loan.c
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/assistant-stock-split.c
Expand Up @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/dialog-find-account.c
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions src/gnome/dialog-imap-editor.c
Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions src/gnome/dialog-lot-viewer.c
Expand Up @@ -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))
{
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/dialog-sx-editor.c
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/dialog-sx-editor2.c
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/gnome/dialog-sx-since-last-run.c
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions src/gnome/dialog-trans-assoc.c
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/gnome/gnc-budget-view.c
Expand Up @@ -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);
Expand Down

0 comments on commit 632764e

Please sign in to comment.