Change CSS class and names used in gnome-utils

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:47:15 +01:00
parent 0546dd545f
commit 56f023347d
33 changed files with 82 additions and 71 deletions

View File

@ -333,8 +333,8 @@ void gnc_ui_close_book (QofBook* book, GtkWindow *parent)
gnc_builder_add_from_file (builder, "dialog-book-close.glade", "close_book_dialog");
cbw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "close_book_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(cbw->dialog), "GncBookCloseDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(cbw->dialog), "gnc-id-book-close");
/* parent */
if (parent != NULL)

View File

@ -266,8 +266,9 @@ gnc_ui_select_commodity_create(const gnc_commodity * orig_sel,
retval->ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ss_ok_button"));
label = GTK_WIDGET(gtk_builder_get_object (builder, "item_label"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(retval->dialog), "GncSecurityDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(retval->dialog), "gnc-id-security-select");
gnc_widget_style_context_add_class (GTK_WIDGET(retval->dialog), "gnc-class-securities");
gnc_cbwe_require_list_item(GTK_COMBO_BOX(retval->namespace_combo));
gnc_cbwe_require_list_item(GTK_COMBO_BOX(retval->commodity_combo));
@ -910,8 +911,9 @@ gnc_ui_build_commodity_dialog(const char * selected_namespace,
retval->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "security_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(retval->dialog), "GncSecurityDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(retval->dialog), "gnc-id-security");
gnc_widget_style_context_add_class (GTK_WIDGET(retval->dialog), "gnc-class-securities");
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW (retval->dialog), GTK_WINDOW (parent));

View File

@ -110,8 +110,9 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "duplicate_transaction_dialog"));
dt_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), "GncDupTransDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-duplicate-transaction");
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-transactions");
/* parent */
if (parent != NULL)

View File

@ -282,8 +282,8 @@ gnc_ui_file_access (GtkWindow *parent, int type)
gtk_window_set_transient_for (GTK_WINDOW (faw->dialog), parent);
g_object_set_data_full( G_OBJECT(faw->dialog), "FileAccessWindow", faw, g_free );
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(faw->dialog), "GncFileAccessDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(faw->dialog), "gnc-id-file-access");
faw->frame_file = GTK_WIDGET(gtk_builder_get_object (builder, "frame_file" ));
faw->frame_database = GTK_WIDGET(gtk_builder_get_object (builder, "frame_database" ));

View File

@ -54,8 +54,8 @@ gnc_ui_object_references_show( const gchar* explanation_text, GList* objlist )
gnc_builder_add_from_file (builder, "dialog-object-references.glade", "object_references_dialog" );
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "object_references_dialog" ));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncObjectRefDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-object-reference");
explanation = GTK_LABEL(gtk_builder_get_object (builder, "lbl_explanation" ));
gtk_label_set_text( explanation, explanation_text );

View File

@ -2227,8 +2227,8 @@ gnc_options_dialog_new_modal(gboolean modal, gchar *title,
retval->window = GTK_WIDGET(gtk_builder_get_object (builder, "gnucash_options_window"));
retval->page_list = GTK_WIDGET(gtk_builder_get_object (builder, "page_list_scroll"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(retval->window), "GncOptionsDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(retval->window), "gnc-id-options");
/* Page List */
{

View File

@ -1254,8 +1254,8 @@ gnc_preferences_dialog_create(GtkWindow *parent)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "gnucash_preferences_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPreferenceDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-preferences");
/* parent */
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent));

View File

@ -193,8 +193,8 @@ gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
g_object_set_data (G_OBJECT (dqv->dialog), "dialog-info", dqv);
gtk_window_set_transient_for(GTK_WINDOW(dqv->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dqv->dialog), "GncQueryViewDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dqv->dialog), "gnc-id-query-view");
/* grab the widgets */
dqv->label = GTK_WIDGET(gtk_builder_get_object (builder, "dialog_label"));

View File

@ -379,8 +379,8 @@ gnc_reset_warnings_dialog (GtkWindow *parent)
gnc_builder_add_from_file (builder, "dialog-reset-warnings.glade", "reset_warnings_dialog");
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "reset_warnings_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncResetWarningsDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-reset-warnings");
gtk_window_set_transient_for(GTK_WINDOW (dialog), parent);

View File

@ -235,8 +235,9 @@ new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
ntt->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_tax_table_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ntt->dialog), "GncTaxTableDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(ntt->dialog), "gnc-id-tax-table");
gnc_widget_style_context_add_class (GTK_WIDGET(ntt->dialog), "gnc-class-taxes");
ntt->name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "name_entry"));
if (name)
@ -813,8 +814,9 @@ gnc_ui_tax_table_window_new (GtkWindow *parent, QofBook *book)
gtk_window_set_transient_for (GTK_WINDOW (ttw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ttw->dialog), "GncTaxTableDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(ttw->dialog), "gnc-id-new-tax-table");
gnc_widget_style_context_add_class (GTK_WIDGET(ttw->dialog), "gnc-class-taxes");
/* Create the tax tables view */
view = GTK_TREE_VIEW(ttw->names_view);

View File

@ -345,8 +345,8 @@ gnc_totd_dialog (GtkWindow *parent, gboolean startup)
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "totd_dialog"));
gtk_window_set_transient_for(GTK_WINDOW (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), "GncTotdDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-tip-of-the-day");
totd_dialog = g_new0 (TotdDialog, 1);
totd_dialog->dialog = dialog;

