[epiphany] Add search command line option



commit 7901005e6d8521c260f4af46eff5a3fe3e3f6425
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sun May 31 15:35:27 2020 +0200

    Add search command line option
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/630

 src/ephy-main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 8466c6c1a..2c478d181 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include "ephy-debug.h"
+#include "ephy-embed-utils.h"
 #include "ephy-file-helpers.h"
 #include "ephy-profile-utils.h"
 #include "ephy-session.h"
@@ -55,6 +56,7 @@ static gboolean application_mode = FALSE;
 static gboolean automation_mode = FALSE;
 static char *desktop_file_basename = NULL;
 static char *profile_directory = NULL;
+static char *search_term = NULL;
 
 static EphyShell *ephy_shell = NULL;
 static int shutdown_signum = 0;
@@ -127,6 +129,7 @@ static const GOptionEntry option_entries[] = {
     G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
   { "delete-application", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING,
     &application_to_delete, NULL, NULL },
+  { "search", 0, 0, G_OPTION_ARG_STRING, &search_term, NULL, NULL},
   { NULL }
 };
 
@@ -410,6 +413,13 @@ main (int   argc,
 
   _ephy_shell_create_instance (mode);
 
+  if (search_term) {
+    int current_len = arguments ? g_strv_length (arguments) : 0;
+    arguments = g_realloc (arguments, current_len + 1 * sizeof (char *));
+    arguments[current_len] = ephy_embed_utils_autosearch_address (search_term);
+    g_clear_pointer (&search_term, g_free);
+  }
+
   ctx = ephy_shell_startup_context_new (open_in_new_window ? EPHY_STARTUP_NEW_WINDOW : EPHY_STARTUP_NEW_TAB,
                                         session_filename,
                                         arguments,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]