Add css style context to various widgets so they can easily be changed

With the use of css, there is the ability to change the appearance of
the widgets to the users preference.
This commit is contained in:
Robert Fewell 2017-07-02 09:57:53 +01:00
parent 443f92eed1
commit aef9530996
30 changed files with 92 additions and 0 deletions

View File

@ -1157,6 +1157,9 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
gtk_window_set_title(GTK_WINDOW(sw->dialog), title);
g_object_set_data (G_OBJECT (sw->dialog), "dialog-info", sw);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(sw->dialog), "GncSearchDialog");
/* Grab the result hbox */
sw->result_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "result_hbox"));

View File

@ -545,6 +545,9 @@ ap_assistant_create (AcctPeriodInfo *info)
window = GTK_WIDGET(gtk_builder_get_object (builder, "account_period_assistant"));
info->window = window;
// Set the style context for this assistant so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncAssistAccountPeriod");
/* Enable all pages except menu page. */
gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
GTK_WIDGET(gtk_builder_get_object(builder, "start_page")),

View File

@ -1201,6 +1201,9 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "hierarchy_assistant"));
data->dialog = dialog;
// Set the style context for this assistant so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncAssistAccountHierarchy");
/* If we have a callback, make this window stay on top */
if (when_completed != NULL)
gtk_window_set_keep_above (GTK_WINDOW(data->dialog), TRUE);

View File

@ -464,6 +464,9 @@ gnc_loan_assistant_create( LoanAssistantData *ldd )
window = GTK_WIDGET(gtk_builder_get_object (builder, "loan_mortgage_assistant"));
ldd->window = window;
// Set the style context for this assistant so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncAssistLoan");
/* Enable buttons on complete pages. */
gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
GTK_WIDGET(gtk_builder_get_object(builder, "loan_intro_page")),

View File

@ -538,6 +538,9 @@ gnc_stock_split_assistant_create (StockSplitInfo *info)
window = GTK_WIDGET(gtk_builder_get_object (builder, "stock_split_assistant"));
info->window = window;
// Set the style context for this assistant so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncAssistStockSplit");
/* Enable buttons on first, second, fourth and last page. */
gtk_assistant_set_page_complete (GTK_ASSISTANT (window),
GTK_WIDGET(gtk_builder_get_object(builder, "intro_page_label")),

View File

@ -323,6 +323,9 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
cd->book = qof_session_get_book(cd->session);
cd->show_currencies = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(cd->dialog), "GncCommoditiesDialog");
gtk_builder_connect_signals(builder, cd);
/* parent */

View File

@ -572,6 +572,9 @@ gnc_ui_fincalc_dialog_create(void)
fcd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "financial_calculator_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(fcd->dialog), "GncFinCalcDialog");
gnc_register_gui_component (DIALOG_FINCALC_CM_CLASS,
NULL, close_handler, fcd);

View File

@ -270,6 +270,9 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "find_account_dialog"));
facc_dialog->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncFindAccountDialog");
facc_dialog->session = gnc_get_current_session();
/* parent */

View File

@ -35,6 +35,7 @@
#include "gnc-main-window.h"
#include "gnc-plugin-page-register.h"
#include "search-param.h"
#include "dialog-utils.h"
#define GNC_PREFS_GROUP_SEARCH "dialogs.find"
@ -225,6 +226,9 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
NULL, do_find_cb, NULL,
ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ftd->sw), "GncFindTransDialog");
if (!ftd->sw)
{
free_ftd_cb (ftd);

View File

@ -35,6 +35,7 @@
#include "gnc-main-window.h"
#include "gnc-plugin-page-register2.h"
#include "search-param.h"
#include "dialog-utils.h"
#define GNC_PREFS_GROUP_SEARCH "dialogs.find"
@ -226,6 +227,9 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
NULL, do_find_cb, NULL,
ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ftd->sw), "GncFindTransDialog");
if (!ftd->sw)
{
free_ftd_cb (ftd);

View File

@ -651,6 +651,9 @@ gnc_imap_dialog_create (GtkWidget *parent, ImapDialog *imap_dialog)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "import_map_dialog"));
imap_dialog->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncImapDialog");
imap_dialog->session = gnc_get_current_session();
imap_dialog->type = BAYES;

View File

@ -991,6 +991,9 @@ lv_create (GNCLotViewer *lv)
lv->window = GTK_WIDGET(gtk_builder_get_object (builder, "lot_viewer_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(lv->window), "GncLotViewerDialog");
win_title = g_strdup_printf (_("Lots in Account %s"),
xaccAccountGetName(lv->account));
gtk_window_set_title (GTK_WINDOW (lv->window), win_title);

View File

@ -86,6 +86,9 @@ gnc_ui_new_user_dialog (void)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncNewUserDialog");
new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));
tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));

View File

