Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2
gnome-power-manager
gnome-power-manager-ck-events-idle.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-power-manager-ck-events-idle.patch of Package gnome-power-manager
Index: gnome-power-manager-2.28.0/src/egg-console-kit.c =================================================================== --- gnome-power-manager-2.28.0.orig/src/egg-console-kit.c +++ gnome-power-manager-2.28.0/src/egg-console-kit.c @@ -50,6 +50,9 @@ struct EggConsoleKitPrivate DBusGProxy *proxy_manager; DBusGProxy *proxy_session; gchar *session_id; + guint emit_changed_id; + gboolean last_emitted_active; + gboolean last_changed_active; }; enum { @@ -231,13 +234,37 @@ out: } /** + * egg_console_kit_emit_active_changed_cb: + **/ +static gboolean +egg_console_kit_emit_active_changed_cb (EggConsoleKit *console) +{ + egg_debug ("emitting active: %i", console->priv->last_changed_active); + g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, console->priv->last_changed_active); + console->priv->last_emitted_active = console->priv->last_changed_active; + console->priv->emit_changed_id = 0; + return FALSE; +} + +/** * egg_console_kit_active_changed_cb: **/ static void egg_console_kit_active_changed_cb (DBusGProxy *proxy, gboolean active, EggConsoleKit *console) { - egg_debug ("emitting active: %i", active); - g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, active); + if (console->priv->emit_changed_id != 0) { + g_source_remove (console->priv->emit_changed_id); + console->priv->emit_changed_id = 0; + } + + if (console->priv->last_emitted_active == active) { + egg_debug ("ignoring active (same value as last emitted): %i", active); + return; + } + + egg_debug ("queuing active: %i", active); + console->priv->last_changed_active = active; + console->priv->emit_changed_id = g_idle_add ((GSourceFunc) egg_console_kit_emit_active_changed_cb, console); } /** @@ -271,6 +298,8 @@ egg_console_kit_init (EggConsoleKit *con console->priv = EGG_CONSOLE_KIT_GET_PRIVATE (console); console->priv->proxy_manager = NULL; console->priv->session_id = NULL; + console->priv->emit_changed_id = 0; + console->priv->last_changed_active = FALSE; /* connect to D-Bus */ console->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); @@ -315,6 +344,8 @@ egg_console_kit_init (EggConsoleKit *con dbus_g_proxy_connect_signal (console->priv->proxy_session, "ActiveChanged", G_CALLBACK (egg_console_kit_active_changed_cb), console, NULL); + console->priv->last_emitted_active = egg_console_kit_is_active (console); + out: return; } @@ -338,6 +369,8 @@ egg_console_kit_finalize (GObject *objec if (console->priv->proxy_session != NULL) g_object_unref (console->priv->proxy_session); g_free (console->priv->session_id); + if (console->priv->emit_changed_id != 0) + g_source_remove (console->priv->emit_changed_id); G_OBJECT_CLASS (egg_console_kit_parent_class)->finalize (object); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor