gtk2: Use newer tooltips functions, if available.
authorNeal H. Walfield <neal@gnu.org>
Sun, 26 Jul 2015 18:03:14 +0000 (20:03 +0200)
committerNeal H. Walfield <neal@gnu.org>
Sun, 26 Jul 2015 18:03:14 +0000 (20:03 +0200)
* gtk+-2/pinentry-gtk-2.c (tooltips): Don't declare for Gtk+ >=2.12.0.
(create_window): Gtk+ >=2.12.0, use gtk_widget_set_tooltip_text
instead of gtk_tooltips_set_tip.

Patch-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>.
gtk+-2/pinentry-gtk-2.c

index bfc94af..21fabc8 100644 (file)
@@ -68,7 +68,9 @@ static GtkWidget *entry;
 static GtkWidget *repeat_entry;
 static GtkWidget *error_label;
 static GtkWidget *qualitybar;
+#if !GTK_CHECK_VERSION (2, 12, 0)
 static GtkTooltips *tooltips;
+#endif
 static gboolean got_input;
 static guint timeout_source;
 static int confirm_mode;
@@ -377,7 +379,9 @@ create_window (pinentry_t ctx)
 
   repeat_entry = NULL;
 
+#if !GTK_CHECK_VERSION (2, 12, 0)
   tooltips = gtk_tooltips_new ();
+#endif
 
   /* FIXME: check the grabbing code against the one we used with the
      old gpg-agent */
@@ -514,8 +518,15 @@ create_window (pinentry_t ctx)
                                     QUALITYBAR_EMPTY_TEXT);
          gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (qualitybar), 0.0);
           if (pinentry->quality_bar_tt)
-            gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), qualitybar,
-                                  pinentry->quality_bar_tt, "");
+           {
+#if !GTK_CHECK_VERSION (2, 12, 0)
+             gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), qualitybar,
+                                   pinentry->quality_bar_tt, "");
+#else
+             gtk_widget_set_tooltip_text (qualitybar,
+                                          pinentry->quality_bar_tt);
+#endif
+           }
          gtk_table_attach (GTK_TABLE (table), qualitybar, 1, 2, nrow, nrow+1,
                            GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
           nrow++;