[evince] toolbar: Provide hint when find is unavailable
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] toolbar: Provide hint when find is unavailable
- Date: Fri, 13 Jul 2018 04:19:57 +0000 (UTC)
commit 9ead605ab67c81c1847361bf9ffefce6fd32b792
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Fri Jul 13 00:03:49 2018 -0400
toolbar: Provide hint when find is unavailable
When document type does not support 'find', Evince disables the
find feature. To provide a hint why 'find' is disabled, we state
the reason in the tooltip.
Fixes #105
shell/ev-toolbar.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index b0c2b3c8..a9b7dbec 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -84,7 +84,8 @@ ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
gtk_button_set_label (button, NULL);
gtk_button_set_focus_on_click (button, FALSE);
- gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
+ if (tooltip)
+ gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
}
static GtkWidget *
@@ -177,6 +178,19 @@ ev_toolbar_sidebar_current_page_changed (EvSidebar *ev_sidebar,
g_free (icon_name);
}
+static void
+ev_toolbar_find_button_sensitive_changed (GtkWidget *find_button,
+ GParamSpec *pspec,
+ EvToolbar *ev_toolbar)
+{
+ if (gtk_widget_is_sensitive (find_button))
+ gtk_widget_set_tooltip_text (find_button,
+ _("Find a word or phrase in the document"));
+ else
+ gtk_widget_set_tooltip_text (find_button,
+ _("Search not available for this document"));
+}
+
static void
ev_toolbar_constructed (GObject *object)
{
@@ -244,9 +258,13 @@ ev_toolbar_constructed (GObject *object)
/* Find */
button = ev_toolbar_create_toggle_button (ev_toolbar, "win.toggle-find", "edit-find-symbolic",
- _("Find a word or phrase in the document"));
+ NULL);
ev_toolbar->priv->find_button = button;
gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), button);
+ g_signal_connect (button,
+ "notify::sensitive",
+ G_CALLBACK (ev_toolbar_find_button_sensitive_changed),
+ ev_toolbar);
g_object_unref (builder);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]