src/main.c
// NOTE: Apps with the Terminal=true key only launch if a supported terminal
// app is installed (see gdesktopappinfo.c implementation in glib). Currently
// supported terminals are: gnome-terminal, nxterm, color-xterm, rxvt, dtterm,
// and xterm
Apps with the Terminal=true key only launch if a supported terminal
app is installed . Currently
supported terminals are: gnome-terminal, nxterm, color-xterm, rxvt, dtterm,
and xterm
Apps with the Terminal = true key only launch if a supported terminal app is installed . Currently supported terminals are : gnome - terminal nxterm color - xterm rxvt dtterm and xterm
static void launch_application(Result *result, struct sgflow_state *sgflow_state) {
	GError *error = NULL;
	const gchar *category = result_get_category(result);
	const gchar *app_id = result_get_id(result);
	const gchar *display_name = result_get_displayname(result);
	if (g_strcmp0("APPLICATION", category) == 0) {
		g_debug("Launching application: %s\n", display_name);
		GDesktopAppInfo *desktop_app_info = g_desktop_app_info_new(app_id);
		gboolean launched = g_desktop_app_info_launch_uris_as_manager(
				desktop_app_info, NULL, NULL, G_SPAWN_SEARCH_PATH | 
				G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN, 
				NULL, NULL, NULL, NULL, &error);
		if (error != NULL) {
			g_log(NULL, G_LOG_LEVEL_ERROR, "%s: %s", __func__, error->message);
			g_error_free(error);
		}	
		if (launched) {
			if (category != NULL) {
				g_free((gpointer*) category);
			}
			if (app_id != NULL) {
				g_free((gpointer*) app_id);
			}
			if (display_name != NULL) {
				g_free((gpointer*) display_name);
			}
			GtkWindow *active_window = 
				gtk_application_get_active_window(sgflow_state->application);
			gtk_widget_hide(GTK_WIDGET(active_window));	
			gdk_window_process_all_updates();
			sleep(2);
			g_object_unref(desktop_app_info);
			g_application_quit(G_APPLICATION(sgflow_state->application));
		}
	} else {
		g_log(NULL, G_LOG_LEVEL_WARNING, 
				"%s: selected result is not an application: %s - %s", __func__,
				display_name, category);
		if (category != NULL) {
			g_free((gpointer*) category);
		}
		if (app_id != NULL) {
			g_free((gpointer*) app_id);
		}
		if (display_name != NULL) {
			g_free((gpointer*) display_name);
		}
	}
}
static void launch_application ( Result * result , struct sgflow_state * sgflow_state ) { GError * error = NULL ; const gchar * category = result_get_category ( result ) ; const gchar * app_id = result_get_id ( result ) ; const gchar * display_name = result_get_displayname ( result ) ; if ( g_strcmp0 ( " " , category ) == 0 ) { g_debug ( " \n " , display_name ) ; GDesktopAppInfo * desktop_app_info = g_desktop_app_info_new ( app_id ) ; gboolean launched = g_desktop_app_info_launch_uris_as_manager ( desktop_app_info , NULL , NULL , G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN , NULL , NULL , NULL , NULL , & error ) ; if ( error != NULL ) { g_log ( NULL , G_LOG_LEVEL_ERROR , " " , __func__ , error -> message ) ; g_error_free ( error ) ; } if ( launched ) { if ( category != NULL ) { g_free ( ( gpointer * ) category ) ; } if ( app_id != NULL ) { g_free ( ( gpointer * ) app_id ) ; } if ( display_name != NULL ) { g_free ( ( gpointer * ) display_name ) ; } GtkWindow * active_window = gtk_application_get_active_window ( sgflow_state -> application ) ; gtk_widget_hide ( GTK_WIDGET ( active_window ) ) ; gdk_window_process_all_updates ( ) ; sleep ( 2 ) ; g_object_unref ( desktop_app_info ) ; g_application_quit ( G_APPLICATION ( sgflow_state -> application ) ) ; } } else { g_log ( NULL , G_LOG_LEVEL_WARNING , " " , __func__ , display_name , category ) ; if ( category != NULL ) { g_free ( ( gpointer * ) category ) ; } if ( app_id != NULL ) { g_free ( ( gpointer * ) app_id ) ; } if ( display_name != NULL ) { g_free ( ( gpointer * ) display_name ) ; } } }
NOTE: Apps with the Terminal=true key only launch if a supported terminal
app is installed (see gdesktopappinfo.c implementation in glib).
NOTE : Apps with the Terminal = true key only launch if a supported terminal app is installed ( see gdesktopappinfo . c implementation in glib ) .
// This is to make the window disappear and then give a moment to launch // an app before quitting (I'm talking to you, Nautilus)