Remove some Gtk version checks for CSS

With the requirement for Gtk+ 3.22, the version checks dealing with CSS
can be removed and the application CSS files dealing with version 3.10
can be removed with the remaining being renamed.
This commit is contained in:
Robert Fewell 2020-05-01 11:46:49 +01:00
parent fbf7171ab6
commit 065002190a
11 changed files with 14 additions and 152 deletions

View File

@ -38,35 +38,25 @@ scrollbar slider {
}
/* Register sheet font setting, use .gnc-class-sheet < gtk3.20 */
/* Register sheet font setting */
gnc-id-sheet {
font: 10px arial, sans-serif;
}
/* Register header font setting, use .gnc-class-header < gtk3.20 */
/* Register header font setting */
gnc-id-header {
background-color: pink;
color:blue;
}
/* Register cursor font setting, use .gnc-class-cursor < gtk3.20 */
/* Register cursor font setting */
gnc-id-cursor {
background-color: #BDB76B;
color: white;
}
xgnc-id-cursor entry {
background-color: pink;
margin: 2px 5px 2px 5px;
padding: 0px 2px 0px 2px;
/* border-color: green;
color: white; */
}
gnc-id-cursor button {
border-width: 1px;
border-color: green;

View File

@ -222,9 +222,7 @@ gnc_dense_cal_class_init(GncDenseCalClass *klass)
object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "calendar");
#endif
parent_class = g_type_class_peek_parent (klass);

View File

@ -198,12 +198,8 @@ gnc_add_css_file (void)
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_app), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider_user), GTK_STYLE_PROVIDER_PRIORITY_USER);
#if GTK_CHECK_VERSION(3,20,0)
gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-320.css");
#else
gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash-310.css");
#endif
gtk_css_provider_load_from_resource (provider_fallback, "/org/gnucash/gnucash-fallback-310.css");
gtk_css_provider_load_from_resource (provider_app, "/org/gnucash/gnucash.css");
gtk_css_provider_load_from_resource (provider_fallback, "/org/gnucash/gnucash-fallback.css");
var = gnc_userconfig_dir ();
if (var)

View File

@ -1,87 +0,0 @@
/* Note: Widgets obtained from Glade files will not be addressable
unless they have been named or have style classes added. Only
the widget type can be configured unless they are named in code */
/* Negative value label colors */
.gnc-class-default-color {
color: @default-color;
}
.gnc-class-negative-numbers {
color: @negative-numbers;
}
/* Register Cursor settings, top, right, bottom, left */
.gnc-class-cursor .entry {
margin: 2px 5px 2px 5px; /* this only works by doing it in code, yellow area */
padding: 2px 2px 2px 2px; /* all work with different values, around the text blue area */
}
.gnc-class-cursor .button {
margin: 1px 1px 1px 1px; /* does not work, not used, here for completeness */
}
/* Register defaults */
@define-color register_header_bg_color #96B183;
@define-color register_primary_bg_color #BFDEB9;
@define-color register_secondary_bg_color #F6FFDA;
@define-color register_split_bg_color #EDE7D3;
@define-color register_cursor_bg_color #FFEF98;
@define-color register_fg_color black;
*.gnc-class-register-foreground {
color: @register_fg_color;
}
*.gnc-class-register-header {
background-color: @register_header_bg_color;
}
*.gnc-class-register-primary {
background-color: @register_primary_bg_color;
}
*.gnc-class-register-primary:insensitive {
background-color: mix (@register_primary_bg_color, grey, 0.2);
}
*.gnc-class-register-secondary {
background-color: @register_secondary_bg_color;
}
*.gnc-class-register-secondary:insensitive {
background-color: mix (@register_secondary_bg_color, grey, 0.2);
}
*.gnc-class-register-split {
background-color: @register_split_bg_color;
}
*.gnc-class-register-split:insensitive {
background-color: mix (@register_split_bg_color, grey, 0.2);
}
*.gnc-class-register-cursor {
background-color: @register_cursor_bg_color;
}
*.gnc-class-register-cursor:insensitive {
background-color: mix (@register_cursor_bg_color, grey, 0.2);
}
/* Change font color by mixing with grey */
.gnc-class-lighter-grey-mix {
color: mix (currentColor, grey, 0.8);
}
.gnc-class-darker-grey-mix {
color: mix (currentColor, grey, 0.2);
}
/* Some tweaks for the about dialog */
dialog#GnuCash > box > box > label
{
font-size: 24px;
}

View File

@ -2,8 +2,7 @@
<gresources>
<gresource prefix="/org/gnucash">
<file>gnucash-310.css</file>
<file>gnucash-320.css</file>
<file>gnucash-fallback-310.css</file>
<file>gnucash.css</file>
<file>gnucash-fallback.css</file>
</gresource>
</gresources>

View File