@ -430,6 +430,9 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "prices_dialog"));
pdb_dialog->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPriceEditDialog");
pdb_dialog->session = gnc_get_current_session();
pdb_dialog->book = qof_session_get_book(pdb_dialog->session);
pdb_dialog->price_db = gnc_pricedb_get_db(pdb_dialog->book);

View File

@ -1649,6 +1649,9 @@ gnc_ui_print_check_dialog_create(GtkWidget *parent,
pcd->builder = builder;
pcd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "print_check_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(pcd->dialog), "GncPrintCheckDialog");
/* now pick out the relevant child widgets */
pcd->format_combobox = GTK_WIDGET(gtk_builder_get_object (builder, "check_format_combobox"));
pcd->position_combobox = GTK_WIDGET(gtk_builder_get_object (builder, "check_position_combobox"));

View File

@ -207,6 +207,9 @@ gnc_progress_dialog_create(GtkWidget * parent, GNCProgressDialog *progress)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "progress_dialog"));
progress->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncProgressDialog");
/* parent */
if (parent != NULL)
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));

View File

@ -1195,6 +1195,9 @@ gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx,
sxed->endCountSpin = GTK_ENTRY(gtk_builder_get_object (builder, "end_spin"));
sxed->endRemainSpin = GTK_ENTRY(gtk_builder_get_object (builder, "remain_spin"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog");
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box"));

View File

@ -1165,6 +1165,9 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx,
sxed->endCountSpin = GTK_ENTRY (gtk_builder_get_object (builder, "end_spin"));
sxed->endRemainSpin = GTK_ENTRY (gtk_builder_get_object (builder, "remain_spin"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog");
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box"));

View File

@ -769,6 +769,9 @@ gnc_sx_create_from_trans( Transaction *trans )
gnc_builder_add_from_file (builder , "dialog-sx.glade", "sx_from_real_trans_dialog");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "sx_from_real_trans_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncSxFromTransDialog");
sxfti->builder = builder;
sxfti->dialog = dialog;
sxfti->trans = trans;

View File

@ -971,6 +971,9 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr
dialog->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "since_last_run_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog->dialog), "GncSxSinceLastRunDialog");
dialog->editing_model = gnc_sx_slr_tree_model_adapter_new(sx_instances);
dialog->review_created_txns_toggle = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "review_txn_toggle"));

View File

@ -1280,6 +1280,9 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "tax_information_dialog"));
ti_dialog->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncTaxInfoDialog");
initialize_getters ();
g_signal_connect (G_OBJECT (dialog), "response",

View File

@ -392,6 +392,9 @@ gnc_assoc_dialog_create (AssocDialog *assoc_dialog)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_association_dialog"));
assoc_dialog->dialog = dialog;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncTransAssocDialog");
assoc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
path_head = GTK_WIDGET(gtk_builder_get_object (builder, "path-head"));

View File

@ -332,6 +332,9 @@ gbv_create_widget(GncBudgetView *view)
gtk_widget_show(GTK_WIDGET(vbox));
gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(vbox), "GncBudgetPage");
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC,

View File

@ -636,6 +636,9 @@ gnc_plugin_page_account_tree_create_widget (GncPluginPage *plugin_page)
gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
gtk_widget_show (priv->widget);
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncAccountPage");
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

View File

@ -1085,6 +1085,9 @@ gnc_plugin_page_register_create_widget (GncPluginPage *plugin_page)
gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
gtk_widget_show (priv->widget);
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
numRows = priv->lines_default;
numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);

View File

@ -1095,6 +1095,9 @@ gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
gtk_box_set_homogeneous (GTK_BOX (priv->widget), FALSE);
gtk_widget_show (priv->widget);
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncRegisterPage");
numRows = priv->lines_default;
numRows = MIN (numRows, DEFAULT_LINES_AMOUNT);

View File

@ -371,6 +371,9 @@ gnc_plugin_page_sx_list_create_widget (GncPluginPage *plugin_page)
priv->widget = widget;
gtk_widget_show (priv->widget);
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(priv->widget), "GncSxPage");
/* Add vbox and label */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);

View File

@ -314,6 +314,9 @@ autoClearWindow (GtkWidget *parent, Account *account)
gtk_window_set_title(GTK_WINDOW(data->window), title);
g_free (title);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(data->window), "GncAutoClearDialog");
/* Add amount edit box */
data->end_value = GNC_AMOUNT_EDIT(gnc_amount_edit_new());
g_signal_connect(GTK_WIDGET(data->end_value), "activate",

View File

@ -732,6 +732,9 @@ startRecnWindow(GtkWidget *parent, Account *account,
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "reconcile_start_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncReconcileDialog");
title = gnc_recn_make_window_name (account);
gtk_window_set_title(GTK_WINDOW(dialog), title);
g_free (title);

View File

@ -695,6 +695,9 @@ startRecnWindow (GtkWidget *parent, Account *account,
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "reconcile_start_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncReconcileDialog");
title = gnc_recn_make_window_name (account);
gtk_window_set_title (GTK_WINDOW (dialog), title);
g_free (title);