mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Change how the widgets are named for CSS
Changed the names of the register parts and added to the class_init function gtk_widget_class_set_css_name for use with Gtk+ 3.20 and also a procedure to use gtk_style_context_add_class for earlier versions of Gtk+
This commit is contained in:
parent
64d4ec3fd1
commit
386309d8c8
@ -601,8 +601,8 @@ gnc_header_init (GncHeader *header)
|
|||||||
header->width = 400;
|
header->width = 400;
|
||||||
header->style = NULL;
|
header->style = NULL;
|
||||||
|
|
||||||
// Set the style context for this widget so it can be easily manipulated with css
|
// This sets a style class for when Gtk+ version is less than 3.20
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(header)), "GncRegisterHeader");
|
gnc_widget_set_css_name (GTK_WIDGET(header), "header");
|
||||||
|
|
||||||
gtk_widget_add_events(GTK_WIDGET(header), (GDK_EXPOSURE_MASK
|
gtk_widget_add_events(GTK_WIDGET(header), (GDK_EXPOSURE_MASK
|
||||||
| GDK_BUTTON_PRESS_MASK
|
| GDK_BUTTON_PRESS_MASK
|
||||||
@ -622,6 +622,10 @@ gnc_header_class_init (GncHeaderClass *header_class)
|
|||||||
GObjectClass *object_class = G_OBJECT_CLASS (header_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (header_class);
|
||||||
GtkWidgetClass *item_class = GTK_WIDGET_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), "header");
|
||||||
|
#endif
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (header_class);
|
parent_class = g_type_class_peek_parent (header_class);
|
||||||
|
|
||||||
object_class->finalize = gnc_header_finalize;
|
object_class->finalize = gnc_header_finalize;
|
||||||
|
@ -454,6 +454,10 @@ gnc_item_edit_class_init (GncItemEditClass *gnc_item_edit_class)
|
|||||||
GObjectClass *object_class;
|
GObjectClass *object_class;
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(3,20,0)
|
||||||
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(gnc_item_edit_class), "cursor");
|
||||||
|
#endif
|
||||||
|
|
||||||
gnc_item_edit_parent_class = g_type_class_peek_parent (gnc_item_edit_class);
|
gnc_item_edit_parent_class = g_type_class_peek_parent (gnc_item_edit_class);
|
||||||
|
|
||||||
object_class = G_OBJECT_CLASS (gnc_item_edit_class);
|
object_class = G_OBJECT_CLASS (gnc_item_edit_class);
|
||||||
@ -522,8 +526,8 @@ gnc_item_edit_new (GnucashSheet *sheet)
|
|||||||
NULL);
|
NULL);
|
||||||
gtk_layout_put (GTK_LAYOUT(sheet), GTK_WIDGET(item_edit), 0, 0);
|
gtk_layout_put (GTK_LAYOUT(sheet), GTK_WIDGET(item_edit), 0, 0);
|
||||||
|
|
||||||
// Set the style context for this widget so it can be easily manipulated with css
|
// This sets a style class for when Gtk+ version is less than 3.20
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(item_edit)), "GncRegisterItemEdit");
|
gnc_widget_set_css_name (GTK_WIDGET(item_edit), "cursor");
|
||||||
|
|
||||||
/* Create the text entry */
|
/* Create the text entry */
|
||||||
item_edit->editor = gtk_entry_new();
|
item_edit->editor = gtk_entry_new();
|
||||||
|
@ -300,6 +300,10 @@ gnucash_register_class_init (GnucashRegisterClass *klass)
|
|||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(3,20,0)
|
||||||
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "register");
|
||||||
|
#endif
|
||||||
|
|
||||||
register_parent_class = g_type_class_peek_parent (klass);
|
register_parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
register_signals[ACTIVATE_CURSOR] =
|
register_signals[ACTIVATE_CURSOR] =
|
||||||
@ -346,8 +350,8 @@ gnucash_register_init (GnucashRegister *g_reg)
|
|||||||
gtk_widget_set_can_focus (GTK_WIDGET(table), FALSE);
|
gtk_widget_set_can_focus (GTK_WIDGET(table), FALSE);
|
||||||
gtk_widget_set_can_default (GTK_WIDGET(table), FALSE);
|
gtk_widget_set_can_default (GTK_WIDGET(table), FALSE);
|
||||||
|
|
||||||
// Set the style context for this widget so it can be easily manipulated with css
|
// This sets a style class for when Gtk+ version is less than 3.20
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(g_reg)), "GncRegister");
|
gnc_widget_set_css_name (GTK_WIDGET(g_reg), "register");
|
||||||
|
|
||||||
gtk_grid_set_row_homogeneous (GTK_GRID(table), FALSE);
|
gtk_grid_set_row_homogeneous (GTK_GRID(table), FALSE);
|
||||||
gtk_grid_set_column_homogeneous (GTK_GRID(table), FALSE);
|
gtk_grid_set_column_homogeneous (GTK_GRID(table), FALSE);
|
||||||
|
@ -722,3 +722,12 @@ gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr)
|
|||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_widget_set_css_name (GtkWidget *widget, const char *name)
|
||||||
|
{
|
||||||
|
#if !GTK_CHECK_VERSION(3,20,0)
|
||||||
|
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_add_class (context, name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -2477,6 +2477,10 @@ gnucash_sheet_class_init (GnucashSheetClass *klass)
|
|||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
widget_class = GTK_WIDGET_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), "sheet");
|
||||||
|
#endif
|
||||||
|
|
||||||
sheet_parent_class = g_type_class_peek_parent (klass);
|
sheet_parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
/* Method override */
|
/* Method override */
|
||||||
@ -2503,8 +2507,8 @@ gnucash_sheet_init (GnucashSheet *sheet)
|
|||||||
gtk_widget_set_can_focus (GTK_WIDGET(sheet), TRUE);
|
gtk_widget_set_can_focus (GTK_WIDGET(sheet), TRUE);
|
||||||
gtk_widget_set_can_default (GTK_WIDGET(sheet), TRUE);
|
gtk_widget_set_can_default (GTK_WIDGET(sheet), TRUE);
|
||||||
|
|
||||||
// Set the style context for this widget so it can be easily manipulated with css
|
// This sets a style class for when Gtk+ version is less than 3.20
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET(sheet)), "GncRegisterSheet");
|
gnc_widget_set_css_name (GTK_WIDGET(sheet), "sheet");
|
||||||
|
|
||||||
sheet->num_visible_blocks = 1;
|
sheet->num_visible_blocks = 1;
|
||||||
sheet->num_visible_phys_rows = 1;
|
sheet->num_visible_phys_rows = 1;
|
||||||
|
@ -138,6 +138,7 @@ gboolean gnucash_sheet_draw_internal (GnucashSheet *sheet, cairo_t *cr,
|
|||||||
GtkAllocation *alloc);
|
GtkAllocation *alloc);
|
||||||
void gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr);
|
void gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr);
|
||||||
|
|
||||||
|
void gnc_widget_set_css_name (GtkWidget *widget, const char *name);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user