[gnumeric] GUI: Style links in the function selector too.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Style links in the function selector too.
- Date: Thu, 25 Apr 2013 00:22:47 +0000 (UTC)
commit e7a619ca4e110642e4d6ea5d1ffbd409d91ab087
Author: Morten Welinder <terra gnome org>
Date: Wed Apr 24 20:22:27 2013 -0400
GUI: Style links in the function selector too.
src/dialogs/ChangeLog | 5 ++++
src/dialogs/dialog-function-select.c | 36 ++++++++++++++++++++++++---------
src/gnumeric.css | 9 ++++++-
3 files changed, 38 insertions(+), 12 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 3c0042c..f3699a0 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-24 Morten Welinder <terra gnome org>
+
+ * dialog-function-select.c (dialog_function_select_init): Style
+ links.
+
2013-04-22 Morten Welinder <terra gnome org>
* dialog-recent.c (cb_response): Destroy dialog before reading.
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index 7122987..69b7058 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -565,7 +565,7 @@ dialog_function_select_cat_row_separator (GtkTreeModel *model,
/*************************************************************************/
static GtkTextTag *
-make_link (GtkTextBuffer *description, const char *name,
+make_link (GtkTextBuffer *description, GtkWidget *target, const char *name,
GCallback cb, gpointer user)
{
GtkTextTag *link =
@@ -573,12 +573,21 @@ make_link (GtkTextBuffer *description, const char *name,
(gtk_text_buffer_get_tag_table (description), name);
if (!link) {
+ GdkColor *link_color = NULL;
+ char *link_color_text;
+
+ gtk_widget_style_get (target, "link-color", &link_color, NULL);
+ link_color_text = gdk_color_to_string (link_color);
+ gdk_color_free (link_color);
+
link = gtk_text_buffer_create_tag
(description, name,
"underline", PANGO_UNDERLINE_SINGLE,
- "foreground", "#0000ff",
+ "foreground", link_color_text,
NULL);
+ g_free (link_color_text);
+
if (cb)
g_signal_connect (link, "event", cb, user);
}
@@ -694,7 +703,9 @@ make_expr_example (Sheet *sheet, const char *text, gboolean localized)
}
static void
-describe_new_style (GtkTextBuffer *description, GnmFunc const *func, Sheet *sheet)
+describe_new_style (GtkTextBuffer *description,
+ GtkWidget *target,
+ GnmFunc const *func, Sheet *sheet)
{
GnmFuncHelp const *help;
GtkTextIter ti;
@@ -784,7 +795,8 @@ describe_new_style (GtkTextBuffer *description, GnmFunc const *func, Sheet *shee
const char *text = help->text; /* Not translated */
const char *pre = _("See also: ");
GtkTextTag *link =
- make_link (description, "LINK", NULL, NULL);
+ make_link (description, target, "LINK",
+ NULL, NULL);
FINISH_ARGS;
ADD_TEXT ("\n");
@@ -824,9 +836,8 @@ describe_new_style (GtkTextBuffer *description, GnmFunc const *func, Sheet *shee
tagname = g_strdup_printf ("EXTLINK-%s", func->name);
link = make_link
- (description, tagname,
- G_CALLBACK (cb_link_event),
- NULL);
+ (description, target, tagname,
+ G_CALLBACK (cb_link_event), NULL);
g_object_set_data_full (G_OBJECT (link),
"uri", uri,
@@ -1014,7 +1025,7 @@ cb_dialog_function_select_fun_selection_changed (GtkTreeSelection *selection,
GtkTextMark *mark;
gboolean active = FALSE;
- description = gtk_text_view_get_buffer (state->description_view);
+ description = gtk_text_view_get_buffer (state->description_view);
mark = gtk_text_buffer_get_mark (description, "start-mark");
gtk_text_view_scroll_to_mark (state->description_view, mark,
@@ -1031,7 +1042,9 @@ cb_dialog_function_select_fun_selection_changed (GtkTreeSelection *selection,
if (func->help == NULL)
gtk_text_buffer_set_text (description, "?", -1);
else
- describe_new_style (description, func, state->sheet);
+ describe_new_style (description,
+ GTK_WIDGET (state->description_view),
+ func, state->sheet);
active = TRUE;
}
gtk_widget_set_sensitive (state->ok_button, active);
@@ -1223,7 +1236,7 @@ dialog_function_select_init (FunctionSelectState *state)
gtk_tree_model_filter_set_visible_column
(GTK_TREE_MODEL_FILTER (state->model_filter), FUNCTION_VISIBLE);
- state->treeview= GTK_TREE_VIEW
+ state->treeview = GTK_TREE_VIEW
(go_gtk_builder_get_widget (state->gui, "function-list"));
gtk_tree_view_set_model (state->treeview,
state->model_filter);
@@ -1295,6 +1308,9 @@ dialog_function_select_init (FunctionSelectState *state)
state->description_view = GTK_TEXT_VIEW (go_gtk_builder_get_widget
(state->gui, "description"));
+ gtk_style_context_add_class
+ (gtk_widget_get_style_context (GTK_WIDGET (state->description_view)),
+ "function-help");
description = gtk_text_view_get_buffer (state->description_view);
gtk_text_buffer_get_start_iter (description, &where);
gtk_text_buffer_create_mark (description, "start-mark", &where, TRUE);
diff --git a/src/gnumeric.css b/src/gnumeric.css
index 33cbc66..f332696 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -208,8 +208,13 @@ GnmNotebookButton:active {
/* ------------------------------------------------------------------------- */
/* Functions' arguments link-like appearance in pseudo-tooltips. */
-GtkTextView.function-help {
- -GtkWidget-link-color: red;
+GtkTextView.pseudo-tooltip.function-help {
+ -GtkWidget-link-color: #4040ff;
+}
+
+/* Ditto in the function selector. */
+GtkDialog GtkTextView.function-help {
+ -GtkWidget-link-color: #4040ff;
}
/* ------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]