[gnome-panel] status-notifier: show tooltip



commit 212d262ff2b5fd1aaf15be1adfa0453937171b46
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Nov 6 00:03:12 2016 +0200

    status-notifier: show tooltip

 applets/status-notifier/sn-item-v0.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/applets/status-notifier/sn-item-v0.c b/applets/status-notifier/sn-item-v0.c
index 486dedf..3f76623 100644
--- a/applets/status-notifier/sn-item-v0.c
+++ b/applets/status-notifier/sn-item-v0.c
@@ -216,6 +216,7 @@ static void
 update (SnItemV0 *v0)
 {
   GtkImage *image;
+  SnTooltip *tip;
   gboolean visible;
 
   image = GTK_IMAGE (v0->image);
@@ -243,6 +244,36 @@ update (SnItemV0 *v0)
       g_debug ("status notifier item does not have icon");
     }
 
+  tip = v0->tooltip;
+
+  if (tip != NULL)
+    {
+      gchar *markup;
+
+      markup = NULL;
+
+      if ((tip->title != NULL && *tip->title != '\0') &&
+          (tip->text != NULL && *tip->text != '\0'))
+        {
+          markup = g_strdup_printf ("%s\n%s", tip->title, tip->text);
+        }
+      else if (tip->title != NULL && *tip->title != '\0')
+        {
+          markup = g_strdup (tip->title);
+        }
+      else if (tip->text != NULL && *tip->text != '\0')
+        {
+          markup = g_strdup (tip->title);
+        }
+
+      gtk_widget_set_tooltip_markup (GTK_WIDGET (v0), markup);
+      g_free (markup);
+    }
+  else
+    {
+      gtk_widget_set_tooltip_markup (GTK_WIDGET (v0), NULL);
+    }
+
   visible = g_strcmp0 (v0->status, "Passive") != 0;
   gtk_widget_set_visible (GTK_WIDGET (v0), visible);
 }


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