[gtk: 1/3] GtkFileChooserWidget: check for empty instead of NULL GListModel




commit 6ce36e6a7da1946b4033529bd6a4c4382c35d1a0
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Sun May 1 16:31:47 2022 +0200

    GtkFileChooserWidget: check for empty instead of NULL GListModel
    
    While porting GtkFileChooserWidget from GList to GListModel we did not
    change some checks for NULL to checks for empty list.
    
    Fixes #4851, #4858

 gtk/gtkfilechooserwidget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index be084da421..4c34c49840 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -5448,7 +5448,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
        * So we want the selection to be "bar/foo.txt".  Jump to the case for the
        * filename entry to see if that is the case.
        */
-      if (info.result == NULL && impl->location_entry)
+      if (g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0 && impl->location_entry)
         goto file_entry;
     }
   else if (impl->location_entry &&
@@ -5497,7 +5497,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
    * then we fall back to the current directory
    */
   if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
-      info.result == NULL)
+      g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0)
     {
       GFile *current_folder;
 


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