Change CSS class and names used in gnome

Change the CSS classes and widget names to a standard naming for all of
Gnucash. This should make it easier to adjust Gnucash appearance if
required. CSS classes all begin with 'gnc-class-' and widget names
begin with 'gnc-id-'
This commit is contained in:
Robert Fewell 2020-04-05 13:48:23 +01:00
parent ba924d83a7
commit 836026a2d4
20 changed files with 84 additions and 47 deletions

View File

@ -135,8 +135,9 @@ init_notebook_widgets (BillTermNB *notebook, gboolean read_only,
notebook->notebook = GTK_WIDGET(gtk_builder_get_object (builder, "term_notebook"));
parent = GTK_WIDGET(gtk_builder_get_object (builder, "terms_notebook_window"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(notebook->notebook), "GncBillTermsDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(notebook->notebook), "gnc-id-bill-term");
gnc_widget_style_context_add_class (GTK_WIDGET(notebook->notebook), "gnc-class-bill-terms");
/* load the "days" widgets */
notebook->days_due_days = read_widget (builder, "days:due_days", read_only);
@ -435,8 +436,9 @@ new_billterm_dialog (BillTermsWindow *btw, GncBillTerm *term,
nbt->name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "name_entry"));
nbt->desc_entry = GTK_WIDGET(gtk_builder_get_object (builder, dialog_desc));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(nbt->dialog), "GncBillTermsDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(nbt->dialog), "gnc-id-new-bill-terms");
gnc_widget_style_context_add_class (GTK_WIDGET(nbt->dialog), "gnc-class-bill-terms");
if (name)
gtk_entry_set_text (GTK_ENTRY (nbt->name_entry), name);
@ -775,8 +777,9 @@ gnc_ui_billterms_window_new (GtkWindow *parent, QofBook *book)
btw->type_label = GTK_WIDGET(gtk_builder_get_object (builder, "type_label"));
btw->term_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "term_vbox"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(btw->dialog), "GncBillTermsDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(btw->dialog), "gnc-id-bill-terms");
gnc_widget_style_context_add_class (GTK_WIDGET(btw->dialog), "gnc-class-bill-terms");
gtk_window_set_transient_for (GTK_WINDOW (btw->dialog), parent);

View File

@ -321,8 +321,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->window), "GncCommoditiesDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(cd->window), "gnc-id-commodity");
gnc_widget_style_context_add_class (GTK_WIDGET(cd->window), "gnc-class-securities");
/* buttons */
cd->remove_button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));

View File

@ -530,8 +530,8 @@ gnc_ui_custom_report_internal(GncMainWindow * window)
gtk_window_set_transient_for (GTK_WINDOW (crd->dialog), GTK_WINDOW(window));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(crd->dialog), "GncCustomReportDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(crd->dialog), "gnc-id-custom-report");
gnc_restore_window_size (GNC_PREFS_GROUP_REPORT_SAVED_CONFIGS,
GTK_WINDOW(crd->dialog), GTK_WINDOW(window));

View File

@ -581,8 +581,8 @@ gnc_ui_fincalc_dialog_create(GtkWindow *parent)
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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(fcd->dialog), "gnc-id-financial-calc");
/* parent */
if (parent != NULL)

View File

@ -334,8 +334,9 @@ gnc_find_account_dialog_create (GtkWidget *parent, FindAccountDialog *facc_dialo
window = GTK_WIDGET(gtk_builder_get_object (builder, "find_account_window"));
facc_dialog->window = window;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncFindAccountDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-find-account");
gnc_widget_style_context_add_class (GTK_WIDGET(window), "gnc-class-account");
facc_dialog->session = gnc_get_current_session();
facc_dialog->parent = parent;

View File

@ -990,8 +990,8 @@ lv_create (GNCLotViewer *lv, GtkWindow *parent)
gtk_window_set_transient_for (GTK_WINDOW (lv->window), parent);
// 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(lv->window), "gnc-id-lot-viewer");
win_title = g_strdup_printf (_("Lots in Account %s"),
xaccAccountGetName(lv->account));

View File

@ -150,8 +150,8 @@ gnc_ui_new_user_dialog_create (GNCNewUserDialog *new_user)
gtk_window_set_keep_above (GTK_WINDOW(new_user->window), TRUE);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(new_user->window), "GncNewUserDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(new_user->window), "gnc-id-new-user");
new_user->new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
new_user->import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));

View File

@ -705,8 +705,9 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
window = GTK_WIDGET(gtk_builder_get_object (builder, "prices_window"));
pdb_dialog->window = window;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncPriceEditDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-price-edit");
gnc_widget_style_context_add_class (GTK_WIDGET(window), "gnc-class-securities");
pdb_dialog->session = gnc_get_current_session();
pdb_dialog->book = qof_session_get_book(pdb_dialog->session);

View File

@ -1651,8 +1651,8 @@ 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(pcd->dialog), "gnc-id-print-check");
/* now pick out the relevant child widgets */
pcd->format_combobox = GTK_WIDGET(gtk_builder_get_object (builder, "check_format_combobox"));

View File

@ -207,8 +207,8 @@ 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-progress");
/* parent */
if (parent != NULL)

View File

