[gedit/wip/gtkapp: 174/197] Handle local command line
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/gtkapp: 174/197] Handle local command line
- Date: Mon, 5 Nov 2012 15:28:52 +0000 (UTC)
commit 717350136c72a61ef7f27b67c933ce808d61c2a0
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Jul 30 11:33:43 2012 +0200
Handle local command line
gedit/gedit-app.c | 34 ++++++++++++++++++++++++++++++++++
gedit/gedit.c | 18 ------------------
2 files changed, 34 insertions(+), 18 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 9f1967b..ffe0a29 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -301,6 +301,39 @@ gedit_app_command_line (GApplication *application,
}
static gboolean
+gedit_app_local_command_line (GApplication *application,
+ gchar ***arguments,
+ gint *exit_status)
+{
+ gint i, j;
+ gchar **argv;
+
+ argv = *arguments;
+ g_message ("local command line");
+
+ i = 1;
+ while (argv[i])
+ {
+ if (strcmp (argv[i], "-s") == 0)
+ {
+ GApplicationFlags old_flags;
+
+ old_flags = g_application_get_flags (application);
+ g_application_set_flags (application, old_flags | G_APPLICATION_NON_UNIQUE);
+ g_free (argv[i]);
+ for (j = i; argv[j]; j++)
+ {
+ argv[j] = argv[j + 1];
+ }
+ }
+ }
+
+ *exit_status = 0;
+
+ return FALSE;
+}
+
+static gboolean
ensure_user_config_dir (void)
{
const gchar *config_dir;
@@ -601,6 +634,7 @@ gedit_app_class_init (GeditAppClass *klass)
app_class->startup = gedit_app_startup;
app_class->activate = gedit_app_activate;
app_class->command_line = gedit_app_command_line;
+ app_class->local_command_line = gedit_app_local_command_line;
app_class->shutdown = gedit_app_shutdown;
klass->last_window_destroyed = gedit_app_last_window_destroyed_impl;
diff --git a/gedit/gedit.c b/gedit/gedit.c
index 5956718..7cfdacc 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -87,24 +87,6 @@ main (int argc, char *argv[])
g_free (metadata_filename);
#endif
- /* FIXME: This is needed if not we get a crash building with introspection */
-#ifdef ENABLE_INTROSPECTION
- GOptionContext *context;
- GError *error = NULL;
-
- context = g_option_context_new (_("- Edit text files"));
- g_option_context_add_group (context, g_irepository_get_option_group ());
- if (!g_option_context_parse (context, &argc, &argv, &error))
- {
- g_print(_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
- error->message, argv[0]);
-
- g_error_free (error);
- return 1;
- }
- g_option_context_free (context);
-#endif
-
/* Init plugins en thegine */
gedit_debug_message (DEBUG_APP, "Init plugins");
engine = gedit_plugins_engine_get_default ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]