From bd960dcaf5c70aa0ad6a13181766589ad3987c6b Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sun, 20 Jan 2019 18:18:19 +1030 Subject: [PATCH] Make EmptyPlaceholder more generally useful and rename to fit style --- po/POTFILES.in | 2 +- ....vala => components-placeholder-pane.vala} | 9 ++++-- .../conversation-viewer.vala | 28 ++++++++++++++++--- src/client/meson.build | 2 +- ...lder.ui => components-placeholder-pane.ui} | 8 +++--- ui/geary.css | 6 ++-- ui/org.gnome.Geary.gresource.xml | 2 +- 7 files changed, 40 insertions(+), 17 deletions(-) rename src/client/components/{empty-placeholder.vala => components-placeholder-pane.vala} (73%) rename ui/{empty-placeholder.ui => components-placeholder-pane.ui} (89%) diff --git a/po/POTFILES.in b/po/POTFILES.in index ca8fcc94..bcbbb01f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -25,9 +25,9 @@ src/client/application/goa-mediator.vala src/client/application/main.vala src/client/application/secret-mediator.vala src/client/components/client-web-view.vala +src/client/components/components-placeholder-pane.vala src/client/components/components-validator.vala src/client/components/count-badge.vala -src/client/components/empty-placeholder.vala src/client/components/folder-popover.vala src/client/components/icon-factory.vala src/client/components/main-toolbar.vala diff --git a/src/client/components/empty-placeholder.vala b/src/client/components/components-placeholder-pane.vala similarity index 73% rename from src/client/components/empty-placeholder.vala rename to src/client/components/components-placeholder-pane.vala index 8331c080..ec8926f9 100644 --- a/src/client/components/empty-placeholder.vala +++ b/src/client/components/components-placeholder-pane.vala @@ -8,19 +8,22 @@ /** * A placeholder image and message for empty views. */ -[GtkTemplate (ui = "/org/gnome/Geary/empty-placeholder.ui")] -public class EmptyPlaceholder : Gtk.Grid { +[GtkTemplate (ui = "/org/gnome/Geary/components-placeholder-pane.ui")] +public class Components.PlaceholderPane : Gtk.Grid { - public string image_name { + /** The icon name of the pane's image. */ + public string icon_name { owned get { return this.placeholder_image.icon_name; } set { this.placeholder_image.icon_name = value; } } + /** The text of the pane's title label. */ public string title { get { return this.title_label.get_text(); } set { this.title_label.set_text(value); } } + /** The text of the pane's sub-title label. */ public string subtitle { get { return this.subtitle_label.get_text(); } set { this.subtitle_label.set_text(value); } diff --git a/src/client/conversation-viewer/conversation-viewer.vala b/src/client/conversation-viewer/conversation-viewer.vala index 4a542fcc..7ded5f14 100644 --- a/src/client/conversation-viewer/conversation-viewer.vala +++ b/src/client/conversation-viewer/conversation-viewer.vala @@ -73,29 +73,49 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface { base_ref(); this.config = config; - EmptyPlaceholder no_conversations = new EmptyPlaceholder(); + Components.PlaceholderPane no_conversations = new Components.PlaceholderPane(); + no_conversations.icon_name = "folder-symbolic"; + // Translators: Title label for placeholder when no + // conversations have been selected. no_conversations.title = _("No conversations selected"); + // Translators: Sub-title label for placeholder when no + // conversations have been selected. no_conversations.subtitle = _( "Selecting a conversation from the list will display it here" ); this.no_conversations_page.add(no_conversations); - EmptyPlaceholder multi_conversations = new EmptyPlaceholder(); + Components.PlaceholderPane multi_conversations = new Components.PlaceholderPane(); + no_conversations.icon_name = "folder-symbolic"; + // Translators: Title label for placeholder when multiple + // conversations have been selected. multi_conversations.title = _("Multiple conversations selected"); + // Translators: Sub-title label for placeholder when multiple + // conversations have been selected. multi_conversations.subtitle = _( "Choosing an action will apply to all selected conversations" ); this.multiple_conversations_page.add(multi_conversations); - EmptyPlaceholder empty_folder = new EmptyPlaceholder(); + Components.PlaceholderPane empty_folder = new Components.PlaceholderPane(); + no_conversations.icon_name = "folder-symbolic"; + // Translators: Title label for placeholder when no + // conversations have exist in a folder. empty_folder.title = _("No conversations found"); + // Translators: Sub-title label for placeholder when no + // conversations have exist in a folder. empty_folder.subtitle = _( "This folder does not contain any conversations" ); this.empty_folder_page.add(empty_folder); - EmptyPlaceholder empty_search = new EmptyPlaceholder(); + Components.PlaceholderPane empty_search = new Components.PlaceholderPane(); + no_conversations.icon_name = "folder-symbolic"; + // Translators: Title label for placeholder when no + // conversations have been found in a search. empty_search.title = _("No conversations found"); + // Translators: Sub-title label for placeholder when no + // conversations have been found in a search. empty_search.subtitle = _( "Your search returned no results, try refining your search terms" ); diff --git a/src/client/meson.build b/src/client/meson.build index a037366e..424ae473 100644 --- a/src/client/meson.build +++ b/src/client/meson.build @@ -21,9 +21,9 @@ geary_client_vala_sources = files( 'accounts/accounts-manager.vala', 'components/client-web-view.vala', + 'components/components-placeholder-pane.vala', 'components/components-validator.vala', 'components/count-badge.vala', - 'components/empty-placeholder.vala', 'components/folder-popover.vala', 'components/icon-factory.vala', 'components/main-toolbar.vala', diff --git a/ui/empty-placeholder.ui b/ui/components-placeholder-pane.ui similarity index 89% rename from ui/empty-placeholder.ui rename to ui/components-placeholder-pane.ui index 1de05f16..ee2e8241 100644 --- a/ui/empty-placeholder.ui +++ b/ui/components-placeholder-pane.ui @@ -1,8 +1,8 @@ - + -