static void shell_action_handle_uris_cb (GSimpleAction *action, GVariant *parameter, EShell *shell) { const gchar **uris; gchar *change_dir = NULL; gint ii; /* Do not use g_strfreev() here. */ uris = g_variant_get_strv (parameter, NULL); if (uris && g_strcmp0 (uris[0], "--use-cwd") == 0 && uris[1] && *uris[1]) { change_dir = g_get_current_dir (); if (g_chdir (uris[1]) != 0) g_warning ("%s: Failed to change directory to '%s': %s", G_STRFUNC, uris[1], g_strerror (errno)); for (ii = 0; uris[ii + 2]; ii++) { uris[ii] = uris[ii + 2]; } uris[ii] = NULL; } e_shell_handle_uris (shell, uris, FALSE); g_free (uris); if (change_dir) { if (g_chdir (change_dir) != 0) g_warning ("%s: Failed to return back to '%s': %s", G_STRFUNC, change_dir, g_strerror (errno)); g_free (change_dir); } }
static gboolean idle_cb (const gchar * const *uris) { EShell *shell; shell = e_shell_get_default (); /* These calls do the right thing when another Evolution * process is running. */ if (uris != NULL && *uris != NULL) { if (e_shell_handle_uris (shell, uris, import_uris) == 0) gtk_main_quit (); } else { e_shell_create_shell_window (shell, requested_view); } /* If another Evolution process is running, we're done. */ if (g_application_get_is_remote (G_APPLICATION (shell))) gtk_main_quit (); return FALSE; }