View File

@ -1879,8 +1879,9 @@ gnc_xfer_dialog_create(GtkWidget *parent, XferDialog *xferData)
xferData->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transfer_dialog"));
g_object_set_data_full (G_OBJECT (xferData->dialog), "builder", builder, g_object_unref);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(xferData->dialog), "GncTransferDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(xferData->dialog), "gnc-id-transfer");
gnc_widget_style_context_add_class (GTK_WIDGET(xferData->dialog), "gnc-class-securities");
/* parent */
if (parent != NULL)

View File

@ -51,8 +51,8 @@ gnc_get_username_password (GtkWidget *parent,
dialog = GTK_WIDGET(gtk_builder_get_object (builder, "username_password_dialog"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncUserPassDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-user-password");
if (parent)
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));

View File

@ -161,8 +161,8 @@ gnc_account_sel_init (GNCAccountSel *gas)
g_object_set(gas, "spacing", 2, (gchar*)NULL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gas), "GncAccountSel");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gas), "gnc-id-account-select");
gas->store = gtk_list_store_new(NUM_ACCT_COLS, G_TYPE_STRING, G_TYPE_POINTER);
widget = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(gas->store));

View File

@ -140,8 +140,8 @@ gnc_amount_edit_init (GNCAmountEdit *gae)
gae->fraction = 0;
gae->evaluate_on_enter = FALSE;
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gae), "GncAmountEdit");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gae), "gnc-id-amount-edit");
g_signal_connect (G_OBJECT (gae), "changed",
G_CALLBACK (gnc_amount_edit_changed), NULL);

View File

@ -98,8 +98,8 @@ static gboolean autosave_confirm(GtkWidget *toplevel)
"%s",
_("Save file automatically?"));
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncAutoSaveDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-auto-save");
gtk_message_dialog_format_secondary_text
(GTK_MESSAGE_DIALOG(dialog),

View File

@ -190,8 +190,8 @@ gnc_combott_init (GncCombott *combott)
gtk_orientable_set_orientation (GTK_ORIENTABLE(combott), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(combott), "GncCombott");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(combott), "gnc-id-combo-tooltip");
priv->active = 0;
priv->text_col = 0;

View File

@ -193,8 +193,8 @@ gnc_currency_edit_class_init (GNCCurrencyEditClass *klass)
static void
gnc_currency_edit_init (GNCCurrencyEdit *gce)
{
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gce), "GncCurrencyEdit");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gce), "gnc-id-currency-edit");
g_signal_connect (gce, "notify::mnemonic",
G_CALLBACK (gnc_currency_edit_mnemonic_changed), gce);

View File

@ -162,8 +162,8 @@ gnc_date_delta_init (GNCDateDelta *gdd)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE(gdd), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gdd), "GncDateDelta");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gdd), "gnc-id-date-delta");
gdd->value_spin = NULL;
gdd->units_combo = NULL;

View File

@ -698,8 +698,8 @@ gnc_date_edit_init (GNCDateEdit *gde)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE(gde), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gde), "GncDateEdit");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gde), "gnc-id-date-edit");
gde->disposed = FALSE;
gde->popup_in_progress = FALSE;

View File

@ -126,8 +126,8 @@ gnc_date_format_init (GNCDateFormat *gdf)
gtk_orientable_set_orientation (GTK_ORIENTABLE(gdf), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gdf), "GncDateFormat");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gdf), "gnc-id-date-format");
/* Open up the Glade and set the signals */
builder = gtk_builder_new();

View File

@ -267,9 +267,10 @@ gnc_dense_cal_init(GncDenseCal *dcal)
gtk_orientable_set_orientation (GTK_ORIENTABLE(dcal), GTK_ORIENTATION_VERTICAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dcal), "calendar");
gnc_widget_style_context_add_class (GTK_WIDGET(dcal), "calendar");
gtk_widget_set_name (GTK_WIDGET(dcal), "dense-cal");
// Set the name of this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(dcal), "gnc-id-dense-calendar");
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CALENDAR);
{
@ -331,7 +332,7 @@ gnc_dense_cal_init(GncDenseCal *dcal)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE);
gtk_widget_set_name (GTK_WIDGET(dcal->transPopup), "dense-cal-popup");
gtk_widget_set_name (GTK_WIDGET(dcal->transPopup), "gnc-id-dense-calendar-popup");
l = gtk_label_new(_("Date: "));
gtk_widget_set_margin_start (l, 5);

