[gtk+/wip/alexl/file-chooser-portal] portal: Warn about unsuported modes



commit e9b6566dcc6d513c0dd015728d316d4e4f2b918a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 11:01:12 2016 -0400

    portal: Warn about unsuported modes
    
    Bail out cleanly when we see GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
    or GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER.

 gtk/gtkfilechoosernativeportal.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index 61ef899..cd875d3 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -300,10 +300,6 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
   if (connection == NULL)
     return FALSE;
 
-  data = g_new0 (FilechooserPortalData, 1);
-  data->self = g_object_ref (self);
-  data->connection = connection;
-
   action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (self));
   multiple = gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (self));
 
@@ -326,7 +322,14 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self)
       signal_callback = one_file_response;
     }
   else
-    g_assert_not_reached ();
+    {
+      g_warning ("GTK_FILE_CHOOSER_ACTION_%s is not supported by GtkFileChooserNativePortal", action == 
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ? "SELECT_FOLDER" : "CREATE_FOLDER");
+      return FALSE;
+    }
+
+  data = g_new0 (FilechooserPortalData, 1);
+  data->self = g_object_ref (self);
+  data->connection = connection;
 
   message = g_dbus_message_new_method_call ("org.freedesktop.portal.Desktop",
                                             "/org/freedesktop/portal/desktop",


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