[gnome-text-editor] languagedialog: add placeholder text



commit dcc0a07f549981ca24a3a120fb6e384da6a210b7
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 1 11:24:49 2021 -0800

    languagedialog: add placeholder text
    
    When there are no matches, we need something to display.

 src/editor-language-dialog.c  | 13 ++++++++-----
 src/editor-language-dialog.ui | 12 ++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/editor-language-dialog.c b/src/editor-language-dialog.c
index ee595fd..35389d7 100644
--- a/src/editor-language-dialog.c
+++ b/src/editor-language-dialog.c
@@ -126,12 +126,15 @@ editor_language_dialog_filter (EditorLanguageDialog *self,
        child != NULL;
        child = gtk_widget_get_next_sibling (child))
     {
-      EditorLanguageRow *row = EDITOR_LANGUAGE_ROW (child);
+      if (EDITOR_IS_LANGUAGE_ROW (child))
+        {
+          EditorLanguageRow *row = EDITOR_LANGUAGE_ROW (child);
 
-      if (_editor_language_row_match (row, spec))
-        gtk_widget_show (GTK_WIDGET (row));
-      else
-        gtk_widget_hide (GTK_WIDGET (row));
+          if (_editor_language_row_match (row, spec))
+            gtk_widget_show (GTK_WIDGET (row));
+          else
+            gtk_widget_hide (GTK_WIDGET (row));
+        }
     }
 }
 
diff --git a/src/editor-language-dialog.ui b/src/editor-language-dialog.ui
index 55b9655..02438a6 100644
--- a/src/editor-language-dialog.ui
+++ b/src/editor-language-dialog.ui
@@ -42,6 +42,18 @@
                 <property name="margin-bottom">42</property>
                 <property name="child">
                   <object class="GtkListBox" id="list_box">
+                    <child type="placeholder">
+                      <object class="GtkLabel">
+                        <property name="label" translatable="yes">No Matches</property>
+                        <property name="margin-top">18</property>
+                        <property name="margin-bottom">18</property>
+                        <property name="margin-end">18</property>
+                        <property name="margin-start">18</property>
+                        <style>
+                          <class name="dim-label"/>
+                        </style>
+                      </object>
+                    </child>
                     <style>
                       <class name="content"/>
                     </style>


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