@ -79,6 +79,11 @@ gnc-id-cursor button {
color: mix (currentColor, grey, 0.2);
}
/* Highlight some text */
.gnc-class-highlight {
color: blue;
}
/* Some tweaks for the about dialog */
dialog#GnuCash > box > box > label
{

View File

@ -595,9 +595,6 @@ gnc_header_init (GncHeader *header)
header->width = 400;
header->style = NULL;
// This sets a style class for when Gtk+ version is less than 3.20
gnc_widget_add_style_class (GTK_WIDGET(header), "gnc-class-header");
gtk_widget_add_events(GTK_WIDGET(header), (GDK_EXPOSURE_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
@ -616,9 +613,7 @@ gnc_header_class_init (GncHeaderClass *header_class)
GObjectClass *object_class = G_OBJECT_CLASS (header_class);
GtkWidgetClass *item_class = GTK_WIDGET_CLASS (header_class);
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(header_class), "gnc-id-header");
#endif
parent_class = g_type_class_peek_parent (header_class);

View File

@ -146,9 +146,7 @@ gnc_item_edit_tb_class_init (GncItemEditTbClass *gnc_item_edit_tb_class)
GObjectClass *object_class;
GtkWidgetClass *widget_class;
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_tb_class), "button");
#endif
gnc_item_edit_tb_parent_class = g_type_class_peek_parent (gnc_item_edit_tb_class);
@ -208,9 +206,6 @@ gnc_item_edit_tb_new (GnucashSheet *sheet)
"sheet", sheet,
NULL);
// This sets a style class for when Gtk+ version is less than 3.20
gnc_widget_add_style_class (GTK_WIDGET(item_edit_tb), "button");
context = gtk_widget_get_style_context (GTK_WIDGET(item_edit_tb));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
@ -552,15 +547,12 @@ draw_text_cursor_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
// Now draw a vertical line
cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
cairo_set_line_width (cr, 1.0);
#if GTK_CHECK_VERSION(3,20,0)
cairo_move_to (cr, cursor_x + 0.5, gnc_item_edit_get_margin (item_edit, top) +
gnc_item_edit_get_padding_border (item_edit, top));
cairo_rel_line_to (cr, 0, height - gnc_item_edit_get_margin (item_edit, top_bottom) -
gnc_item_edit_get_padding_border (item_edit, top_bottom));
#else
cairo_move_to (cr, cursor_x + 0.5, gnc_item_edit_get_padding_border (item_edit, top));
cairo_rel_line_to (cr, 0, height - gnc_item_edit_get_padding_border (item_edit, top_bottom));
#endif
cairo_stroke (cr);
return FALSE;
@ -710,9 +702,7 @@ gnc_item_edit_class_init (GncItemEditClass *gnc_item_edit_class)
GObjectClass *object_class;
GtkWidgetClass *widget_class;
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_class), "gnc-id-cursor");
#endif
gnc_item_edit_parent_class = g_type_class_peek_parent (gnc_item_edit_class);
@ -865,9 +855,6 @@ gnc_item_edit_new (GnucashSheet *sheet)
NULL);
gtk_layout_put (GTK_LAYOUT(sheet), GTK_WIDGET(item_edit), 0, 0);
// This sets a style class for when Gtk+ version is less than 3.20
gnc_widget_add_style_class (GTK_WIDGET(item_edit), "gnc-class-cursor");
/* Create the text entry */
item_edit->editor = gtk_entry_new();
sheet->entry = item_edit->editor;
@ -889,17 +876,6 @@ gnc_item_edit_new (GnucashSheet *sheet)
gtk_widget_set_can_focus (GTK_WIDGET(item_edit->editor), FALSE);
gtk_entry_set_has_frame (GTK_ENTRY(item_edit->editor), FALSE);
#if !GTK_CHECK_VERSION(3,20,0)
gtk_widget_set_margin_start (GTK_WIDGET(item_edit->editor),
gnc_item_edit_get_margin (item_edit, left));
gtk_widget_set_margin_end (GTK_WIDGET(item_edit->editor),
gnc_item_edit_get_margin (item_edit, right));
gtk_widget_set_margin_top (GTK_WIDGET(item_edit->editor),
gnc_item_edit_get_margin (item_edit, top));
gtk_widget_set_margin_bottom (GTK_WIDGET(item_edit->editor),
gnc_item_edit_get_margin (item_edit, bottom));
#endif
// Connect to the draw signal so we can draw a cursor
g_signal_connect_after (item_edit->editor, "draw",
G_CALLBACK (draw_text_cursor_cb), item_edit);

View File

@ -338,9 +338,7 @@ gnucash_register_class_init (GnucashRegisterClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "gnc-id-register");
#endif
register_parent_class = g_type_class_peek_parent (klass);
@ -399,9 +397,6 @@ gnucash_register_init (GnucashRegister *g_reg)
gtk_widget_set_can_focus (GTK_WIDGET(table), FALSE);
gtk_widget_set_can_default (GTK_WIDGET(table), FALSE);
// This sets a style class for when Gtk+ version is less than 3.20
gnc_widget_add_style_class (GTK_WIDGET(g_reg), "gnc-class-register");
gtk_grid_set_row_homogeneous (GTK_GRID(table), FALSE);
gtk_grid_set_column_homogeneous (GTK_GRID(table), FALSE);
}

View File

@ -2590,9 +2590,7 @@ gnucash_sheet_class_init (GnucashSheetClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
#if GTK_CHECK_VERSION(3,20,0)
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "gnc-id-sheet");
#endif
sheet_parent_class = g_type_class_peek_parent (klass);
@ -2620,9 +2618,6 @@ gnucash_sheet_init (GnucashSheet *sheet)
gtk_widget_set_can_focus (GTK_WIDGET(sheet), TRUE);
gtk_widget_set_can_default (GTK_WIDGET(sheet), TRUE);
// This sets a style class for when Gtk+ version is less than 3.20
gnc_widget_add_style_class (GTK_WIDGET(sheet), "gnc-class-sheet");
sheet->num_visible_blocks = 1;
sheet->num_visible_phys_rows = 1;