mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change CSS class and names used for Business
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:
parent
95c2e5b556
commit
08beb7c5a7
@ -66,8 +66,8 @@ gcoi_create_dialog(Split* split)
|
||||
dco->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "choose_owner_dialog"));
|
||||
g_assert(dco->dialog);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(dco->dialog), "GncChooseOwnerDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(dco->dialog), "gnc-id-owner");
|
||||
|
||||
/* Get the title widget and set the title */
|
||||
widget = GTK_WIDGET(gtk_builder_get_object (builder, "title_label"));
|
||||
|
@ -577,8 +577,9 @@ gnc_customer_new_window (GtkWindow *parent, QofBook *bookp, GncCustomer *cust)
|
||||
cw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "customer_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(cw->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(cw->dialog), "GncCustomerDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(cw->dialog), "gnc-id-customer");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(cw->dialog), "gnc-class-customers");
|
||||
|
||||
g_object_set_data (G_OBJECT (cw->dialog), "dialog_info", cw);
|
||||
|
||||
|
@ -140,8 +140,8 @@ gnc_dialog_date_close_parented (GtkWidget *parent, const char *message,
|
||||
gnc_builder_add_from_file (builder, "dialog-date-close.glade", "date_close_dialog");
|
||||
ddc->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "date_close_dialog"));
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ddc->dialog), "GncDateCloseDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ddc->dialog), "gnc-id-date-close");
|
||||
|
||||
date_box = GTK_WIDGET(gtk_builder_get_object (builder, "date_box"));
|
||||
ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
|
||||
@ -234,8 +234,8 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
|
||||
ddc->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "date_account_dialog"));
|
||||
ddc->memo_entry = GTK_WIDGET(gtk_builder_get_object (builder, "memo_entry"));
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ddc->dialog), "GncDateCloseDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ddc->dialog), "gnc-id-date-close");
|
||||
|
||||
acct_box = GTK_WIDGET(gtk_builder_get_object (builder, "acct_hbox"));
|
||||
ddc->acct_combo = gnc_account_sel_new();
|
||||
@ -353,8 +353,8 @@ gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
|
||||
gnc_builder_add_from_file (builder, "dialog-date-close.glade", "date_account_dialog");
|
||||
ddc->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "date_account_dialog"));
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ddc->dialog), "GncDateCloseDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ddc->dialog), "gnc-id-date-close");
|
||||
|
||||
acct_box = GTK_WIDGET(gtk_builder_get_object (builder, "acct_hbox"));
|
||||
ddc->acct_combo = gnc_account_sel_new();
|
||||
|
@ -415,8 +415,9 @@ gnc_employee_new_window (GtkWindow *parent,
|
||||
ew->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "employee_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(ew->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ew->dialog), "GncEmployeeDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ew->dialog), "gnc-id-employee");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(ew->dialog), "gnc-class-employees");
|
||||
|
||||
g_object_set_data (G_OBJECT (ew->dialog), "dialog_info", ew);
|
||||
|
||||
|
@ -257,14 +257,29 @@ iw_ask_unpost (InvoiceWindow *iw)
|
||||
GtkToggleButton *toggle;
|
||||
GtkBuilder *builder;
|
||||
gint response;
|
||||
const gchar *style_label = NULL;
|
||||
GncOwnerType owner_type = gncOwnerGetType (&iw->owner);
|
||||
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gnc_builder_add_from_file (builder, "dialog-invoice.glade", "unpost_message_dialog");
|
||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "unpost_message_dialog"));
|
||||
toggle = GTK_TOGGLE_BUTTON(gtk_builder_get_object (builder, "yes_tt_reset"));
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncInvoiceDialog");
|
||||
switch (owner_type)
|
||||
{
|
||||
case GNC_OWNER_VENDOR:
|
||||
style_label = "gnc-class-vendors";
|
||||
break;
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
style_label = "gnc-class-employees";
|
||||
break;
|
||||
default:
|
||||
style_label = "gnc-class-customers";
|
||||
break;
|
||||
}
|
||||
// Set a secondary style context for this page so it can be easily manipulated with css
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), style_label);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW(dialog),
|
||||
GTK_WINDOW(iw_get_window(iw)));
|
||||
@ -1261,6 +1276,7 @@ gnc_invoice_window_create_summary_bar (InvoiceWindow *iw)
|
||||
|
||||
summarybar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
gtk_box_set_homogeneous (GTK_BOX (summarybar), FALSE);
|
||||
gtk_widget_set_name (summarybar, "gnc-id-summarybar");
|
||||
|
||||
iw->total_label = add_summary_label (summarybar, _("Total:"));
|
||||
|
||||
@ -2306,6 +2322,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
GncEntryLedgerType ledger_type;
|
||||
const gchar *prefs_group = NULL;
|
||||
gboolean is_credit_note = FALSE;
|
||||
const gchar *style_label = NULL;
|
||||
|
||||
invoice = gncInvoiceLookup (iw->book, &iw->invoice_guid);
|
||||
is_credit_note = gncInvoiceGetIsCreditNote (invoice);
|
||||
@ -2318,9 +2335,6 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
gnc_builder_add_from_file (builder, "dialog-invoice.glade", "invoice_entry_vbox");
|
||||
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "invoice_entry_vbox"));
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncInvoiceDialog");
|
||||
|
||||
/* Autoconnect all the signals */
|
||||
gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, iw);
|
||||
|
||||
@ -2339,7 +2353,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
iw->job_box = GTK_WIDGET (gtk_builder_get_object (builder, "page_job_hbox"));
|
||||
iw->paid_label = GTK_WIDGET (gtk_builder_get_object (builder, "paid_label"));
|
||||
|
||||
// Set the style context for this label so it can be easily manipulated with css
|
||||
// Add a style context for this label so it can be easily manipulated with css
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(iw->paid_label), "gnc-class-highlight");
|
||||
|
||||
/* grab the project widgets */
|
||||
@ -2442,19 +2456,25 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
|
||||
}
|
||||
/* Default labels are for invoices, change them if they are anything else. */
|
||||
switch (owner_type)
|
||||
{
|
||||
{
|
||||
case GNC_OWNER_VENDOR:
|
||||
gtk_label_set_text (GTK_LABEL(iw->info_label), _("Bill Information"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->type_label), _("Bill"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->id_label), _("Bill ID"));
|
||||
style_label = "gnc-class-vendors";
|
||||
break;
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
gtk_label_set_text (GTK_LABEL(iw->info_label), _("Voucher Information"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->type_label), _("Voucher"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->id_label), _("Voucher ID"));
|
||||
default:
|
||||
style_label = "gnc-class-employees";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
style_label = "gnc-class-customers";
|
||||
break;
|
||||
}
|
||||
// Set a secondary style context for this page so it can be easily manipulated with css
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), style_label);
|
||||
|
||||
entry_ledger = gnc_entry_ledger_new (iw->book, ledger_type);
|
||||
|
||||
@ -2526,6 +2546,7 @@ gnc_invoice_window_new_invoice (GtkWindow *parent, InvoiceDialogType dialog_type
|
||||
const GncOwner *start_owner;
|
||||
GncBillTerm *owner_terms = NULL;
|
||||
GncOwnerType owner_type;
|
||||
const gchar *style_label = NULL;
|
||||
|
||||
g_assert (dialog_type == NEW_INVOICE || dialog_type == MOD_INVOICE || dialog_type == DUP_INVOICE);
|
||||
|
||||
@ -2604,8 +2625,8 @@ gnc_invoice_window_new_invoice (GtkWindow *parent, InvoiceDialogType dialog_type
|
||||
iw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "new_invoice_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(iw->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(iw->dialog), "GncInvoiceDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(iw->dialog), "gnc-id-invoice");
|
||||
|
||||
g_object_set_data (G_OBJECT (iw->dialog), "dialog_info", iw);
|
||||
|
||||
@ -2628,16 +2649,21 @@ gnc_invoice_window_new_invoice (GtkWindow *parent, InvoiceDialogType dialog_type
|
||||
gtk_label_set_text (GTK_LABEL(iw->type_label), _("Bill"));
|
||||
gtk_button_set_label (GTK_BUTTON(invoice_radio), _("Bill"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->id_label), _("Bill ID"));
|
||||
|
||||
style_label = "gnc-class-vendors";
|
||||
break;
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
gtk_label_set_text (GTK_LABEL(iw->info_label), _("Voucher Information"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->type_label), _("Voucher"));
|
||||
gtk_button_set_label (GTK_BUTTON(invoice_radio), _("Voucher"));
|
||||
gtk_label_set_text (GTK_LABEL(iw->id_label), _("Voucher ID"));
|
||||
style_label = "gnc-class-employees";
|
||||
break;
|
||||
default:
|
||||
style_label = "gnc-class-customers";
|
||||
break;
|
||||
}
|
||||
// Set a secondary style context for this page so it can be easily manipulated with css
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(iw->dialog), style_label);
|
||||
|
||||
/* configure the type related widgets based on dialog type and invoice type */
|
||||
switch (dialog_type)
|
||||
|
@ -342,8 +342,9 @@ gnc_job_new_window (GtkWindow *parent, QofBook *bookp, GncOwner *owner, GncJob *
|
||||
jw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "job_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(jw->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(jw->dialog), "GncJobDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(jw->dialog), "gnc-id-job");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(jw->dialog), "gnc-class-jobs");
|
||||
|
||||
/* Get entry points */
|
||||
jw->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "id_entry"));
|
||||
|
@ -590,8 +590,9 @@ gnc_order_new_window (GtkWindow *parent, QofBook *bookp, OrderDialogType type,
|
||||
ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "order_entry_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ow->dialog), "gnc-id-order");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(ow->dialog), "gnc-class-orders");
|
||||
|
||||
/* Grab the widgets */
|
||||
ow->id_entry = GTK_WIDGET(gtk_builder_get_object (builder, "id_entry"));
|
||||
@ -704,8 +705,9 @@ gnc_order_window_new_order (GtkWindow *parent, QofBook *bookp, GncOwner *owner)
|
||||
ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_order_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(ow->dialog), "gnc-id-new-order");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(ow->dialog), "gnc-class-orders");
|
||||
|
||||
g_object_set_data (G_OBJECT (ow->dialog), "dialog_info", ow);
|
||||
|
||||
|
@ -725,6 +725,39 @@ gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
|
||||
gnc_payment_dialog_owner_changed(pw);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_payment_update_style_classes (PaymentWindow *pw)
|
||||
{
|
||||
GtkStyleContext *stylectxt = gtk_widget_get_style_context (GTK_WIDGET(pw->dialog));
|
||||
const gchar *style_label = NULL;
|
||||
|
||||
if (gtk_style_context_has_class (stylectxt, "gnc-class-customers"))
|
||||
gtk_style_context_remove_class (stylectxt, "gnc-class-customers");
|
||||
|
||||
if (gtk_style_context_has_class (stylectxt, "gnc-class-vendors"))
|
||||
gtk_style_context_remove_class (stylectxt, "gnc-class-vendors");
|
||||
|
||||
if (gtk_style_context_has_class (stylectxt, "gnc-class-employees"))
|
||||
gtk_style_context_remove_class (stylectxt, "gnc-class-employees");
|
||||
|
||||
switch (pw->owner_type)
|
||||
{
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
style_label = "gnc-class-customers";
|
||||
break;
|
||||
case GNC_OWNER_VENDOR:
|
||||
style_label = "gnc-class-vendors";
|
||||
break;
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
style_label = "gnc-class-employees";
|
||||
break;
|
||||
default:
|
||||
style_label = "gnc-class-unknown";
|
||||
break;
|
||||
}
|
||||
// Set a secondary style context for this page so it can be easily manipulated with css
|
||||
gtk_style_context_add_class (stylectxt, style_label);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_payment_set_owner_type (PaymentWindow *pw, GncOwnerType owner_type)
|
||||
@ -757,6 +790,7 @@ gnc_payment_set_owner_type (PaymentWindow *pw, GncOwnerType owner_type)
|
||||
}
|
||||
valid = gtk_tree_model_iter_next (store, &iter);
|
||||
}
|
||||
gnc_payment_update_style_classes (pw);
|
||||
|
||||
gnc_payment_dialog_owner_type_changed (pw);
|
||||
}
|
||||
@ -1188,8 +1222,8 @@ new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_inf
|
||||
pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(pw->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(pw->dialog), "GncPaymentDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(pw->dialog), "gnc-id-payment");
|
||||
|
||||
/* Grab the widgets and build the dialog */
|
||||
pw->payment_warning = GTK_WIDGET (gtk_builder_get_object (builder, "payment_warning"));
|
||||
|
@ -443,8 +443,9 @@ gnc_vendor_new_window (GtkWindow *parent, QofBook *bookp, GncVendor *vendor)
|
||||
vw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "vendor_dialog"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW(vw->dialog), parent);
|
||||
|
||||
// Set the style context for this dialog so it can be easily manipulated with css
|
||||
gnc_widget_set_style_context (GTK_WIDGET(vw->dialog), "GncVendorDialog");
|
||||
// Set the name for this dialog so it can be easily manipulated with css
|
||||
gtk_widget_set_name (GTK_WIDGET(vw->dialog), "gnc-id-vendor");
|
||||
gnc_widget_style_context_add_class (GTK_WIDGET(vw->dialog), "gnc-class-vendors");
|
||||
|
||||
/* Get entry points */
|
||||
vw->id_entry = GTK_WIDGET (gtk_builder_get_object (builder, "id_entry"));
|
||||
|
Loading…
Reference in New Issue
Block a user