application: Validate daemon flag only on first startup

The activate method is used when the application is activated via
various means - e.g. via the `Activate` DBus method. We don't want to
ignore that activation just because calls was started with the
`--daemon` option. Rename the variable to better match what it means.

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/760>
This commit is contained in:
Guido Günther
2024-09-17 08:32:03 +02:00
committed by Evangelos Ribeiro Tzaras
parent 0c3adf840b
commit fbfe680f6a

View File

@@ -60,7 +60,7 @@
struct _CallsApplication {
AdwApplication parent_instance;
gboolean daemon;
gboolean ignore_activation;
CallsRinger *ringer;
CallsNotifier *notifier;
CallsRecordStore *record_store;
@@ -247,12 +247,9 @@ set_daemon_action (GSimpleAction *action,
gpointer user_data)
{
CallsApplication *self = CALLS_APPLICATION (user_data);
gboolean daemon = g_variant_get_boolean (parameter);
self->daemon = daemon;
g_debug ("Application %smarked as daemon",
daemon ? "" : "not ");
self->ignore_activation = g_variant_get_boolean (parameter);
g_debug ("Application ignores activation: %d", self->ignore_activation);
}
@@ -700,14 +697,12 @@ static void
activate (GApplication *application)
{
CallsApplication *self = CALLS_APPLICATION (application);
gboolean present;
g_debug ("Activated");
start_proper (self);
present = !self->daemon;
if (present || self->uri) {
if (!self->ignore_activation || self->uri) {
gtk_window_present (GTK_WINDOW (self->main_window));
}
@@ -721,6 +716,7 @@ activate (GApplication *application)
}
g_clear_pointer (&self->uri, g_free);
self->ignore_activation = FALSE;
}