View File

@ -231,8 +231,8 @@ gnc_embedded_window_init (GncEmbeddedWindow *window, void *data)
gtk_orientable_set_orientation (GTK_ORIENTABLE(window), GTK_ORIENTATION_VERTICAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncEmbeddedWindow");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-embedded-window");
gnc_embedded_window_setup_window (window);

View File

@ -169,8 +169,8 @@ gnc_file_dialog (GtkWindow *parent,
response = gtk_dialog_run(GTK_DIALOG(file_box));
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(file_box), "GncFileDialog");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(file_box), "gnc-id-file");
if (response == GTK_RESPONSE_ACCEPT)
{

View File

@ -203,8 +203,8 @@ gnc_frequency_init(GncFrequency *gf)
gtk_orientable_set_orientation (GTK_ORIENTABLE(gf), GTK_ORIENTATION_VERTICAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gf), "GncFrequency");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gf), "gnc-id-frequency");
builder = gtk_builder_new();
gnc_builder_add_from_file (builder , "gnc-frequency.glade", "adjustment1");

View File

@ -145,8 +145,8 @@ gnc_general_select_init (GNCGeneralSelect *gsl)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE(gsl), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gsl), "GncGeneralSelect");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gsl), "gnc-id-general-select");
gsl->disposed = FALSE;
gsl->selected_item = NULL;

View File

@ -2570,8 +2570,8 @@ gnc_main_window_init (GncMainWindow *window, void *data)
priv->merged_actions_table =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(window), "GncMainWindow");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-main-window");
priv->event_handler_id =
qof_event_register_handler(gnc_main_window_event_handler, window);
@ -3008,6 +3008,10 @@ gnc_main_window_open_page (GncMainWindow *window,
gtk_widget_show (label);
tab_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
if (g_strcmp0 (gnc_plugin_page_get_plugin_name (page), "GncPluginPageAccountTree") == 0)
gtk_widget_set_name (GTK_WIDGET(tab_hbox), "gnc-id-account-page-tab-box");
gtk_box_set_homogeneous (GTK_BOX (tab_hbox), FALSE);
gtk_widget_show (tab_hbox);

View File

@ -577,8 +577,8 @@ gnc_period_select_init (GncPeriodSelect *period)
gtk_orientable_set_orientation (GTK_ORIENTABLE(period), GTK_ORIENTATION_HORIZONTAL);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(period), "GncPeriodSelect");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(period), "gnc-id-period-select");
priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
priv->start = TRUE;

View File

@ -191,8 +191,8 @@ gnc_query_view_init (GNCQueryView *qview)
{
GNCQueryViewPrivate *priv;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(qview), "GncQueryView");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(qview), "gnc-id-query-view");
qview->query = NULL;

View File

@ -189,8 +189,8 @@ gnc_recurrence_init( GncRecurrence *gr )
recurrenceSet(&gr->recurrence, 1, PERIOD_MONTH, NULL, WEEKEND_ADJ_NONE);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(gr), "GncRecurrence");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(gr), "gnc-id-recurrence");
/* Open up the builder file */
builder = gtk_builder_new();

View File

@ -69,8 +69,8 @@ gnc_show_splash_screen (void)
gtk_window_set_decorated(GTK_WINDOW (splash), FALSE);
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (splash), TRUE);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(splash), "GncSplash");
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(splash), "gnc-id-splash");
g_signal_connect (splash, "destroy",
G_CALLBACK (splash_destroy_cb), NULL);

View File

@ -256,8 +256,8 @@ gnc_tree_view_init (GncTreeView *view, void *data)
priv->sort_column_changed_cb_id = 0;
priv->size_allocate_cb_id = 0;
// Set the style context for this page so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(view), "GncTreeView");
// Set the name for this widget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(view), "gnc-id-tree-view");
/* Handle column drag and drop */
gtk_tree_view_set_column_drag_function (GTK_TREE_VIEW(view),

View File

@ -634,8 +634,8 @@ gnc_main_window_summary_new (void)
retval->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous (GTK_BOX (retval->hbox), FALSE);
// Set the style context for this widget so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(retval->hbox), "summary-bar");
// Set the name for this wodget so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(retval->hbox), "gnc-id-account-summary-bar");
retval->totals_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (retval->datamodel));
g_object_unref (retval->datamodel);