Make EmptyPlaceholder more generally useful and rename to fit style

This commit is contained in:
Michael Gratton 2019-01-20 18:18:19 +10:30 committed by Michael James Gratton
parent 436fac7f2b
commit bd960dcaf5
7 changed files with 40 additions and 17 deletions

View file

@ -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

View file

@ -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); }

View file

@ -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"
);

View file

@ -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',

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<template class="EmptyPlaceholder" parent="GtkGrid">
<template class="ComponentsPlaceholderPane" parent="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
@ -14,7 +14,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">72</property>
<property name="icon_name">folder-symbolic</property>
<property name="icon_name">image-x-generic-symbolic</property>
<property name="icon_size">6</property>
</object>
<packing>
@ -52,7 +52,7 @@
</child>
<style>
<class name="dim-label"/>
<class name="geary-empty-placeholder"/>
<class name="geary-placeholder-pane"/>
</style>
</template>
</interface>

View file

@ -178,12 +178,12 @@ grid.geary-message-summary {
border-radius: 0px;
}
/* EmptyPlaceholder */
/* PlaceholderPane */
.geary-empty-placeholder > image {
.geary-placeholder-pane > image {
margin-bottom: 12px;
}
.geary-empty-placeholder > .title {
.geary-placeholder-pane > .title {
font-weight: bold;
}

View file

@ -10,6 +10,7 @@
<file compressed="true" preprocess="xml-stripblanks">certificate_warning_dialog.glade</file>
<file compressed="true">client-web-view.js</file>
<file compressed="true">client-web-view-allow-remote-images.js</file>
<file compressed="true" preprocess="xml-stripblanks">components-placeholder-pane.ui</file>
<file compressed="true" preprocess="xml-stripblanks">composer-headerbar.ui</file>
<file compressed="true" preprocess="xml-stripblanks">composer-link-popover.ui</file>
<file compressed="true" preprocess="xml-stripblanks">composer-menus.ui</file>
@ -24,7 +25,6 @@
<file compressed="true" preprocess="xml-stripblanks">conversation-viewer.ui</file>
<file compressed="true">conversation-web-view.css</file>
<file compressed="true">conversation-web-view.js</file>
<file compressed="true" preprocess="xml-stripblanks">empty-placeholder.ui</file>
<file compressed="true" preprocess="xml-stripblanks">find_bar.glade</file>
<file compressed="true" preprocess="xml-stripblanks">folder-popover.ui</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/help-overlay.ui</file>