[epiphany/wip/exalm/elementary-reader] location-entry: Use better reader mode icon on elementary
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/elementary-reader] location-entry: Use better reader mode icon on elementary
- Date: Mon, 25 Nov 2019 18:30:44 +0000 (UTC)
commit 1f5660ab34eec510d908b7eadf2cea0e3b6929cf
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Nov 6 13:52:22 2019 +0500
location-entry: Use better reader mode icon on elementary
Use view-reader-symbolic if available, fall back to
ephy-reader-mode-symbolic otherwise.
lib/widgets/ephy-location-entry.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index b5d1c0579..3eed89af4 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -900,6 +900,23 @@ position_func (DzlSuggestionEntry *self,
area->width -= margin.left + margin.right;
}
+static void
+update_reader_icon (EphyLocationEntry *entry)
+{
+ GtkIconTheme *theme;
+ const gchar *name;
+
+ theme = gtk_icon_theme_get_default ();
+
+ if (gtk_icon_theme_has_icon (theme, "view-reader-symbolic"))
+ name = "view-reader-symbolic";
+ else
+ name = "ephy-reader-mode-symbolic";
+
+ gtk_image_set_from_icon_name (GTK_IMAGE (entry->reader_mode),
+ name, GTK_ICON_SIZE_MENU);
+}
+
static void
ephy_location_entry_construct_contents (EphyLocationEntry *entry)
{
@@ -968,7 +985,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
/* Reader Mode */
entry->reader_mode_event_box = gtk_event_box_new ();
gtk_widget_set_tooltip_text (entry->reader_mode_event_box, _("Toggle reader mode"));
- entry->reader_mode = gtk_image_new_from_icon_name ("ephy-reader-mode-symbolic", GTK_ICON_SIZE_MENU);
+ entry->reader_mode = gtk_image_new ();
gtk_widget_set_valign (entry->reader_mode, GTK_ALIGN_CENTER);
gtk_widget_show (entry->reader_mode);
gtk_container_add (GTK_CONTAINER (entry->reader_mode_event_box), entry->reader_mode);
@@ -977,6 +994,10 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
context = gtk_widget_get_style_context (entry->reader_mode);
gtk_style_context_add_class (context, "entry_icon");
+ update_reader_icon (entry);
+ g_signal_connect_object (gtk_settings_get_default (), "notify::gtk-icon-theme-name",
+ G_CALLBACK (update_reader_icon), entry, G_CONNECT_SWAPPED);
+
g_object_connect (entry->url_entry,
"signal::icon-press", G_CALLBACK (icon_button_icon_press_event_cb), entry,
"signal::populate-popup", G_CALLBACK (entry_populate_popup_cb), entry,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]