[epiphany] Hide bookmarks star on about pages
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Hide bookmarks star on about pages
- Date: Tue, 1 Nov 2016 02:42:00 +0000 (UTC)
commit be9184e258202edbbb16f53d3480a9e85b315655
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Oct 31 21:41:30 2016 -0500
Hide bookmarks star on about pages
lib/widgets/ephy-location-entry.c | 40 ++++++++++++++++++----------
lib/widgets/ephy-location-entry.h | 10 ++++++-
src/bookmarks/ephy-add-bookmark-popover.c | 7 +++--
src/ephy-window.c | 11 ++++++--
4 files changed, 46 insertions(+), 22 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 02d994d..eb31e80 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -1171,8 +1171,8 @@ ephy_location_entry_activate (EphyLocationEntry *entry)
}
void
-ephy_location_entry_set_bookmarked_status (EphyLocationEntry *entry,
- gboolean is_bookmarked)
+ephy_location_entry_set_bookmark_icon_state (EphyLocationEntry *entry,
+ EphyLocationEntryBookmarkIconState state)
{
GtkStyleContext *context;
@@ -1180,18 +1180,30 @@ ephy_location_entry_set_bookmarked_status (EphyLocationEntry *entry,
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
- if (is_bookmarked) {
- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
- GTK_ENTRY_ICON_SECONDARY,
- "starred-symbolic");
- gtk_style_context_remove_class (context, "non-starred");
- gtk_style_context_add_class (context, "starred");
- } else {
- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
- GTK_ENTRY_ICON_SECONDARY,
- "non-starred-symbolic");
- gtk_style_context_remove_class (context, "starred");
- gtk_style_context_add_class (context, "non-starred");
+ switch (state) {
+ case EPHY_LOCATION_ENTRY_BOOKMARK_ICON_HIDDEN:
+ gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ NULL);
+ gtk_style_context_remove_class (context, "starred");
+ gtk_style_context_remove_class (context, "non-starred");
+ break;
+ case EPHY_LOCATION_ENTRY_BOOKMARK_ICON_EMPTY:
+ gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ "non-starred-symbolic");
+ gtk_style_context_remove_class (context, "starred");
+ gtk_style_context_add_class (context, "non-starred");
+ break;
+ case EPHY_LOCATION_ENTRY_BOOKMARK_ICON_BOOKMARKED:
+ gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ "starred-symbolic");
+ gtk_style_context_remove_class (context, "non-starred");
+ gtk_style_context_add_class (context, "starred");
+ break;
+ default:
+ g_assert_not_reached ();
}
}
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index e30bd0e..490524a 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyLocationEntry, ephy_location_entry, EPHY, LOCATION_ENTRY, GtkEntry)
+typedef enum {
+ EPHY_LOCATION_ENTRY_BOOKMARK_ICON_HIDDEN,
+ EPHY_LOCATION_ENTRY_BOOKMARK_ICON_EMPTY,
+ EPHY_LOCATION_ENTRY_BOOKMARK_ICON_BOOKMARKED
+} EphyLocationEntryBookmarkIconState;
+
GtkWidget *ephy_location_entry_new (void);
void ephy_location_entry_set_completion (EphyLocationEntry *entry,
@@ -62,8 +68,8 @@ void ephy_location_entry_undo_reset (EphyLocationEntr
void ephy_location_entry_activate (EphyLocationEntry *entry);
-void ephy_location_entry_set_bookmarked_status (EphyLocationEntry *entry,
- gboolean is_bookmarked);
+void ephy_location_entry_set_bookmark_icon_state (EphyLocationEntry *entry,
+ EphyLocationEntryBookmarkIconState state);
void ephy_location_entry_set_lock_tooltip (EphyLocationEntry *entry,
const char *tooltip);
diff --git a/src/bookmarks/ephy-add-bookmark-popover.c b/src/bookmarks/ephy-add-bookmark-popover.c
index e22bbea..e2ad823 100644
--- a/src/bookmarks/ephy-add-bookmark-popover.c
+++ b/src/bookmarks/ephy-add-bookmark-popover.c
@@ -155,8 +155,8 @@ ephy_add_bookmark_popover_update_bookmarked_status_cb (EphyAddBookmarkPopover *s
address = ephy_web_view_get_address (view);
if (g_strcmp0 (ephy_bookmark_get_url (bookmark), address) == 0) {
- ephy_location_entry_set_bookmarked_status (EPHY_LOCATION_ENTRY (location_entry),
- FALSE);
+ ephy_location_entry_set_bookmark_icon_state (EPHY_LOCATION_ENTRY (location_entry),
+ EPHY_LOCATION_ENTRY_BOOKMARK_ICON_EMPTY);
}
ephy_bookmarks_manager_save_to_file_async (manager, NULL,
@@ -195,7 +195,8 @@ ephy_add_bookmark_popover_show (EphyAddBookmarkPopover *self)
g_sequence_new (g_free));
ephy_bookmarks_manager_add_bookmark (manager, bookmark);
- ephy_location_entry_set_bookmarked_status (EPHY_LOCATION_ENTRY (location_entry), TRUE);
+ ephy_location_entry_set_bookmark_icon_state (EPHY_LOCATION_ENTRY (location_entry),
+ EPHY_LOCATION_ENTRY_BOOKMARK_ICON_BOOKMARKED);
}
g_signal_connect_object (manager, "bookmark-removed",
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a920b2f..391a968 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1140,6 +1140,7 @@ sync_tab_bookmarked_status (EphyWebView *view,
EphyWindow *window)
{
EphyBookmarksManager *manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
+ EphyLocationEntryBookmarkIconState state;
GtkWidget *widget;
EphyBookmark *bookmark;
const char *address;
@@ -1151,11 +1152,15 @@ sync_tab_bookmarked_status (EphyWebView *view,
address = ephy_web_view_get_address (view);
- if (address) {
+ if (!address || ephy_embed_utils_is_no_show_address (address)) {
+ state = EPHY_LOCATION_ENTRY_BOOKMARK_ICON_HIDDEN;
+ } else {
bookmark = ephy_bookmarks_manager_get_bookmark_by_url (manager, address);
- ephy_location_entry_set_bookmarked_status (EPHY_LOCATION_ENTRY (widget),
- bookmark != NULL);
+ state = bookmark ? EPHY_LOCATION_ENTRY_BOOKMARK_ICON_BOOKMARKED
+ : EPHY_LOCATION_ENTRY_BOOKMARK_ICON_EMPTY;
}
+
+ ephy_location_entry_set_bookmark_icon_state (EPHY_LOCATION_ENTRY (widget), state);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]