From fef66f14a62f12245755fcfd8d85f40666cb95d7 Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Mon, 7 May 2012 13:03:57 +0200 Subject: Use newer tooltip API (bug #8730). This updates the plugin to use the newer tooltip API (requires >=GTK-2.12) and fixes tooltips not showing for update intervals smaller then 500ms. --- panel-plugin/main.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/panel-plugin/main.c b/panel-plugin/main.c index 43f5450..2c231f7 100644 --- a/panel-plugin/main.c +++ b/panel-plugin/main.c @@ -168,8 +168,6 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin) /* Get the last disk perfomance data, compute the statistics and update the panel-docked monitor bars */ { - static GtkTooltips *s_poToolTips = 0; - struct devperf_t oPerf; struct param_t *poConf = &(p_poPlugin->oConf.oParam); struct monitor_t *poMonitor = &(p_poPlugin->oMonitor); @@ -184,9 +182,6 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin) char acToolTips[256]; int status, i; - if (!s_poToolTips) - s_poToolTips = gtk_tooltips_new (); - rbytes = wbytes = iRBusy_ns = iWBusy_ns = -1; memset (&oPerf, 0, sizeof (oPerf)); oPerf.qlen = -1; @@ -201,8 +196,8 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin) snprintf (acToolTips, sizeof(acToolTips), _("%s: Device statistics unavailable."), poConf->acTitle); UpdateProgressBars(p_poPlugin, 0, 0, 0); - gtk_tooltips_set_tip (s_poToolTips, GTK_WIDGET (poMonitor->wEventBox), - acToolTips, 0); + gtk_widget_set_tooltip_text(GTK_WIDGET(poMonitor->wEventBox), acToolTips); + return (-1); } if (poMonitor->oPrevPerf.timestamp_ns) { @@ -262,8 +257,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin) (int) round(arBusy[W_DATA]) : -1, #endif (oPerf.qlen >= 0) ? (int) round(arBusy[RW_DATA]) : -1); - gtk_tooltips_set_tip (s_poToolTips, GTK_WIDGET (poMonitor->wEventBox), - acToolTips, 0); + gtk_widget_set_tooltip_text(GTK_WIDGET(poMonitor->wEventBox), acToolTips); switch (poConf->eStatistics) { case BUSY_TIME: @@ -481,6 +475,7 @@ static diskperf_t *diskperf_create_control (XfcePanelPlugin *plugin) /**************************************************************/ + static void diskperf_free (XfcePanelPlugin *plugin, diskperf_t *poPlugin) /* Plugin API */ { -- 1.7.8.6