mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-13 16:07:36 +00:00
application: Don't show application window if started as daemon
If calls was already running as a daemon it and were invoked again with `--daemon` it ended up showing the UI. Now we always set the `daemon` variable and simplify activation logic as a side effect. Fixes #500
This commit is contained in:
parent
3badf72725
commit
c3c315d8e7
1 changed files with 10 additions and 18 deletions
|
@ -186,16 +186,12 @@ set_daemon_action (GSimpleAction *action,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CallsApplication *self = CALLS_APPLICATION (user_data);
|
CallsApplication *self = CALLS_APPLICATION (user_data);
|
||||||
|
gboolean daemon = g_variant_get_boolean (parameter);
|
||||||
|
|
||||||
if (self->main_window) {
|
self->daemon = daemon;
|
||||||
g_warning ("Cannot set application as a daemon"
|
|
||||||
" because application is already started");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self->daemon = TRUE;
|
g_debug ("Application %smarked as daemon",
|
||||||
|
daemon ? "" : "not ");
|
||||||
g_debug ("Application marked as daemon");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,7 +386,7 @@ static const GActionEntry actions[] =
|
||||||
{
|
{
|
||||||
{ "set-provider-names", set_provider_names_action, "as" },
|
{ "set-provider-names", set_provider_names_action, "as" },
|
||||||
{ "set-default-providers", set_default_providers_action, NULL },
|
{ "set-default-providers", set_default_providers_action, NULL },
|
||||||
{ "set-daemon", set_daemon_action, NULL },
|
{ "set-daemon", set_daemon_action, "b" },
|
||||||
{ "dial", dial_action, "s" },
|
{ "dial", dial_action, "s" },
|
||||||
{ "copy-number", copy_number, "s" },
|
{ "copy-number", copy_number, "s" },
|
||||||
/* TODO About dialog { "about", show_about, NULL}, */
|
/* TODO About dialog { "about", show_about, NULL}, */
|
||||||
|
@ -484,9 +480,9 @@ calls_application_command_line (GApplication *application,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_variant_dict_contains (options, "daemon"))
|
|
||||||
g_action_group_activate_action (G_ACTION_GROUP (application),
|
g_action_group_activate_action (G_ACTION_GROUP (application),
|
||||||
"set-daemon", NULL);
|
"set-daemon",
|
||||||
|
g_variant_new_boolean (g_variant_dict_contains (options, "daemon")));
|
||||||
|
|
||||||
if (g_variant_dict_lookup (options, "dial", "&s", &arg))
|
if (g_variant_dict_lookup (options, "dial", "&s", &arg))
|
||||||
g_action_group_activate_action (G_ACTION_GROUP (application),
|
g_action_group_activate_action (G_ACTION_GROUP (application),
|
||||||
|
@ -577,12 +573,8 @@ activate (GApplication *application)
|
||||||
|
|
||||||
g_debug ("Activated");
|
g_debug ("Activated");
|
||||||
|
|
||||||
if (self->main_window) {
|
|
||||||
present = TRUE;
|
|
||||||
} else {
|
|
||||||
start_proper (self);
|
start_proper (self);
|
||||||
present = !self->daemon;
|
present = !self->daemon;
|
||||||
}
|
|
||||||
|
|
||||||
if (present || self->uri) {
|
if (present || self->uri) {
|
||||||
gtk_window_present (GTK_WINDOW (self->main_window));
|
gtk_window_present (GTK_WINDOW (self->main_window));
|
||||||
|
|
Loading…
Reference in a new issue