Ver código fonte

Correction de mon premier bug! Faut pas unref le GFile.

Thomas Arnoux 2 meses atrás
pai
commit
bd11d49cbf
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6 2
      src/oupis-window.c

+ 6 - 2
src/oupis-window.c

@@ -101,6 +101,7 @@ oupis_window__search_request (GtkSearchEntry *self,
 static void
 listview_activate (GtkListView *listview, int position, gpointer user_data) {
   GFile *file;
+  GError *error = NULL;
   GFileInfo *info = G_FILE_INFO (g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (listview)), position));
 
   g_print ("%s\n", g_file_info_get_name (info));
@@ -108,9 +109,12 @@ listview_activate (GtkListView *listview, int position, gpointer user_data) {
   file = G_FILE (g_file_info_get_attribute_object (info, "standard::file"));
 
   //TODO rendre cet appel async et gérer les éventuelles erreurs
-  g_app_info_launch_default_for_uri (g_file_get_uri (file), NULL, NULL);
+  g_app_info_launch_default_for_uri (g_file_get_uri (file), NULL, &error);
+
+  if (error){
+    g_print ("%s\n", error->message);
+  }
 
-  g_object_unref (file);
   g_object_unref (info);
 }