[gnome-settings-daemon] media-keys: Also draw the label for custom OSD actions



commit 373418552643353ad495a7a9497ba0505a7e805d
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jan 12 21:56:01 2013 +0100

    media-keys: Also draw the label for custom OSD actions

 plugins/media-keys/gsd-media-keys-manager.c |   10 ++++++++++
 plugins/media-keys/gsd-osd-window.c         |    7 +++++--
 plugins/media-keys/test-media-window.c      |    1 +
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index c64e0d0..8c4e1c5 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -829,6 +829,8 @@ do_eject_action (GsdMediaKeysManager *manager)
 
         /* Show the dialogue */
         dialog_init (manager);
+        gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (manager->priv->dialog),
+                                         NULL);
         gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog),
                                                  "media-eject-symbolic",
                                                  FALSE);
@@ -912,6 +914,8 @@ static void
 do_touchpad_osd_action (GsdMediaKeysManager *manager, gboolean state)
 {
         dialog_init (manager);
+        gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (manager->priv->dialog),
+                                         NULL);
         gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog),
                                                  state ? "input-touchpad-symbolic" : "touchpad-disabled-symbolic",
                                                  FALSE);
@@ -1389,6 +1393,8 @@ gsd_media_player_key_pressed (GsdMediaKeysManager *manager,
         if (!have_listeners) {
                 /* Popup a dialog with an (/) icon */
                 dialog_init (manager);
+                gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (manager->priv->dialog),
+                                                 NULL);
                 gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog),
                                                          "action-unavailable-symbolic",
                                                          FALSE);
@@ -1716,6 +1722,8 @@ update_screen_cb (GObject             *source_object,
         /* update the dialog with the new value */
         g_variant_get (new_percentage, "(u)", &percentage);
         dialog_init (manager);
+        gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (manager->priv->dialog),
+                                         NULL);
         gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog),
                                                  "display-brightness-symbolic",
                                                  TRUE);
@@ -1768,6 +1776,8 @@ update_keyboard_cb (GObject             *source_object,
         /* update the dialog with the new value */
         g_variant_get (new_percentage, "(u)", &percentage);
         dialog_init (manager);
+        gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (manager->priv->dialog),
+                                         NULL);
         gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (manager->priv->dialog),
                                                  "keyboard-brightness-symbolic",
                                                  TRUE);
diff --git a/plugins/media-keys/gsd-osd-window.c b/plugins/media-keys/gsd-osd-window.c
index 8370cbe..5d818bf 100644
--- a/plugins/media-keys/gsd-osd-window.c
+++ b/plugins/media-keys/gsd-osd-window.c
@@ -552,9 +552,9 @@ static void
 draw_action_custom (GsdOsdDrawContext  *ctx,
                     cairo_t            *cr)
 {
-        GdkRectangle icon_box, bright_box;
+        GdkRectangle icon_box, bright_box, label_box;
 
-        get_bounding_boxes (ctx, &icon_box, NULL, &bright_box);
+        get_bounding_boxes (ctx, &icon_box, &label_box, &bright_box);
 
 #if 0
         g_message ("icon box: w=%d h=%d _x0=%d _y0=%d",
@@ -571,6 +571,9 @@ draw_action_custom (GsdOsdDrawContext  *ctx,
 
         render_custom (ctx, cr, &icon_box);
 
+        /* draw label */
+        draw_volume_label (ctx, cr, &label_box);
+
         if (ctx->show_level != FALSE) {
                 /* draw volume meter */
                 draw_volume_boxes (ctx, cr, (double) ctx->volume_level / 100.0, &bright_box);
diff --git a/plugins/media-keys/test-media-window.c b/plugins/media-keys/test-media-window.c
index 10456f5..070eb87 100644
--- a/plugins/media-keys/test-media-window.c
+++ b/plugins/media-keys/test-media-window.c
@@ -60,6 +60,7 @@ update_state (GtkWidget *window)
                 gtk_widget_show (window);
                 break;
         case 4:
+                gsd_osd_window_set_volume_label (GSD_OSD_WINDOW (window), NULL);
                 gsd_osd_window_set_action_custom (GSD_OSD_WINDOW (window),
                                                   "media-eject-symbolic",
                                                   FALSE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]