ソースを参照

Ajout de l'ouverture d'un fichier au double-clic

vetetix 2 ヶ月 前
コミット
8c5daa2baf
1 ファイル変更10 行追加1 行削除
  1. 10 1
      src/oupis-window.c

+ 10 - 1
src/oupis-window.c

@@ -47,8 +47,17 @@ oupis_window__search_request (GtkSearchEntry *self,
 
 static void
 listview_activate (GtkListView *listview, int position, gpointer user_data) {
+  GFile *file;
   GFileInfo *info = G_FILE_INFO (g_list_model_get_item (G_LIST_MODEL (gtk_list_view_get_model (listview)), position));
-  //TODO do something with info
+
+  g_print ("%s\n", g_file_info_get_name (info));
+
+  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_object_unref (file);
   g_object_unref (info);
 }