[gnome-font-viewer] font-view: use GApplication commandline handling



commit acf919c43cf0e7700aaf05931f424843ce4b29dd
Author: Allison Ryan Lortie <desrt desrt ca>
Date:   Mon Apr 25 09:44:35 2016 +0200

    font-view: use GApplication commandline handling
    
    Use GApplication's internal handling of commandline arguments.  This
    means that --gapplication-service (which we depend on for DBus
    activation) will be properly supported.
    
    The only reason this was working before is because we were not actually
    being D-Bus activated due to having a '-' in our app id.  With the fix
    of bug 764754 this is no longer the case, and gnome-font-viewer will be
    broken.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765518

 src/font-view.c |   22 +---------------------
 1 files changed, 1 insertions(+), 21 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index 97fdc90..8a30f2d 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -919,7 +919,6 @@ main (int argc,
     GApplication *app;
     gint retval;
     GError *error = NULL;
-    GOptionContext *ctx;
 
     bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
     bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -928,27 +927,8 @@ main (int argc,
     if (!FcInit ())
         g_critical ("Can't initialize fontconfig library");
 
-    ctx = g_option_context_new (_("[FILE...]"));
-    g_option_context_add_main_entries (ctx, goption_options, PACKAGE);
-    g_option_context_add_group (ctx, gtk_get_option_group (FALSE));
-
-    if (!g_option_context_parse (ctx, &argc, &argv, &error)) {
-        gchar *help_msg;
-
-        /* I18N: The '%s' is replaced with the command name. */
-        help_msg = g_strdup_printf (_("Run '%s --help' to see a full "
-                                      "list of available command line "
-                                      "options."), argv[0]);
-        g_printerr ("%s\n%s\n", error->message, help_msg);
-        g_error_free (error);
-        g_free (help_msg);
-        g_option_context_free (ctx);
-
-        return EXIT_FAILURE;
-    }
-    g_option_context_free (ctx);
-
     app = font_view_application_new ();
+    g_application_add_main_option_entries (app, goption_options);
     retval = g_application_run (app, argc, argv);
 
     g_object_unref (app);


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