[rhythmbox] fading-image: allow tooltips to be disabled via a property



commit 9e371e3488f4aca6f4e91cdb4aa1fbb7da32ef46
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Dec 24 12:21:48 2014 +1000

    fading-image: allow tooltips to be disabled via a property

 widgets/rb-fading-image.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/widgets/rb-fading-image.c b/widgets/rb-fading-image.c
index 72b51a5..ff4ad92 100644
--- a/widgets/rb-fading-image.c
+++ b/widgets/rb-fading-image.c
@@ -63,6 +63,8 @@ struct _RBFadingImagePrivate
        guint64 start;
        guint64 end;
        gulong render_timer_id;
+
+       gboolean use_tooltip;
 };
 
 G_DEFINE_TYPE (RBFadingImage, rb_fading_image, GTK_TYPE_WIDGET)
@@ -78,7 +80,8 @@ G_DEFINE_TYPE (RBFadingImage, rb_fading_image, GTK_TYPE_WIDGET)
 enum
 {
        PROP_0,
-       PROP_FALLBACK
+       PROP_FALLBACK,
+       PROP_USE_TOOLTIP
 };
 
 enum
@@ -282,6 +285,9 @@ impl_query_tooltip (GtkWidget *widget, int x, int y, gboolean keyboard_mode, Gtk
        GdkPixbuf *scaled;
        GdkPixbuf *full;
 
+       if (image->priv->use_tooltip == FALSE)
+               return FALSE;
+
        if (image->priv->render_timer_id != 0) {
                full = image->priv->next_full;
                scaled = image->priv->next;
@@ -437,6 +443,9 @@ impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps
        case PROP_FALLBACK:
                g_value_set_string (value, image->priv->fallback_icon);
                break;
+       case PROP_USE_TOOLTIP:
+               g_value_set_boolean (value, image->priv->use_tooltip);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -452,6 +461,9 @@ impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSp
        case PROP_FALLBACK:
                image->priv->fallback_icon = g_value_dup_string (value);
                break;
+       case PROP_USE_TOOLTIP:
+               image->priv->use_tooltip = g_value_get_boolean (value);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -494,6 +506,18 @@ rb_fading_image_class_init (RBFadingImageClass *klass)
                                                              "fallback icon name",
                                                              NULL,
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+       /**
+        * RBFadingImage:use-tooltip:
+        *
+        * Whether to display a tooltip on the image
+        */
+       g_object_class_install_property (object_class,
+                                        PROP_USE_TOOLTIP,
+                                        g_param_spec_boolean ("use-tooltip",
+                                                              "use tooltip",
+                                                              "use tooltip",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
        /**
         * RBFadingImage::uri-dropped
@@ -677,7 +701,7 @@ composite_into_current (RBFadingImage *image)
 /**
  * rb_fading_image_set_pixbuf:
  * @image: a #RBFadingImage
- * @pixbuf: (transfer none): the next pixbuf to display
+ * @pixbuf: (transfer none) (allow-none): the next pixbuf to display
  *
  * Sets the next image to be displayed.
  */


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