aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/e-shell-utils.c4
-rw-r--r--shell/e-shell-utils.h2
-rw-r--r--shell/e-shell.c70
-rw-r--r--shell/e-shell.h2
-rw-r--r--shell/main.c2
-rw-r--r--widgets/misc/e-import-assistant.c19
-rw-r--r--widgets/misc/e-import-assistant.h2
7 files changed, 43 insertions, 58 deletions
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 4676a2d2e9..43ddd0562c 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -282,7 +282,7 @@ exit:
**/
guint
e_shell_utils_import_uris (EShell *shell,
- gchar **uris)
+ const gchar * const *uris)
{
GtkWindow *parent;
GtkWidget *assistant;
@@ -308,7 +308,7 @@ e_shell_utils_import_uris (EShell *shell,
} else
g_warning ("Cannot import any of the given URIs");
- return g_strv_length (uris);
+ return g_strv_length ((gchar **) uris);
}
/**
diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h
index 178c26d20f..897981e0d0 100644
--- a/shell/e-shell-utils.h
+++ b/shell/e-shell-utils.h
@@ -44,7 +44,7 @@ GFile * e_shell_run_save_dialog (EShell *shell,
gpointer customize_data);
guint e_shell_utils_import_uris (EShell *shell,
- gchar **uris);
+ const gchar * const *uris);
void e_shell_hide_widgets_for_express_mode
(EShell *shell,
diff --git a/shell/e-shell.c b/shell/e-shell.c
index d9c3508161..eb3cb8e407 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -236,6 +236,19 @@ shell_action_new_window_cb (GSimpleAction *action,
}
static void
+shell_action_handle_uris_cb (GSimpleAction *action,
+ GVariant *parameter,
+ EShell *shell)
+{
+ const gchar **uris;
+
+ /* Do not use g_strfreev() here. */
+ uris = g_variant_get_strv (parameter, NULL);
+ e_shell_handle_uris (shell, uris, FALSE);
+ g_free (uris);
+}
+
+static void
shell_action_quit_cb (GSimpleAction *action,
GVariant *parameter,
EShell *shell)
@@ -261,6 +274,14 @@ shell_add_actions (GApplication *application)
g_simple_action_group_insert (action_group, G_ACTION (action));
g_object_unref (action);
+ action = g_simple_action_new (
+ "handle-uris", G_VARIANT_TYPE_STRING_ARRAY);
+ g_signal_connect (
+ action, "activate",
+ G_CALLBACK (shell_action_handle_uris_cb), application);
+ g_simple_action_group_insert (action_group, G_ACTION (action));
+ g_object_unref (action);
+
action = g_simple_action_new ("quit", NULL);
g_signal_connect (
action, "activate",
@@ -811,29 +832,6 @@ shell_activate (GApplication *application)
}
static void
-shell_open (GApplication *application,
- GFile **files,
- gint n_files,
- const gchar *hint)
-{
- EShell *shell;
- gchar **uris;
- gint ii;
-
- /* Do not chain up. Default method just emits a warning. */
-
- shell = E_SHELL (application);
- uris = g_new0 (gchar *, n_files + 1);
-
- for (ii = 0; ii < n_files; ii++)
- uris[ii] = g_file_get_uri (files[ii]);
-
- e_shell_handle_uris (shell, uris, FALSE);
-
- g_strfreev (uris);
-}
-
-static void
shell_quit_mainloop (GApplication *application)
{
/* XXX Don't allow GApplication to quit the main loop.
@@ -878,7 +876,6 @@ e_shell_class_init (EShellClass *class)
application_class = G_APPLICATION_CLASS (class);
application_class->startup = shell_startup;
application_class->activate = shell_activate;
- application_class->open = shell_open;
application_class->quit_mainloop = shell_quit_mainloop;
class->window_destroyed = shell_window_destroyed;
@@ -1516,7 +1513,7 @@ remote: /* Send a message to the other Evolution process. */
if (view_name != NULL) {
g_action_group_activate_action (
- shell->priv->action_group, "new-window",
+ G_ACTION_GROUP (shell), "new-window",
g_variant_new_string (view_name));
} else
g_application_activate (G_APPLICATION (shell));
@@ -1536,12 +1533,11 @@ remote: /* Send a message to the other Evolution process. */
**/
guint
e_shell_handle_uris (EShell *shell,
- gchar **uris,
+ const gchar * const *uris,
gboolean do_import)
{
- GFile **files;
guint n_handled = 0;
- guint length, ii;
+ guint ii;
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
g_return_val_if_fail (uris != NULL, FALSE);
@@ -1569,21 +1565,13 @@ e_shell_handle_uris (EShell *shell,
remote: /* Send a message to the other Evolution process. */
- length = g_strv_length (uris);
-
- files = g_new0 (GFile *, length + 1);
- for (ii = 0; ii < length; ii++)
- files[ii] = g_file_new_for_uri (uris[ii]);
-
- g_application_open (G_APPLICATION (shell), files, length, "");
-
- for (ii = 0; ii < length; ii++)
- g_object_unref (files[ii]);
- g_free (files);
+ g_action_group_activate_action (
+ G_ACTION_GROUP (shell), "handle-uris",
+ g_variant_new_strv (uris, -1));
/* As far as we're concerned, all URIs have been handled. */
- return length;
+ return g_strv_length ((gchar **) uris);
}
/**
@@ -1995,7 +1983,7 @@ e_shell_quit (EShell *shell,
remote: /* Send a message to the other Evolution process. */
g_action_group_activate_action (
- shell->priv->action_group, "quit", NULL);
+ G_ACTION_GROUP (shell), "quit", NULL);
return TRUE;
}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index bbb11467fc..ede071e2e3 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -126,7 +126,7 @@ GConfClient * e_shell_get_gconf_client (EShell *shell);
GtkWidget * e_shell_create_shell_window (EShell *shell,
const gchar *view_name);
guint e_shell_handle_uris (EShell *shell,
- gchar **uris,
+ const gchar * const *uris,
gboolean do_import);
void e_shell_submit_alert (EShell *shell,
EAlert *alert);
diff --git a/shell/main.c b/shell/main.c
index e1b768187d..95dc1b9ff4 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -246,7 +246,7 @@ show_development_warning (void)
/* This is for doing stuff that requires the GTK+ loop to be running already. */
static gboolean
-idle_cb (gchar **uris)
+idle_cb (const gchar * const *uris)
{
EShell *shell;
diff --git a/widgets/misc/e-import-assistant.c b/widgets/misc/e-import-assistant.c
index 521e8fb76b..5d612a9de7 100644
--- a/widgets/misc/e-import-assistant.c
+++ b/widgets/misc/e-import-assistant.c
@@ -984,7 +984,8 @@ forward_cb (gint current_page,
}
static gboolean
-set_import_uris (EImportAssistant *assistant, gchar **uris)
+set_import_uris (EImportAssistant *assistant,
+ const gchar * const *uris)
{
EImportAssistantPrivate *priv;
GPtrArray *fileuris = NULL;
@@ -998,12 +999,12 @@ set_import_uris (EImportAssistant *assistant, gchar **uris)
priv = E_IMPORT_ASSISTANT (assistant)->priv;
for (i = 0; uris[i]; i++) {
- gchar *uri = uris[i];
+ const gchar *uri = uris[i];
gchar *filename;
filename = g_filename_from_uri (uri, NULL, NULL);
if (!filename)
- filename = uri;
+ filename = g_strdup (uri);
if (filename && *filename && g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
gchar *furi;
@@ -1015,9 +1016,7 @@ set_import_uris (EImportAssistant *assistant, gchar **uris)
tmp = g_build_filename (curr, filename, NULL);
g_free (curr);
- if (filename != uri)
- g_free (filename);
-
+ g_free (filename);
filename = tmp;
}
@@ -1041,8 +1040,7 @@ set_import_uris (EImportAssistant *assistant, gchar **uris)
g_free (furi);
if (fileuris == NULL) {
- if (filename != uri)
- g_free (filename);
+ g_free (filename);
break;
}
}
@@ -1052,8 +1050,7 @@ set_import_uris (EImportAssistant *assistant, gchar **uris)
g_ptr_array_add (fileuris, furi);
}
- if (filename != uri)
- g_free (filename);
+ g_free (filename);
}
if (fileuris != NULL) {
@@ -1394,7 +1391,7 @@ e_import_assistant_new (GtkWindow *parent)
*/
GtkWidget *
e_import_assistant_new_simple (GtkWindow *parent,
- gchar **uris)
+ const gchar * const *uris)
{
GtkWidget *assistant;
diff --git a/widgets/misc/e-import-assistant.h b/widgets/misc/e-import-assistant.h
index c0675c75f8..e120844dfd 100644
--- a/widgets/misc/e-import-assistant.h
+++ b/widgets/misc/e-import-assistant.h
@@ -61,7 +61,7 @@ struct _EImportAssistantClass {
GType e_import_assistant_get_type (void);
GtkWidget * e_import_assistant_new (GtkWindow *parent);
GtkWidget * e_import_assistant_new_simple (GtkWindow *parent,
- gchar **uris);
+ const gchar * const *uris);
G_END_DECLS