@ -213,8 +213,9 @@ gnc_style_sheet_new (StyleSheetDialog * ssd)
template_combo = GTK_WIDGET(gtk_builder_get_object (builder, "template_combobox"));
name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "name_entry"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dlg), "GncStyleSheetDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dlg), "gnc-id-style-sheet-new");
gnc_widget_style_context_add_class (GTK_WIDGET(dlg), "gnc-class-style-sheets");
g_assert(ssd);
@ -431,8 +432,9 @@ gnc_style_sheet_select_dialog_create(GtkWindow *parent)
gtk_window_set_transient_for (GTK_WINDOW (ss->toplevel), GTK_WINDOW(parent));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ss->toplevel), "GncStyleSheetDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(ss->toplevel), "gnc-id-style-sheet-select");
gnc_widget_style_context_add_class (GTK_WIDGET(ss->toplevel), "gnc-class-style-sheets");
ss->list_view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "style_sheet_list_view"));
ss->list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);

View File

@ -1191,9 +1191,10 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
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");
// Set the name of this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(sxed->dialog), "gnc-id-sx-editor");
gnc_widget_style_context_add_class (GTK_WIDGET(sxed->dialog), "gnc-class-sx");
gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent);
/* Setup the end-date GNC widget */

View File

@ -1162,8 +1162,9 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent,
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");
// Set the name of this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(sxed->dialog), "gnc-id-sx2-editor");
gnc_widget_style_context_add_class (GTK_WIDGET(sxed->dialog), "gnc-class-sx");
gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent);

View File

@ -769,8 +769,9 @@ gnc_sx_create_from_trans( GtkWindow *parent, 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");
// Set the name of this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-sx-from-trans");
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-sx");
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);

View File

@ -973,8 +973,9 @@ gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_insta
dialog->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "since_last_run_dialog"));
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), parent);
// 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");
// Set the name of this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog->dialog), "gnc-id-sx-since-last-run");
gnc_widget_style_context_add_class (GTK_WIDGET(dialog->dialog), "gnc-class-sx");
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

@ -1292,8 +1292,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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-tax-information");
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-taxes");
initialize_getters ();

View File

@ -481,8 +481,8 @@ gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog)
gtk_window_set_title (GTK_WINDOW(assoc_dialog->window), _("Transaction Associations"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncTransAssocDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-transaction-associations");
assoc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview"));
path_head = GTK_WIDGET(gtk_builder_get_object (builder, "path-head"));

View File

@ -313,8 +313,8 @@ 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(data->window), "gnc-id-auto-clear");
/* Add amount edit box */
data->end_value = GNC_AMOUNT_EDIT(gnc_amount_edit_new());

View File

@ -735,8 +735,8 @@ 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-reconcile-start");
title = gnc_recn_make_window_name (account);
gtk_window_set_title(GTK_WINDOW(dialog), title);
@ -1725,6 +1725,9 @@ recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_endi
gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
gtk_container_add(GTK_CONTAINER(recnData->window), vbox);
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(recnData->window), "gnc-id-reconcile");
dock = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous (GTK_BOX (dock), FALSE);
gtk_widget_show(dock);
@ -1811,10 +1814,16 @@ recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_endi
(account, RECLIST_DEBIT, recnData,
&recnData->debit, &recnData->total_debit);
// Add a style context for this widget so it can be easily manipulated with css
gnc_widget_style_context_add_class (GTK_WIDGET(debits_box), "gnc-class-debits");
credits_box = gnc_reconcile_window_create_view_box
(account, RECLIST_CREDIT, recnData,
&recnData->credit, &recnData->total_credit);
// Add a style context for this widget so it can be easily manipulated with css
gnc_widget_style_context_add_class (GTK_WIDGET(credits_box), "gnc-class-credits");
GNC_RECONCILE_VIEW(recnData->debit)->sibling = GNC_RECONCILE_VIEW(recnData->credit);
GNC_RECONCILE_VIEW(recnData->credit)->sibling = GNC_RECONCILE_VIEW(recnData->debit);
@ -1847,6 +1856,9 @@ recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_endi
frame = gtk_frame_new(NULL);
gtk_box_pack_end(GTK_BOX(hbox), frame, FALSE, FALSE, 0);
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(frame), "gnc-id-reconcile-totals");
/* hbox to hold title/value vboxes */
totals_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (totals_hbox), FALSE);

View File

@ -693,8 +693,8 @@ 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");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-reconcile2-start");
title = gnc_recn_make_window_name (account);
gtk_window_set_title (GTK_WINDOW (dialog), title);
@ -1665,6 +1665,9 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE);
gtk_container_add (GTK_CONTAINER(recnData->window), vbox);
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(recnData->window), "gnc-id-reconcile2");
dock = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous (GTK_BOX (dock), FALSE);
gtk_widget_show (dock);
@ -1751,10 +1754,16 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
(account, RECLIST_DEBIT, recnData,
&recnData->debit, &recnData->total_debit);
// Add a style context for this widget so it can be easily manipulated with css
gnc_widget_style_context_add_class (GTK_WIDGET(debits_box), "gnc-class-debits");
credits_box = gnc_reconcile_window_create_view_box
(account, RECLIST_CREDIT, recnData,
&recnData->credit, &recnData->total_credit);
// Add a style context for this widget so it can be easily manipulated with css
gnc_widget_style_context_add_class (GTK_WIDGET(credits_box), "gnc-class-credits");
GNC_RECONCILE_VIEW (recnData->debit)->sibling = GNC_RECONCILE_VIEW (recnData->credit);
GNC_RECONCILE_VIEW (recnData->credit)->sibling = GNC_RECONCILE_VIEW (recnData->debit);
@ -1787,6 +1796,9 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
frame = gtk_frame_new (NULL);
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(frame), "gnc-id-reconcile-totals");
/* hbox to hold title/value vboxes */
totals_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (totals_hbox), FALSE);