[gedit] gedit-app: use g_option_context_parse_strv()
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] gedit-app: use g_option_context_parse_strv()
- Date: Sat, 11 Jan 2014 05:48:37 +0000 (UTC)
commit 0e82694a539de3017aa62e09cf32f4016f3df465
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jan 10 12:45:46 2014 -0500
gedit-app: use g_option_context_parse_strv()
Instead of our own function to do (almost) the same.
https://bugzilla.gnome.org/show_bug.cgi?id=721947
gedit/gedit-app.c | 31 ++-----------------------------
1 files changed, 2 insertions(+), 29 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 2c0b031..6d9a399 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -786,33 +786,6 @@ get_option_context (void)
return context;
}
-static gboolean
-option_context_parse (GOptionContext *context,
- gchar **arguments,
- GError **error)
-{
- gint argc;
- gchar **argv;
- gint i;
- gboolean ret;
-
- /* We have to make an extra copy of the array, since g_option_context_parse()
- * assumes that it can remove strings from the array without freeing them.
- */
- argc = g_strv_length (arguments);
- argv = g_new (gchar *, argc);
- for (i = 0; i < argc; i++)
- {
- argv[i] = arguments[i];
- }
-
- ret = g_option_context_parse (context, &argc, &argv, error);
-
- g_free (argv);
-
- return ret;
-}
-
static void
clear_options (void)
{
@@ -879,7 +852,7 @@ gedit_app_command_line (GApplication *application,
/* Avoid exit() on the main instance */
g_option_context_set_help_enabled (context, FALSE);
- if (!option_context_parse (context, arguments, &error))
+ if (!g_option_context_parse_strv (context, &arguments, &error))
{
/* We should never get here since parsing would have
* failed on the client side... */
@@ -972,7 +945,7 @@ gedit_app_local_command_line (GApplication *application,
/* Handle some of the option without contacting the main instance */
context = get_option_context ();
- if (!option_context_parse (context, *arguments, &error))
+ if (!g_option_context_parse_strv (context, arguments, &error))
{
g_printerr (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
error->message, (*arguments)[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]