gboolean fm_app_info_launch (GAppInfo *appinfo, GList *files, GAppLaunchContext *launch_context, GError **error) { gboolean supported = FALSE, ret = FALSE; if (G_IS_DESKTOP_APP_INFO (appinfo)) { const char*id = g_app_info_get_id (appinfo); if (id) // this is an installed application { // load the desktop entry file to obtain more info GKeyFile *kf = g_key_file_new (); char *rel_path = g_strconcat ("applications/", id, NULL); char *full_desktop_path; supported = g_key_file_load_from_data_dirs (kf, rel_path, &full_desktop_path, 0, NULL); g_free (rel_path); if (supported) { ret = do_launch (appinfo, full_desktop_path, kf, files, launch_context, error); g_free (full_desktop_path); } g_key_file_free (kf); } else { const char *file = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (appinfo)); if (file) // this is a desktop entry file { // load the desktop entry file to obtain more info GKeyFile *kf = g_key_file_new (); supported = g_key_file_load_from_file (kf, file, 0, NULL); if (supported) ret = do_launch (appinfo, file, kf, files, launch_context, error); g_key_file_free (kf); } else { // If this is created with fm_app_info_create_from_commandline () if (g_object_get_data (G_OBJECT (appinfo), "flags")) { supported = TRUE; ret = do_launch (appinfo, NULL, NULL, files, launch_context, error); } } } } else supported = FALSE; if (!supported) // fallback to GAppInfo::launch return g_app_info_launch (appinfo, files, launch_context, error); return ret; }
static void do_launch_program() { int num = 1; launch_cfg_t lc; /* * Control flow: * - Do the startup led blinks. * - Read the launch config switches. * - Store launch config * - Light the launch config leds. * - Wait for launch button to be pressed * - Do countdown * - Activate launch transistors per the launch config. */ do_startup_blinky(); g_launch_cfg = get_launch_cfg(); set_launch_cfg_leds(g_launch_cfg); while (1) { /* * poll for launch cfg change or launch button press */ lc = get_launch_cfg(); set_launch_cfg_leds(lc); /* * Is a human pressing the launch button? */ if ((PINC & (1 << PINC3)) == 0) { break; } delay_ms(300); } num = countdown(9, 900); if (!num) { do_launch(); num = countup(0, 900); } else { blink(num, 900); } }
void launch_diags(void) { int num; set_num(0); for (int i = 0; i < 3; i++) { LC0_HIGH; delay_ms(1000); LC0_LOW; delay_ms(500); } num = countdown(9, 900); g_launch_cfg = LC_ALL; do_launch(); while (1) {} }
/** * fm_app_info_launch * @appinfo: application info to launch * @files: (element-type GFile): files to use in run substitutions * @launch_context: (allow-none): a launch context * @error: (out) (allow-none): location to store error * * Launches desktop application doing substitutions in application info. * * Returns: %TRUE if application was launched. * * Since: 0.1.15 */ gboolean fm_app_info_launch(GAppInfo *appinfo, GList *files, GAppLaunchContext *launch_context, GError **error) { gboolean supported = FALSE, ret = FALSE; if(G_IS_DESKTOP_APP_INFO(appinfo)) { const char *id; #if GLIB_CHECK_VERSION(2,24,0) /* if GDesktopAppInfo knows the filename then let use it */ id = g_desktop_app_info_get_filename(G_DESKTOP_APP_INFO(appinfo)); if(id) /* this is a desktop entry file */ { /* load the desktop entry file to obtain more info */ GKeyFile* kf = g_key_file_new(); supported = g_key_file_load_from_file(kf, id, 0, NULL); if(supported) ret = do_launch(appinfo, id, kf, files, launch_context, error); g_key_file_free(kf); id = NULL; } else /* otherwise try application id */ #endif id = g_app_info_get_id(appinfo); if(id) /* this is an installed application */ { /* load the desktop entry file to obtain more info */ GKeyFile* kf = g_key_file_new(); char* rel_path = g_strconcat("applications/", id, NULL); char* full_desktop_path; supported = g_key_file_load_from_data_dirs(kf, rel_path, &full_desktop_path, 0, NULL); g_free(rel_path); if(supported) { ret = do_launch(appinfo, full_desktop_path, kf, files, launch_context, error); g_free(full_desktop_path); } g_key_file_free(kf); } else { #if GLIB_CHECK_VERSION(2,24,0) if (!supported) /* it was launched otherwise, see above */ #endif { /* If this is created with fm_app_info_create_from_commandline() */ if(g_object_get_data(G_OBJECT(appinfo), "flags")) { supported = TRUE; ret = do_launch(appinfo, NULL, NULL, files, launch_context, error); } } } } else supported = FALSE; if(!supported) /* fallback to GAppInfo::launch */ return g_app_info_launch(appinfo, files, launch_context, error); return ret; }
/* window procedure for the desktop window */ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp ) { WINE_TRACE( "got msg %04x wp %lx lp %lx\n", message, wp, lp ); switch(message) { case WM_SYSCOMMAND: switch(wp & 0xfff0) { case SC_CLOSE: ExitWindows( 0, 0 ); break; case SC_SCREENSAVE: return start_screensaver(); } return 0; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_SETCURSOR: return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) ); case WM_NCHITTEST: return HTCLIENT; case WM_ERASEBKGND: if (!using_root) PaintDesktop( (HDC)wp ); return TRUE; case WM_SETTINGCHANGE: if (wp == SPI_SETDESKWALLPAPER) SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE ); return 0; case WM_LBUTTONDBLCLK: if (!using_root) { const struct launcher *launcher = launcher_from_point( (short)LOWORD(lp), (short)HIWORD(lp) ); if (launcher) do_launch( launcher ); } return 0; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint( hwnd, &ps ); if (!using_root) { if (ps.fErase) PaintDesktop( ps.hdc ); draw_launchers( ps.hdc, ps.rcPaint ); } EndPaint( hwnd, &ps ); } return 0; default: return DefWindowProcW( hwnd, message, wp, lp ); } }