From 62ab6e3163428196195baed41b1e365450ebd67a Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Tue, 8 May 2012 18:39:31 +0200 Subject: Use new tooltip API. Removes legacy code and updates to GtkTooltip. --- panel-plugin/sensors-plugin.c | 55 +++-------------------------------------- 1 files changed, 4 insertions(+), 51 deletions(-) diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c index 0d4cab5..9f76998 100644 --- a/panel-plugin/sensors-plugin.c +++ b/panel-plugin/sensors-plugin.c @@ -55,12 +55,6 @@ #include "sensors-plugin.h" -/* - * Tooltips to display for any part of this plugin - */ -extern GtkTooltips *tooltips; - - static void sensors_set_bar_size (GtkWidget *bar, int size, int orientation) { @@ -853,13 +847,8 @@ sensors_create_tooltip (gpointer data) } } - if (!tooltips) - tooltips = gtk_tooltips_new(); - - /* #if GTK_VERSION < 2.11 */ - gtk_tooltips_set_tip (tooltips, GTK_WIDGET(sensors->eventbox), - myToolTipText, NULL); - DBG("tooltip text: %s.\n", myToolTipText); + gtk_widget_set_tooltip_text (GTK_WIDGET(sensors->eventbox), myToolTipText); + DBG("tooltip text: %s.\n", myToolTipText); TRACE ("freeing myToolTipText"); g_free (myToolTipText); @@ -1037,31 +1026,6 @@ execute_command (GtkWidget *widget, GdkEventButton *event, gpointer data) } - -/* #if GTK_VERSION >= 2.11 - * static gboolean -handle_tooltip_query (GtkWidget *widget, - gint x, gint y, - GtkTooltip *tooltip, - gpointer data) -{ - t_sensors *sensors; - gchar *buffer; - - g_assert (data!=NULL); - - sensors = (t_sensors *) data; - - buffer = g_strdup("Tooltip placeholder"); - - gtk_tooltip_set_markup (tooltip, buffer); - - return TRUE; -} */ - - - - static void sensors_free (XfcePanelPlugin *plugin, t_sensors *sensors) { @@ -2215,13 +2179,8 @@ sensors_create_options (XfcePanelPlugin *plugin, t_sensors *sensors) add_sensors_frame (notebook, sd); - if (!tooltips) - tooltips = gtk_tooltips_new(); - - /* #if GTK_VERSION < 2.11 */ myToolTipText = g_strdup(_("You can change a feature's properties such as name, colours, min/max value by double-clicking the entry, editing the content, and pressing \"Return\" or selecting a different field.")); - gtk_tooltips_set_tip (tooltips, GTK_WIDGET(sd->myTreeView), - myToolTipText, NULL); + gtk_widget_set_tooltip_text (GTK_WIDGET(sd->myTreeView), myToolTipText); g_free (myToolTipText); /* g_signal_connect (G_OBJECT (sd->myComboBox), "changed", //G_CALLBACK (sensor_entry_changed), sd ); */ @@ -2282,7 +2241,7 @@ create_sensors_control (XfcePanelPlugin *plugin) add_event_box (sensors); - /* Add tooltip to show extended current sensors status */ + /* Add tooltip to show extended current sensors status */ sensors_create_tooltip ((gpointer) sensors); /* fill panel widget with boxes, strings, values, ... */ @@ -2292,12 +2251,6 @@ create_sensors_control (XfcePanelPlugin *plugin) gtk_container_add (GTK_CONTAINER (sensors->eventbox), sensors->widget_sensors); - /* #if GTK_VERSION >= 2.11 - * g_signal_connect(G_OBJECT(sensors->eventbox), - "query-tooltip", - G_CALLBACK(handle_tooltip_query), - (gpointer) sensors); */ - /* sensors_set_size (control, settings.size); */ TRACE ("leaves create_sensors_control"); -- 1.7.8.6