[gnome-nibbles] Get rid of special handling for GTK+ and Clutter command line options



commit b837f935fc887289603fc4e9c812bd6344c5d7f8
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Feb 14 23:10:08 2016 -0600

    Get rid of special handling for GTK+ and Clutter command line options
    
    Nowadays the best practice is to ignore GTK+ command line options and
    just use environment variables instead. (This is what GtkApplication
    does; it doesn't actually pass any of the options to gtk_init. It's a
    bit buggy, though, as the options still appear in help for some reason,
    but that's not our fault.)
    
    Treat the Clutter options the same way. If these options provide any
    functionality not accessible via environment variables, Clutter should
    be enhanced.
    
    Accordingly, move this functionality out of main, and into startup()
    where it really belongs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762054

 src/gnome-nibbles.vala |   38 +++++++++-----------------------------
 1 files changed, 9 insertions(+), 29 deletions(-)
---
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index f0ae863..dc388f4 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -106,7 +106,7 @@ public class Nibbles : Gtk.Application
     public Nibbles ()
     {
         Object (application_id: "org.gnome.nibbles", flags: ApplicationFlags.FLAGS_NONE);
-        Environment.set_prgname ("org.gnome.Nibbles");
+
         add_main_option_entries (option_entries);
     }
 
@@ -127,6 +127,14 @@ public class Nibbles : Gtk.Application
     {
         base.startup ();
 
+        unowned string[]? argv = null;
+        GtkClutter.init (ref argv);
+
+        Environment.set_prgname ("org.gnome.Nibbles");
+        Environment.set_application_name (_("Nibbles"));
+
+        Gtk.Window.set_default_icon_name ("gnome-nibbles");
+
         Gtk.Settings.get_default ().set ("gtk-application-prefer-dark-theme", true);
 
         var css_provider = new Gtk.CssProvider ();
@@ -1030,34 +1038,6 @@ public class Nibbles : Gtk.Application
         Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
         Intl.textdomain (GETTEXT_PACKAGE);
 
-        var context = new OptionContext ("");
-
-        context.add_group (Gtk.get_option_group (false));
-        context.add_group (Clutter.get_option_group_without_init ());
-
-        try
-        {
-            context.parse (ref args);
-        }
-        catch (Error e)
-        {
-            stderr.printf ("%s\n", e.message);
-            return Posix.EXIT_FAILURE;
-        }
-
-        Environment.set_application_name (_("Nibbles"));
-
-        Gtk.Window.set_default_icon_name ("gnome-nibbles");
-
-        try
-        {
-            GtkClutter.init_with_args (ref args, "", new OptionEntry[0], null);
-        }
-        catch (Error e)
-        {
-            error ("Unable to initialize Clutter: %s", e.message);
-        }
-
         return new Nibbles ().run (args);
     }
 }


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