[epiphany] ephy-shell: Don't interpret null arguments as empty string when adding platform data
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-shell: Don't interpret null arguments as empty string when adding platform data
- Date: Fri, 14 Feb 2020 20:28:49 +0000 (UTC)
commit 0c8e3369916bbdb013f8a492ef2020bf227150a6
Author: Yetizone <andreii lisita gmail com>
Date: Thu Feb 13 20:22:53 2020 +0200
ephy-shell: Don't interpret null arguments as empty string when adding platform data
This caused an inconsistency in ephy_startup_continue():
ctx->arguments would be null when the primary instance was launched and
not null when a secondary instance was launched (in both cases the instance
would be launched without arguments in the CLI, hence the inconsistency).
src/ephy-shell.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 98babe02c..e48b9a9a7 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -117,11 +117,24 @@ ephy_shell_startup_continue (EphyShell *shell,
EphyShellStartupContext *ctx)
{
EphySession *session = ephy_shell_get_session (shell);
+ gboolean new_window_option = (ctx->startup_mode == EPHY_STARTUP_NEW_WINDOW);
if (ctx->session_filename != NULL) {
g_assert (session != NULL);
ephy_session_load (session, (const char *)ctx->session_filename,
ctx->user_time, NULL, NULL, NULL);
+ } else if (new_window_option) {
+ static const char *default_uris[] = { "", NULL };
+ const char **uris = NULL;
+
+ if (ctx->arguments)
+ uris = (const char **)ctx->arguments;
+ else
+ /* If there are no URLs passed in arguments but the --new-window option */
+ /* has been used, then use the default_uris list to open the homepage */
+ uris = default_uris;
+
+ ephy_shell_open_uris (shell, uris, ctx->startup_mode, ctx->user_time);
} else if (ctx->arguments || !session) {
/* Don't queue any window openings if no extra arguments given, */
/* since session autoresume will open one for us. */
@@ -531,8 +544,6 @@ ephy_shell_add_platform_data (GApplication *application,
EphyShell *app;
EphyShellStartupContext *ctx;
GVariantBuilder *ctx_builder;
- static const char *empty_arguments[] = { "", NULL };
- const char * const *arguments;
app = EPHY_SHELL (application);
@@ -562,13 +573,9 @@ ephy_shell_add_platform_data (GApplication *application,
* the primary instance opens a new window.
*/
if (ctx->arguments)
- arguments = (const gchar * const *)ctx->arguments;
- else
- arguments = empty_arguments;
-
- g_variant_builder_add (ctx_builder, "{iv}",
- CTX_ARGUMENTS,
- g_variant_new_strv (arguments, -1));
+ g_variant_builder_add (ctx_builder, "{iv}",
+ CTX_ARGUMENTS,
+ g_variant_new_strv ((const char **)ctx->arguments, -1));
g_variant_builder_add (ctx_builder, "{iv}",
CTX_USER_TIME,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]