Commit b837f935 authored by Michael Catanzaro's avatar Michael Catanzaro Committed by Iulian Radu

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
parent 1040df09
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment