[gnome-logs/wip/cdavis/40-consistency-update: 4/4] eventviewlist: Use HdyStatusPage for list placeholder




commit 9f9d5368825d2415b80c1cf65e90b9ea2c10cc77
Author: Christopher Davis <brainblasted disroot org>
Date:   Wed Feb 10 20:44:49 2021 -0800

    eventviewlist: Use HdyStatusPage for list placeholder
    
    libhandy gives us a nice pre-built page to use for empty
    views. To be consistent with the rest of GNOME we should
    use it.

 src/gl-eventviewlist.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)
---
diff --git a/src/gl-eventviewlist.c b/src/gl-eventviewlist.c
index d313c7d..8792585 100644
--- a/src/gl-eventviewlist.c
+++ b/src/gl-eventviewlist.c
@@ -20,6 +20,7 @@
 
 #include <glib/gi18n.h>
 #include <glib-unix.h>
+#include <libhandy-1/handy.h>
 #include <stdlib.h>
 
 #include "gl-categorylist.h"
@@ -462,37 +463,18 @@ gl_event_view_list_set_search_mode (GlEventViewList *view,
 static GtkWidget *
 gl_event_view_create_empty (G_GNUC_UNUSED GlEventViewList *view)
 {
-    GtkWidget *box;
-    GtkStyleContext *context;
-    GtkWidget *image;
-    GtkWidget *label;
-    gchar *markup;
-
-    box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-    gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
-    gtk_widget_set_hexpand (box, TRUE);
-    gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
-    gtk_widget_set_vexpand (box, TRUE);
-    context = gtk_widget_get_style_context (box);
-    gtk_style_context_add_class (context, "dim-label");
-
-    image = gtk_image_new_from_icon_name ("action-unavailable-symbolic", 0);
-    context = gtk_widget_get_style_context (image);
-    gtk_style_context_add_class (context, "dim-label");
-    gtk_image_set_pixel_size (GTK_IMAGE (image), 128);
-    gtk_container_add (GTK_CONTAINER (box), image);
-
-    label = gtk_label_new (NULL);
+    GtkWidget *status_page;
+
+    status_page = hdy_status_page_new ();
+    hdy_status_page_set_icon_name (HDY_STATUS_PAGE (status_page),
+                                   "action-unavailable-symbolic");
     /* Translators: Shown when there are no (zero) results in the current
      * view. */
-    markup = g_markup_printf_escaped ("<big>%s</big>", _("No results"));
-    gtk_label_set_markup (GTK_LABEL (label), markup);
-    gtk_container_add (GTK_CONTAINER (box), label);
-    g_free (markup);
+    hdy_status_page_set_title (HDY_STATUS_PAGE (status_page), _("No Results"));
 
-    gtk_widget_show_all (box);
+    gtk_widget_show (status_page);
 
-    return box;
+    return status_page;
 }
 
 static GtkWidget *


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