[epiphany] Use elementary-style headerbar icons in Pantheon
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use elementary-style headerbar icons in Pantheon
- Date: Mon, 22 Apr 2019 16:58:52 +0000 (UTC)
commit 9766e060e6369fc4a81a6dbae890f1c9b5cb925b
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sun Apr 21 19:47:14 2019 +0200
Use elementary-style headerbar icons in Pantheon
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/67
src/ephy-action-bar-end.c | 8 +++++++-
src/ephy-action-bar-start.c | 32 +++++++++++++++++++++++++++-----
src/ephy-desktop-utils.c | 34 ++++++++++++++++++++++++++++++++++
src/ephy-desktop-utils.h | 29 +++++++++++++++++++++++++++++
src/ephy-header-bar.c | 20 ++++++++------------
src/ephy-shell.c | 1 +
src/meson.build | 1 +
7 files changed, 107 insertions(+), 18 deletions(-)
---
diff --git a/src/ephy-action-bar-end.c b/src/ephy-action-bar-end.c
index 6ddff1cb3..497b83c40 100644
--- a/src/ephy-action-bar-end.c
+++ b/src/ephy-action-bar-end.c
@@ -20,7 +20,7 @@
*/
#include "ephy-action-bar-end.h"
-
+#include "ephy-desktop-utils.h"
#include "ephy-downloads-popover.h"
#include "ephy-downloads-progress-icon.h"
#include "ephy-shell.h"
@@ -256,6 +256,12 @@ ephy_action_bar_end_init (EphyActionBarEnd *action_bar_end)
gtk_menu_button_set_popover (GTK_MENU_BUTTON (action_bar_end->downloads_button),
action_bar_end->downloads_popover);
}
+ if (is_desktop_pantheon ()) {
+ gtk_button_set_image (GTK_BUTTON (action_bar_end->bookmarks_button),
+ gtk_image_new_from_icon_name ("user-bookmarks",
+ GTK_ICON_SIZE_LARGE_TOOLBAR));
+ }
+
g_signal_connect_object (downloads_manager, "download-added",
G_CALLBACK (download_added_cb),
object, 0);
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index 231e5cfb6..cadb7d15c 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -21,6 +21,7 @@
#include "ephy-action-bar-start.h"
+#include "ephy-desktop-utils.h"
#include "ephy-embed.h"
#include "ephy-embed-container.h"
#include "ephy-embed-prefs.h"
@@ -467,6 +468,15 @@ ephy_action_bar_start_dispose (GObject *object)
G_OBJECT_CLASS (ephy_action_bar_start_parent_class)->dispose (object);
}
+static GtkIconSize
+get_icon_size (void)
+{
+ if (is_desktop_pantheon ())
+ return GTK_ICON_SIZE_LARGE_TOOLBAR;
+
+ return GTK_ICON_SIZE_BUTTON;
+}
+
static void
ephy_action_bar_start_constructed (GObject *object)
{
@@ -514,6 +524,18 @@ ephy_action_bar_start_constructed (GObject *object)
g_signal_connect (action_bar_start->new_tab_button, "button-release-event",
G_CALLBACK (new_tab_button_release_event_cb), action_bar_start);
+
+ if (is_desktop_pantheon ()) {
+ gtk_button_set_image (GTK_BUTTON (action_bar_start->navigation_back),
+ gtk_image_new_from_icon_name ("go-previous-symbolic",
+ get_icon_size ()));
+ gtk_button_set_image (GTK_BUTTON (action_bar_start->navigation_forward),
+ gtk_image_new_from_icon_name ("go-next-symbolic",
+ get_icon_size ()));
+ gtk_button_set_image (GTK_BUTTON (action_bar_start->homepage_button),
+ gtk_image_new_from_icon_name ("go-home-symbolic",
+ get_icon_size ()));
+ }
}
static void
@@ -574,16 +596,16 @@ ephy_action_bar_start_change_combined_stop_reload_state (EphyActionBarStart *act
gboolean loading)
{
if (loading) {
- gtk_image_set_from_icon_name (GTK_IMAGE (action_bar_start->combined_stop_reload_image),
+ gtk_image_set_from_icon_name (GTK_IMAGE (action_bar_start->combined_stop_reload_image),
"process-stop-symbolic",
- GTK_ICON_SIZE_BUTTON);
+ get_icon_size());
/* Translators: tooltip for the stop button */
gtk_widget_set_tooltip_text (action_bar_start->combined_stop_reload_button,
_("Stop loading the current page"));
} else {
- gtk_image_set_from_icon_name (GTK_IMAGE (action_bar_start->combined_stop_reload_image),
- "view-refresh-symbolic",
- GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (action_bar_start->combined_stop_reload_image),
+ "view-refresh-symbolic",
+ get_icon_size());
gtk_widget_set_tooltip_text (action_bar_start->combined_stop_reload_button,
_(REFRESH_BUTTON_TOOLTIP));
}
diff --git a/src/ephy-desktop-utils.c b/src/ephy-desktop-utils.c
new file mode 100644
index 000000000..3b48d7bdb
--- /dev/null
+++ b/src/ephy-desktop-utils.c
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Copyright © 2019 Jan-Michael Brummer <jan brummer tabos org>
+ *
+ * This file is part of Epiphany.
+ *
+ * Epiphany is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Epiphany is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Epiphany. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "ephy-desktop-utils.h"
+
+gboolean
+is_desktop_pantheon (void)
+{
+ const gchar *xdg_current_desktop = g_environ_getenv (g_get_environ (), "XDG_CURRENT_DESKTOP");
+
+ if (!xdg_current_desktop)
+ return FALSE;
+
+ return strstr (xdg_current_desktop, "Pantheon") != NULL;
+}
+
diff --git a/src/ephy-desktop-utils.h b/src/ephy-desktop-utils.h
new file mode 100644
index 000000000..a2bbd031c
--- /dev/null
+++ b/src/ephy-desktop-utils.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Copyright © 2019 Jan-Michael Brummer <jan brummer tabos org>
+ *
+ * This file is part of Epiphany.
+ *
+ * Epiphany is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Epiphany is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Epiphany. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean is_desktop_pantheon (void);
+
+G_END_DECLS
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index 1df3a72df..4bad15b5b 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -24,6 +24,7 @@
#include "ephy-header-bar.h"
#include "ephy-add-bookmark-popover.h"
+#include "ephy-desktop-utils.h"
#include "ephy-embed-utils.h"
#include "ephy-flatpak-utils.h"
#include "ephy-location-entry.h"
@@ -135,17 +136,6 @@ update_revealer_visibility (GtkRevealer *revealer)
gtk_revealer_get_child_revealed (revealer));
}
-static gboolean
-is_desktop_pantheon (void)
-{
- const gchar *xdg_current_desktop = g_environ_getenv (g_get_environ (), "XDG_CURRENT_DESKTOP");
-
- if (!xdg_current_desktop)
- return FALSE;
-
- return strstr (xdg_current_desktop, "Pantheon") != NULL;
-}
-
static void
ephy_header_bar_constructed (GObject *object)
{
@@ -237,9 +227,15 @@ ephy_header_bar_constructed (GObject *object)
gtk_widget_destroy (GTK_WIDGET (gtk_builder_get_object (builder, "help-button")));
}
- if (is_desktop_pantheon ())
+ if (is_desktop_pantheon ()) {
gtk_widget_destroy (GTK_WIDGET (gtk_builder_get_object (builder, "about-button")));
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_icon_name ("open-menu",
+ GTK_ICON_SIZE_LARGE_TOOLBAR));
+
+ }
+
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), page_menu_popover);
g_object_unref (builder);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 8aeeff469..2917371e8 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -1209,3 +1209,4 @@ ephy_shell_open_uris (EphyShell *shell,
shell->open_uris_idle_ids = g_slist_prepend (shell->open_uris_idle_ids, GUINT_TO_POINTER (id));
}
+
diff --git a/src/meson.build b/src/meson.build
index f4dc9a88f..e463a5008 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -25,6 +25,7 @@ libephymain_sources = [
'ephy-action-bar-end.c',
'ephy-action-bar-start.c',
'ephy-action-helper.c',
+ 'ephy-desktop-utils.c',
'ephy-encoding-dialog.c',
'ephy-encoding-row.c',
'ephy-header-bar.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]