[gnumeric] GUI: Theme pseudo tooltips.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Theme pseudo tooltips.
- Date: Thu, 28 Mar 2013 01:45:28 +0000 (UTC)
commit bcacd108a49bef5964172c4106e3d973670c9b7e
Author: Morten Welinder <terra gnome org>
Date: Wed Mar 27 21:45:08 2013 -0400
GUI: Theme pseudo tooltips.
src/dialogs/dialog-formula-guru.c | 5 -----
src/gnumeric.css | 27 +++++++++++++--------------
src/gui-util.c | 12 ++++--------
src/gui-util.h | 3 +--
src/wbc-gtk.c | 6 ++----
5 files changed, 20 insertions(+), 33 deletions(-)
---
diff --git a/src/dialogs/dialog-formula-guru.c b/src/dialogs/dialog-formula-guru.c
index 4d54f1c..47b80c5 100644
--- a/src/dialogs/dialog-formula-guru.c
+++ b/src/dialogs/dialog-formula-guru.c
@@ -832,9 +832,6 @@ cb_dialog_formula_guru_query_tooltip (G_GNUC_UNUSED GtkWidget *widget,
state->tooltip_label = gnumeric_create_tooltip_widget ();
state->tooltip_widget
= gtk_widget_get_toplevel (state->tooltip_label);
-#warning GTK3: are these two lines useful? gnumeric_create_tooltip_widget_should do it
- gnumeric_tooltip_set_style (state->tooltip_label);
- gnumeric_tooltip_set_style (state->tooltip_widget);
gtk_widget_show_all (state->tooltip_widget);
g_object_ref (state->tooltip_widget);
g_object_ref (state->tooltip_label);
@@ -842,8 +839,6 @@ cb_dialog_formula_guru_query_tooltip (G_GNUC_UNUSED GtkWidget *widget,
gtk_tooltip_set_custom (tooltip, state->tooltip_widget);
window = gtk_widget_get_toplevel (state->tooltip_widget);
/* Applying to window */
- gnumeric_tooltip_set_style (window);
- gtk_widget_set_name (window, "gnumeric-tooltip");
gtk_widget_set_app_paintable (window, FALSE);
parent = gtk_widget_get_parent (state->tooltip_widget);
diff --git a/src/gnumeric.css b/src/gnumeric.css
index 09808ef..552144d 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -13,9 +13,12 @@ GnmPane {
/* ------------------------------------------------------------------------- */
/* The GnmItemGrid is the canvas area that holds all the cells. */
/* GnmPreviewGrid is the canvas used for auto-format previews. */
-GnmItemGrid, GnmPreviewGrid {
- /* The background must be solid and rectangular since we cheat and print
- only parts of it. */
+GnmItemGrid,
+GnmPreviewGrid,
+GocCanvas.full-sheet,
+GtkBin.auto-expr {
+ /* GnmItemGrid requires that the background be solid and rectangular
+ since we cheat and print only parts of it. */
background-image: none;
background-color: white;
padding: 0;
@@ -122,17 +125,6 @@ GtkDrawingArea.button.all {
}
/* ------------------------------------------------------------------------- */
-/* This is for full-sheet sheet object, presumably graphs. */
-
-GocCanvas.full-sheet {
- background-image: none;
- background-color: white;
- padding: 0;
- border-style: none;
- border-width: 0;
-}
-
-/* ------------------------------------------------------------------------- */
/* GnmNotebook is a fake notebook holding just the sheet tabs area */
@@ -152,3 +144,10 @@ GtkHandleBox {
}
/* ------------------------------------------------------------------------- */
+/* When we stuff a GtkTextView into a tooltip, we need to prevent it from
+ having its own background. Ideally the theme would handle this. */
+.tooltip GtkTextView {
+ background-color: transparent;
+}
+
+/* ------------------------------------------------------------------------- */
diff --git a/src/gui-util.c b/src/gui-util.c
index 799e2b3..469af39 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -485,14 +485,11 @@ gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event)
: gtk_get_current_event_time());
}
-void
+static void
gnumeric_tooltip_set_style (GtkWidget *widget)
{
- int i;
- for (i = 0; i < 5 ; i++) {
- gtk_widget_override_color (widget, i, &gs_black);
- gtk_widget_override_background_color (widget, i, &gs_yellow);
- }
+ gtk_style_context_add_class (gtk_widget_get_style_context (widget),
+ GTK_STYLE_CLASS_TOOLTIP);
}
/**
@@ -551,14 +548,13 @@ gnumeric_convert_to_tooltip (GtkWidget *ref_widget, GtkWidget *widget)
gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
gtk_window_set_gravity (GTK_WINDOW (tip), GDK_GRAVITY_NORTH_WEST);
gtk_window_set_screen (GTK_WINDOW (tip), gtk_widget_get_screen (ref_widget));
- gtk_widget_set_name (tip, "gnumeric-tooltip");
frame = gtk_widget_get_toplevel (widget);
gtk_container_add (GTK_CONTAINER (tip), frame);
+ gnumeric_tooltip_set_style (frame);
gnumeric_tooltip_set_style (tip);
- gnumeric_tooltip_set_style (widget);
return widget;
}
diff --git a/src/gui-util.h b/src/gui-util.h
index df10f4e..326b4b5 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -36,7 +36,7 @@ int gnm_gui_group_value (gpointer gui, char const * const group[]);
void gnumeric_popup_menu (GtkMenu *menu, GdkEventButton *event);
/*
- * Pseudo-tool-tip support code.
+ * Pseudo-tooltip support code.
*/
void gnumeric_position_tooltip (GtkWidget *tip, int px, int py,
gboolean horizontal);
@@ -45,7 +45,6 @@ GtkWidget *gnumeric_create_tooltip_text_view_widget (void);
GtkWidget *gnumeric_create_tooltip (GtkWidget *ref_widget);
GtkWidget *gnumeric_convert_to_tooltip (GtkWidget *ref_widget,
GtkWidget *widget);
-void gnumeric_tooltip_set_style (GtkWidget *widget);
GtkBuilder *gnm_gtk_builder_load (char const *uifile, char const *domain,
GOCmdContext *cc);
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 9ef71c5..8364a59 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -4678,7 +4678,6 @@ static void
wbc_gtk_create_status_area (WBCGtk *wbcg)
{
GtkWidget *ebox;
- GdkRGBA const white = {1.,1.,1.,1.};
g_object_ref (wbcg->auto_expr_label);
gtk_label_set_max_width_chars (GTK_LABEL (wbcg->auto_expr_label),
@@ -4695,9 +4694,8 @@ wbc_gtk_create_status_area (WBCGtk *wbcg)
gtk_style_context_get_font (gtk_widget_get_style_context (wbcg->status_text),
GTK_STATE_FLAG_NORMAL),
"W") * 5, -1);
ebox = GET_GUI_ITEM ("auto_expr_event_box");
- gtk_widget_override_background_color (GTK_WIDGET (ebox),
- GTK_STATE_FLAG_NORMAL,
- &white);
+ gtk_style_context_add_class (gtk_widget_get_style_context (ebox),
+ "auto-expr");
g_signal_connect (G_OBJECT (ebox),
"button_press_event",
G_CALLBACK (cb_select_auto_expr), wbcg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]