[gnumeric] GUI: Simplify style class settings.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Simplify style class settings.
- Date: Tue, 26 Mar 2013 13:04:50 +0000 (UTC)
commit 4dbfeef1dd70c5e5a5dafcce362be2572bedbab3
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 26 09:04:32 2013 -0400
GUI: Simplify style class settings.
src/gnumeric.css | 2 +-
src/item-bar.c | 9 +++++----
src/sheet-control-gui.c | 11 +++++------
3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/gnumeric.css b/src/gnumeric.css
index ba342b3..6509c3c 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -71,7 +71,7 @@ GnmItemBar:hover {
/* ------------------------------------------------------------------------- */
/* This GtkDrawingArea is the select-all button above the row buttons. */
-GtkDrawingArea all-button {
+GtkDrawingArea#all-button {
}
/* ------------------------------------------------------------------------- */
diff --git a/src/item-bar.c b/src/item-bar.c
index e607ca7..c94f0d3 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -120,7 +120,6 @@ ib_reload_style (GnmItemBar *ib)
GList *item_list;
gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
for (ui = 0; ui < G_N_ELEMENTS (selection_type_flags); ui++) {
GtkStateFlags state = selection_type_flags[ui];
PangoFontDescription *desc;
@@ -297,9 +296,7 @@ ib_draw_cell (GnmItemBar const * const ib, cairo_t *cr,
cairo_save (cr);
- /* Style-wise we are a button in the given state. */
gtk_style_context_save (ctxt);
- gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
gtk_style_context_set_state (ctxt, selection_type_flags[type]);
gtk_render_background (ctxt, cr, rect->x, rect->y,
rect->width + 1, rect->height + 1);
@@ -375,7 +372,6 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr,
GtkStyleContext *ctxt = goc_item_get_style_context (item);
gtk_style_context_save (ctxt);
- gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
gtk_style_context_get_color (ctxt, GTK_STATE_FLAG_NORMAL, &color);
goc_canvas_c2w (item->canvas, x_0, y_0, &x0, &y0);
goc_canvas_c2w (item->canvas, x_1, y_1, &x1, &y1);
@@ -1148,6 +1144,11 @@ gnm_item_bar_init (GnmItemBar *ib)
ib->has_resize_guides = FALSE;
ib->pango.item = NULL;
ib->pango.glyphs = pango_glyph_string_new ();
+
+ /* Style-wise we are a button. */
+ gtk_style_context_add_class
+ (goc_item_get_style_context (GOC_ITEM (ib)),
+ GTK_STYLE_CLASS_BUTTON);
}
static void
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index abdce6d..3ddff72 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -613,17 +613,13 @@ cb_select_all_btn_draw (GtkWidget *widget, cairo_t *cr, SheetControlGUI *scg)
GtkAllocation a;
GtkStyleContext *ctxt = gtk_widget_get_style_context (widget);
- gtk_style_context_save (ctxt);
- gtk_style_context_add_class (ctxt, GTK_STYLE_CLASS_BUTTON);
- gtk_style_context_set_state (ctxt, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_add_region (ctxt, "all-button", 0);
-
gtk_widget_get_allocation (widget, &a);
+ gtk_style_context_save (ctxt);
+ gtk_style_context_set_state (ctxt, GTK_STATE_FLAG_NORMAL);
gtk_render_background (ctxt, cr, offset + 1, 1,
a.width - 1, a.height - 1);
gtk_render_frame (ctxt, cr, offset, 0, a.width + 1, a.height + 1);
-
gtk_style_context_restore (ctxt);
}
@@ -1574,6 +1570,9 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
"homogeneous", TRUE,
NULL);
scg->select_all_btn = gtk_drawing_area_new ();
+ gtk_style_context_add_class (gtk_widget_get_style_context (scg->select_all_btn),
+ GTK_STYLE_CLASS_BUTTON);
+ gtk_widget_set_name (scg->select_all_btn, "all-button");
gtk_widget_add_events (scg->select_all_btn, GDK_BUTTON_PRESS_MASK);
g_signal_connect (G_OBJECT (scg->select_all_btn), "draw",
G_CALLBACK (cb_select_all_btn_draw), scg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]