[epiphany/wip/cdavis/empty-page-styling: 2/4] history-dialog: Use HdyStatusPage for empty states




commit 30336a71baf9935a1623b67beef1c9d2c2974145
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Feb 11 16:54:57 2021 +0500

    history-dialog: Use HdyStatusPage for empty states

 src/ephy-history-dialog.c           |   6 +-
 src/resources/gtk/history-dialog.ui | 171 +++++++-----------------------------
 2 files changed, 35 insertions(+), 142 deletions(-)
---
diff --git a/src/ephy-history-dialog.c b/src/ephy-history-dialog.c
index 7066e8ffe..b9ff9e768 100644
--- a/src/ephy-history-dialog.c
+++ b/src/ephy-history-dialog.c
@@ -59,6 +59,7 @@ struct _EphyHistoryDialog {
   GtkWidget *search_bar;
   GtkWidget *search_entry;
   GtkWidget *history_presentation_stack;
+  GtkWidget *history_scrolled_window;
   GtkWidget *listbox;
   GtkWidget *loading_spinner;
   GtkWidget *empty_history_message;
@@ -115,12 +116,12 @@ update_ui_state (EphyHistoryDialog *self)
   } else {
     if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->search_button))) {
       if (has_data && self->has_search_results)
-        gtk_stack_set_visible_child (history_presentation_stack, self->listbox);
+        gtk_stack_set_visible_child (history_presentation_stack, self->history_scrolled_window);
       else
         gtk_stack_set_visible_child (history_presentation_stack, self->no_search_results_message);
     } else {
       if (has_data)
-        gtk_stack_set_visible_child (history_presentation_stack, self->listbox);
+        gtk_stack_set_visible_child (history_presentation_stack, self->history_scrolled_window);
       else
         gtk_stack_set_visible_child (history_presentation_stack, self->empty_history_message);
     }
@@ -904,6 +905,7 @@ ephy_history_dialog_class_init (EphyHistoryDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, search_bar);
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, search_entry);
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, history_presentation_stack);
+  gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, history_scrolled_window);
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, listbox);
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, loading_spinner);
   gtk_widget_class_bind_template_child (widget_class, EphyHistoryDialog, empty_history_message);
diff --git a/src/resources/gtk/history-dialog.ui b/src/resources/gtk/history-dialog.ui
index 112fbd1f1..3ac48fd80 100644
--- a/src/resources/gtk/history-dialog.ui
+++ b/src/resources/gtk/history-dialog.ui
@@ -162,21 +162,21 @@
           </packing>
         </child>
         <child>
-          <object class="GtkScrolledWindow">
+          <object class="GtkStack" id="history_presentation_stack">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
             <property name="vexpand">True</property>
-            <signal name="edge-reached" handler="on_edge_reached" object="EphyHistoryDialog" swapped="no"/>
             <child>
-              <object class="HdyClamp">
+              <object class="GtkScrolledWindow" id="history_scrolled_window">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_start">6</property>
-                <property name="margin_end">6</property>
-                <property name="maximum_size">1024</property>
+                <property name="can_focus">True</property>
+                <signal name="edge-reached" handler="on_edge_reached" object="EphyHistoryDialog" 
swapped="no"/>
                 <child>
-                  <object class="GtkStack" id="history_presentation_stack">
+                  <object class="HdyClamp">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">6</property>
+                    <property name="margin_end">6</property>
+                    <property name="maximum_size">1024</property>
                     <child>
                       <object class="GtkListBox" id="listbox">
                         <property name="visible">True</property>
@@ -193,141 +193,32 @@
                         </style>
                       </object>
                     </child>
-                    <child>
-                      <object class="GtkSpinner" id="loading_spinner">
-                        <property name="can_focus">False</property>
-                        <property name="visible">True</property>
-                      </object>
-                      <packing>
-                        <property name="name">loading</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkBox" id="empty_history_message">
-                        <property name="can_focus">False</property>
-                        <property name="halign">center</property>
-                        <property name="orientation">vertical</property>
-                        <property name="valign">center</property>
-                        <property name="vexpand">True</property>
-                        <property name="visible">True</property>
-                        <child>
-                          <object class="GtkImage">
-                            <property name="can_focus">False</property>
-                            <property name="icon_name">web-browser-symbolic</property>
-                            <property name="icon_size">0</property>
-                            <property name="margin_bottom">18</property>
-                            <property name="pixel_size">128</property>
-                            <property name="valign">center</property>
-                            <property name="visible">True</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkBox">
-                            <property name="can_focus">False</property>
-                            <property name="margin_end">12</property>
-                            <property name="margin_start">12</property>
-                            <property name="orientation">vertical</property>
-                            <property name="visible">True</property>
-                            <child>
-                              <object class="GtkLabel" id="empty_title_label">
-                                <property name="can_focus">False</property>
-                                <property name="halign">center</property>
-                                <property name="justify">center</property>
-                                <property name="margin_bottom">12</property>
-                                <property name="opacity">0.5</property>
-                                <property name="visible">True</property>
-                                <property name="wrap">True</property>
-                                <property name="label" translatable="yes">The History is Empty</property>
-                                <attributes>
-                                  <attribute name="scale" value="2"/>
-                                  <attribute name="weight" value="bold"/>
-                                </attributes>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="empty_description_label">
-                                <property name="can_focus">False</property>
-                                <property name="justify">center</property>
-                                <property name="margin_bottom">6</property>
-                                <property name="opacity">0.5</property>
-                                <property name="use_markup">True</property>
-                                <property name="visible">True</property>
-                                <property name="wrap">True</property>
-                                <property name="label" translatable="yes">Visited pages will be listed 
here</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkBox" id="no_search_results_message">
-                        <property name="can_focus">False</property>
-                        <property name="halign">center</property>
-                        <property name="orientation">vertical</property>
-                        <property name="valign">center</property>
-                        <property name="vexpand">True</property>
-                        <property name="visible">True</property>
-                        <child>
-                          <object class="GtkImage">
-                            <property name="can_focus">False</property>
-                            <property name="icon_name">edit-find-symbolic</property>
-                            <property name="icon_size">0</property>
-                            <property name="margin_bottom">18</property>
-                            <property name="pixel_size">128</property>
-                            <property name="valign">center</property>
-                            <property name="visible">True</property>
-                            <style>
-                              <class name="dim-label"/>
-                            </style>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkBox">
-                            <property name="can_focus">False</property>
-                            <property name="margin_end">12</property>
-                            <property name="margin_start">12</property>
-                            <property name="orientation">vertical</property>
-                            <property name="visible">True</property>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="can_focus">False</property>
-                                <property name="halign">center</property>
-                                <property name="justify">center</property>
-                                <property name="label" translatable="yes">No Results Found</property>
-                                <property name="margin_bottom">12</property>
-                                <property name="opacity">0.5</property>
-                                <property name="visible">True</property>
-                                <property name="wrap">True</property>
-                                <attributes>
-                                  <attribute name="scale" value="2"/>
-                                  <attribute name="weight" value="bold"/>
-                                </attributes>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="can_focus">False</property>
-                                <property name="justify">center</property>
-                                <property name="label" translatable="yes">Try a different search</property>
-                                <property name="margin_bottom">6</property>
-                                <property name="opacity">0.5</property>
-                                <property name="use_markup">True</property>
-                                <property name="visible">True</property>
-                                <property name="wrap">True</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
                   </object>
                 </child>
               </object>
             </child>
+            <child>
+              <object class="GtkSpinner" id="loading_spinner">
+                <property name="can_focus">False</property>
+                <property name="visible">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="HdyStatusPage" id="empty_history_message">
+                <property name="visible">True</property>
+                <property name="icon_name">web-browser-symbolic</property>
+                <property name="title" translatable="yes">The History is Empty</property>
+                <property name="description" translatable="yes">Visited pages will be listed here</property>
+              </object>
+            </child>
+            <child>
+              <object class="HdyStatusPage" id="no_search_results_message">
+                <property name="visible">True</property>
+                <property name="icon_name">edit-find-symbolic</property>
+                <property name="title" translatable="yes">No Results Found</property>
+                <property name="description" translatable="yes">Try a different search</property>
+              </object>
+            </child>
           </object>
         </child>
         <child>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]