[epiphany] bookmarks-popover: Add an empty state
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] bookmarks-popover: Add an empty state
- Date: Tue, 17 Jan 2017 02:01:30 +0000 (UTC)
commit 9b06cd3a02ec2572f200abdc81d059d1588491a8
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Jan 16 20:00:17 2017 -0600
bookmarks-popover: Add an empty state
Otherwise it looks horrible in private profile mode. Which admittedly
nobody uses. But maybe somebody will delete all the default bookmarks
and then see this handiwork.
src/bookmarks/ephy-bookmarks-popover.c | 9 ++++++
src/resources/gtk/bookmarks-popover.ui | 43 ++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-popover.c b/src/bookmarks/ephy-bookmarks-popover.c
index de769a0..cfdb7f2 100644
--- a/src/bookmarks/ephy-bookmarks-popover.c
+++ b/src/bookmarks/ephy-bookmarks-popover.c
@@ -237,6 +237,9 @@ ephy_bookmarks_popover_bookmark_added_cb (EphyBookmarksPopover *self,
row = create_bookmark_row (bookmark, self);
gtk_container_add (GTK_CONTAINER (self->tags_list_box), row);
}
+
+ if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (self->toplevel_stack)), "empty-state") == 0)
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toplevel_stack), "default");
}
static void
@@ -270,6 +273,9 @@ ephy_bookmarks_popover_bookmark_removed_cb (EphyBookmarksPopover *self,
}
gtk_container_remove (GTK_CONTAINER (self->tags_list_box), row);
+
+ if (g_list_model_get_n_items (G_LIST_MODEL (self->list_model)) == 0)
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toplevel_stack), "empty-state");
}
static void
@@ -502,6 +508,9 @@ ephy_bookmarks_popover_init (EphyBookmarksPopover *self)
create_bookmark_row,
self, NULL);
+ if (g_list_model_get_n_items (G_LIST_MODEL (self->list_model)) == 0)
+ gtk_stack_set_visible_child_name (GTK_STACK (self->toplevel_stack), "empty-state");
+
gtk_list_box_set_sort_func (GTK_LIST_BOX (self->tags_list_box),
(GtkListBoxSortFunc)tags_list_box_sort_func,
NULL, NULL);
diff --git a/src/resources/gtk/bookmarks-popover.ui b/src/resources/gtk/bookmarks-popover.ui
index 5b76178..6b19c71 100644
--- a/src/resources/gtk/bookmarks-popover.ui
+++ b/src/resources/gtk/bookmarks-popover.ui
@@ -146,6 +146,49 @@
<property name="name">tag_detail</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">non-starred-symbolic</property>
+ <property name="pixel-size">64</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="label" translatable="yes">No bookmarks yet?</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="2"/>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="subtitle">
+ <property name="label" translatable="yes">Bookmark some webpages to view them
here.</property>
+ <property name="use-markup">true</property>
+ <property name="visible">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">empty-state</property>
+ </packing>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]