diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2021-02-11 16:54:57 +0500 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2021-02-11 19:32:31 +0500 |
commit | dd2e54dd6b48764ae365a0470f27dbf0874cdae4 (patch) | |
tree | 9a93c7b66340663bf4c0dbfe81cc505c10a3086f | |
parent | c64544d439856602fcb2648aff3a2ecf27bbfffe (diff) | |
download | epiphany-dd2e54dd6b48764ae365a0470f27dbf0874cdae4.tar.gz |
history-dialog: Use HdyStatusPage for empty states
Use the actual app icon instead of web-browser-symbolic while we're here.
-rw-r--r-- | src/ephy-history-dialog.c | 9 | ||||
-rw-r--r-- | src/resources/gtk/history-dialog.ui | 170 |
2 files changed, 37 insertions, 142 deletions
diff --git a/src/ephy-history-dialog.c b/src/ephy-history-dialog.c index 7066e8ffe..248e58616 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); @@ -970,4 +972,7 @@ ephy_history_dialog_init (EphyHistoryDialog *self) gtk_widget_set_tooltip_text (self->clear_all_button, tooltip); set_is_loading (self, TRUE); + + hdy_status_page_set_icon_name (HDY_STATUS_PAGE (self->empty_history_message), + APPLICATION_ID "-symbolic"); } diff --git a/src/resources/gtk/history-dialog.ui b/src/resources/gtk/history-dialog.ui index 112fbd1f1..fafc17e8e 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,31 @@ </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="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> |