application: Add --quit commandline argument

Overview: Clicking the close button in gnome-calendar doesn't always close all the instances of the application. The window is closed, but an instance of gnome-calendar is still running as a gapplication-service, which was probably run by gnome-shell search provider.

The two changes made were as follows:

1) added the argument quit to GOptionEntry
2) added the definition of quit to gcal_application_command_line
This commit is contained in:
Akbar Hashmi
2017-12-19 07:41:40 +05:30
parent b8f51e1d3d
commit 4048296314
+11
View File
@@ -84,6 +84,11 @@ G_DEFINE_TYPE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
static gboolean show_version = FALSE;
static GOptionEntry gcal_application_goptions[] = {
{
"quit", 'q', 0,
G_OPTION_ARG_NONE, NULL,
N_("Quit GNOME Calendar"), NULL
},
{
"version", 'v', 0,
G_OPTION_ARG_NONE, &show_version,
@@ -297,6 +302,12 @@ gcal_application_command_line (GApplication *app,
self = GCAL_APPLICATION (app);
options = g_application_command_line_get_options_dict (command_line);
if (g_variant_dict_contains (options, "quit"))
{
g_application_quit (app);
return 0;
}
if (g_variant_dict_contains (options, "debug"))
gcal_log_init ();