static void _on_icon_open(gpointer data) { DesktopIcon * desktopicon = data; Mime * mime; char * argv[] = { "browser", "browser", "--", NULL, NULL }; GSpawnFlags flags = G_SPAWN_SEARCH_PATH | G_SPAWN_FILE_AND_ARGV_ZERO; GError * error = NULL; if(desktopicon->path == NULL && desktopicon->callback != NULL) { desktopicon->callback(desktopicon->desktop, desktopicon->data); return; } if(desktopicon->isdir == FALSE) { mime = desktop_get_mime(desktopicon->desktop); if(mime != NULL) /* XXX ugly */ if(mime_action(mime, "open", desktopicon->path) != 0) _on_icon_open_with(desktopicon); return; } argv[3] = desktopicon->path; if(g_spawn_async(NULL, argv, NULL, flags, NULL, NULL, NULL, &error) != TRUE) { desktop_error(desktopicon->desktop, argv[0], 1); /* XXX */ g_error_free(error); } }
static void _on_icon_edit(gpointer data) { DesktopIcon * desktopicon = data; Mime * mime; mime = desktop_get_mime(desktopicon->desktop); mime_action(mime, "edit", desktopicon->path); }
/* preview_on_open */ static void _preview_on_open(gpointer data) { Preview * preview = data; Mime * mime = preview->helper->get_mime(preview->helper->browser); if(preview->path != NULL) mime_action(mime, "open", preview->path); }