};
#define INHIBIT_ICON_NAME "display-blanking-inhibit-icon"
#define TIMED_INHIBIT_ICON_NAME "display-blanking-inhibit-icon.timed"
+#define INHIBIT_STATUS_ICON_NAME "display-blanking-status"
struct _DisplayBlankingStatusPluginPrivate
{
+ DisplayBlankingStatusPlugin* plugin;
GConfClient *gconf_client;
DBusConnection* dbus_conn;
DBusMessage* dbus_msg;
*timer_id = 0;
}
+static void
+disable_inhibition (DisplayBlankingStatusPluginPrivate *priv)
+{
+ disable_timer (&(priv->inhibit_timer_id));
+ hd_status_plugin_item_set_status_area_icon (
+ HD_STATUS_PLUGIN_ITEM (priv->plugin), NULL);
+}
+
static gboolean
on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv)
{
static gboolean
on_timed_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv)
{
- disable_timer (&(priv->inhibit_timer_id));
+ disable_inhibition (priv);
disable_timer (&(priv->timed_inhibit_timer_id));
priv->inhibit_in_signal = TRUE;
}
static void
-enable_inhibit_timer (DisplayBlankingStatusPluginPrivate *priv)
+enable_inhibition (DisplayBlankingStatusPluginPrivate *priv)
{
g_assert (priv->inhibit_timer_id == 0);
priv->inhibit_timer_id = g_timeout_add_seconds (INHIBIT_MSG_INTERVAL,
(GSourceFunc) on_inhibit_timeout, priv);
g_assert (priv->inhibit_timer_id > 0);
+
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+ GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (icon_theme,
+ INHIBIT_STATUS_ICON_NAME, 18, GTK_ICON_LOOKUP_NO_SVG, NULL);
+ hd_status_plugin_item_set_status_area_icon (
+ HD_STATUS_PLUGIN_ITEM (priv->plugin), pixbuf);
}
static void
else if (self_pressed && !other_pressed) {
g_assert (priv->timed_inhibit_timer_id == 0);
- enable_inhibit_timer (priv);
+ enable_inhibition (priv);
}
else if (!self_pressed) {
g_assert (!other_pressed);
g_assert (priv->timed_inhibit_timer_id == 0);
- disable_timer (&(priv->inhibit_timer_id));
+ disable_inhibition (priv);
}
else
g_assert (FALSE);
priv->inhibit_in_signal = FALSE;
}
else
- enable_inhibit_timer (priv);
+ enable_inhibition (priv);
priv->timed_inhibit_timer_id = g_timeout_add_seconds (timeout,
(GSourceFunc) on_timed_inhibit_timeout, priv);
else { // !self_pressed
g_assert (!other_pressed);
- disable_timer (&(priv->inhibit_timer_id));
+ disable_inhibition (priv);
disable_timer (&(priv->timed_inhibit_timer_id));
}
}
priv = DISPLAY_BLANKING_STATUS_PLUGIN_GET_PRIVATE (plugin);
plugin->priv = priv;
+ priv->plugin = plugin;
init_gconf (priv);
init_dbus (priv);