[nautilus] files-view: better empty state for Trash
- From: Răzvan-Mihai Chițu <razvanchitu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: better empty state for Trash
- Date: Wed, 2 Nov 2016 13:53:14 +0000 (UTC)
commit eb66cf903e4eb43dce7339e760361cd1ca7ceea3
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Wed Sep 21 19:36:48 2016 +0530
files-view: better empty state for Trash
Implement better empty state for Trash as per new design.
https://bugzilla.gnome.org/show_bug.cgi?id=763147
po/POTFILES.in | 1 +
src/nautilus-files-view.c | 19 ++++++++++++
src/resources/nautilus.gresource.xml | 1 +
src/resources/ui/nautilus-trash-is-empty.ui | 42 +++++++++++++++++++++++++++
4 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8647562..277a7ff 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -85,6 +85,7 @@ src/resources/ui/nautilus-compress-dialog.ui
src/resources/ui/nautilus-create-folder-dialog.ui
src/resources/ui/nautilus-files-view-context-menus.ui
src/resources/ui/nautilus-folder-is-empty.ui
+src/resources/ui/nautilus-trash-is-empty.ui
src/resources/ui/nautilus-move-to-trash-shortcut-changed.ui
src/resources/ui/nautilus-no-search-results.ui
src/resources/ui/nautilus-pathbar-context-menu.ui
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 97bff40..ba19de3 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -258,6 +258,7 @@ struct NautilusFilesViewDetails
/* Empty states */
GtkWidget *folder_is_empty_widget;
+ GtkWidget *trash_is_empty_widget;
GtkWidget *no_search_results_widget;
/* Floating bar */
@@ -3353,15 +3354,25 @@ nautilus_files_view_check_empty_states (NautilusFilesView *view)
static void
real_check_empty_states (NautilusFilesView *view)
{
+ g_autofree gchar *uri = NULL;
+
gtk_widget_hide (view->details->no_search_results_widget);
gtk_widget_hide (view->details->folder_is_empty_widget);
+ gtk_widget_hide (view->details->trash_is_empty_widget);
+
if (!view->details->loading &&
nautilus_files_view_is_empty (view))
{
+ uri = g_file_get_uri (view->details->location);
+
if (nautilus_view_is_searching (NAUTILUS_VIEW (view)))
{
gtk_widget_show (view->details->no_search_results_widget);
}
+ else if (eel_uri_is_trash (uri))
+ {
+ gtk_widget_show (view->details->trash_is_empty_widget);
+ }
else
{
gtk_widget_show (view->details->folder_is_empty_widget);
@@ -9140,6 +9151,14 @@ nautilus_files_view_init (NautilusFilesView *view)
TRUE);
g_object_unref (builder);
+ builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-trash-is-empty.ui");
+ view->details->trash_is_empty_widget = GTK_WIDGET (gtk_builder_get_object (builder, "trash_is_empty"));
+ gtk_overlay_add_overlay (GTK_OVERLAY (view->details->overlay), view->details->trash_is_empty_widget);
+ gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (view->details->overlay),
+ view->details->trash_is_empty_widget,
+ TRUE);
+ g_object_unref (builder);
+
/* Floating bar */
view->details->floating_bar = nautilus_floating_bar_new (NULL, NULL, FALSE);
gtk_widget_set_halign (view->details->floating_bar, GTK_ALIGN_END);
diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml
index 53682b6..720bfa5 100644
--- a/src/resources/nautilus.gresource.xml
+++ b/src/resources/nautilus.gresource.xml
@@ -17,6 +17,7 @@
<file>ui/nautilus-window.ui</file>
<file>ui/nautilus-no-search-results.ui</file>
<file>ui/nautilus-folder-is-empty.ui</file>
+ <file>ui/nautilus-trash-is-empty.ui</file>
<file>gtk/help-overlay.ui</file>
<file>ui/nautilus-batch-rename-dialog.ui</file>
<file alias="gtk/ui/nautilusgtkplacesview.ui">../gtk/nautilusgtkplacesview.ui</file>
diff --git a/src/resources/ui/nautilus-trash-is-empty.ui b/src/resources/ui/nautilus-trash-is-empty.ui
new file mode 100644
index 0000000..d0d9412
--- /dev/null
+++ b/src/resources/ui/nautilus-trash-is-empty.ui
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkGrid" id="trash_is_empty">
+ <property name="visible">False</property>
+ <property name="row_spacing">12</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">user-trash-symbolic</property>
+ <property name="pixel-size">72</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Trash is Empty</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.44"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]