Skip to content

Commit

Permalink
Remove exit-on-idle functionality
Browse files Browse the repository at this point in the history
- This inherently relies on the daemon being activated via D-Bus, which
is problematic for the reasons explained in the previous commit and here:

http://git.gnome.org/browse/notification-daemon/commit/?id=a3f8902
  • Loading branch information
raveit65 committed Aug 8, 2023
1 parent 7ed5a9e commit 8a02eb9
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/daemon/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ struct _NotifyDaemon {
GSettings* gsettings;
guint next_id;
guint timeout_source;
guint exit_timeout_source;
GHashTable* idle_reposition_notify_ids;
GHashTable* monitored_window_hash;
GHashTable* notification_hash;
Expand Down Expand Up @@ -253,33 +252,6 @@ static void _notify_timeout_destroy(NotifyTimeout* nt)
g_free(nt);
}

static gboolean do_exit(gpointer user_data)
{
exit(0);
return FALSE;
}

static void add_exit_timeout(NotifyDaemon* daemon)
{
g_assert (daemon != NULL);

if (daemon->exit_timeout_source > 0)
return;

daemon->exit_timeout_source = g_timeout_add_seconds(IDLE_SECONDS, do_exit, NULL);
}

static void remove_exit_timeout(NotifyDaemon* daemon)
{
g_assert (daemon != NULL);

if (daemon->exit_timeout_source == 0)
return;

g_source_remove(daemon->exit_timeout_source);
daemon->exit_timeout_source = 0;
}

static int
_gtk_get_monitor_num (GdkMonitor *monitor)
{
Expand Down Expand Up @@ -470,8 +442,6 @@ static void notify_daemon_init(NotifyDaemon* daemon)
daemon->timeout_source = 0;
daemon->skeleton = notify_daemon_notifications_skeleton_new ();

add_exit_timeout(daemon);

daemon->gsettings = g_settings_new (GSETTINGS_SCHEMA);

g_signal_connect (daemon->gsettings, "changed::" GSETTINGS_KEY_POPUP_LOCATION, G_CALLBACK (on_popup_location_changed), daemon);
Expand Down Expand Up @@ -546,8 +516,6 @@ static void notify_daemon_finalize(GObject* object)
g_clear_object (&daemon->skeleton);
}

remove_exit_timeout(daemon);

g_hash_table_destroy(daemon->monitored_window_hash);
g_hash_table_destroy(daemon->idle_reposition_notify_ids);
g_hash_table_destroy(daemon->notification_hash);
Expand Down Expand Up @@ -628,10 +596,6 @@ static void _close_notification(NotifyDaemon* daemon, guint id, gboolean hide_no

g_hash_table_remove(daemon->notification_hash, &id);

if (g_hash_table_size(daemon->notification_hash) == 0)
{
add_exit_timeout(daemon);
}
}
}

Expand Down Expand Up @@ -832,10 +796,6 @@ static gboolean _check_expiration(NotifyDaemon* daemon)
{
daemon->timeout_source = 0;

if (g_hash_table_size (daemon->notification_hash) == 0)
{
add_exit_timeout(daemon);
}
}

return has_more_timeouts;
Expand Down Expand Up @@ -914,7 +874,6 @@ static NotifyTimeout* _store_notification(NotifyDaemon* daemon, GtkWindow* nw, i
#else
g_hash_table_insert(daemon->notification_hash, g_memdup(&id, sizeof(guint)), nt);
#endif
remove_exit_timeout(daemon);

return nt;
}
Expand Down

0 comments on commit 8a02eb9

Please sign in to comment.