From b1400db36231485bef300245dcc9947b971595aa Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 30 Jul 2012 17:59:30 +0200 Subject: [PATCH] Show a status icon when inhibition is enabled --- data/display-blanking-status.png | Bin 0 -> 387 bytes debian/install | 1 + src/lib-display-blanking-status-menu-widget.c | 29 ++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 data/display-blanking-status.png diff --git a/data/display-blanking-status.png b/data/display-blanking-status.png new file mode 100644 index 0000000000000000000000000000000000000000..252b3520c6a92d7fb6f9599c815ac9349f67d018 GIT binary patch literal 387 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|wj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwIU5?+>e3#s+Ge9B964!_l=ltB<)VvY~=c3falGGH1 z^30M91$R&1fbd2>aiF5to-U3d7N^%Y|y) zQoNF)@1Oj`byzqwzsZuMQR+bjMq zeuAq1aSva^AFslDo`pPDP~LI0Wj5<+?R)EH^0!Xvxj5yly11tN(K4-O<73aJo@RZ2 b?u0m7QB$DP;_4efZ!>th`njxgN@xNAGEinhibit_timer_id)); + hd_status_plugin_item_set_status_area_icon ( + HD_STATUS_PLUGIN_ITEM (priv->plugin), NULL); +} + static gboolean on_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) { @@ -171,7 +181,7 @@ 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; @@ -188,12 +198,18 @@ on_timed_inhibit_timeout (DisplayBlankingStatusPluginPrivate *priv) } 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 @@ -224,13 +240,13 @@ on_inhibit_button_clicked (GtkWidget *button, 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); @@ -362,7 +378,7 @@ on_timed_inhibit_button_clicked (GtkWidget *button, 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); @@ -378,7 +394,7 @@ on_timed_inhibit_button_clicked (GtkWidget *button, else { // !self_pressed g_assert (!other_pressed); - disable_timer (&(priv->inhibit_timer_id)); + disable_inhibition (priv); disable_timer (&(priv->timed_inhibit_timer_id)); } } @@ -578,6 +594,7 @@ display_blanking_status_plugin_init (DisplayBlankingStatusPlugin *plugin) priv = DISPLAY_BLANKING_STATUS_PLUGIN_GET_PRIVATE (plugin); plugin->priv = priv; + priv->plugin = plugin; init_gconf (priv); init_dbus (priv); -- 2.43.0