From a44a417b087ec99f18a51607ca0bb39ddd66fb43 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 16 Mar 2008 14:39:05 +0100 Subject: Compatibility with GTK+ 2.10 --- configure.in | 2 +- mixgtk/mixgtk_mixvm.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index ddb74f3..a7e8f59 100644 --- a/configure.in +++ b/configure.in @@ -123,7 +123,7 @@ esac],[gui=true]) dnl Check for gtk+ if test x$gui = xtrue; then -PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0 libglade-2.0 >= 2.0.0 pango >= 1.4, +PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10.0 libglade-2.0 >= 2.0.0 pango >= 1.4, [LIBS="$LIBS $GTK_LIBS" AM_CFLAGS="$AM_CFLAGS $GTK_CFLAGS"], [AC_MSG_WARN(Cannot find GTK+/Glade/Pango: the GUI shall not be built) gui=false]) diff --git a/mixgtk/mixgtk_mixvm.c b/mixgtk/mixgtk_mixvm.c index d0ccc05..268bc25 100644 --- a/mixgtk/mixgtk_mixvm.c +++ b/mixgtk/mixgtk_mixvm.c @@ -45,6 +45,12 @@ static GtkLabel *progtime_; static GtkLabel *uptime_; static mix_vm_t *vm_; +#define HAVE_OLD_GTK !GTK_CHECK_VERSION(2, 12, 0) + +#if HAVE_OLD_GTK +static GtkTooltips *tips_ = NULL; +#endif + /* Static function prototypes */ static void init_goto_ (void); @@ -69,6 +75,10 @@ mixgtk_mixvm_init (mix_vm_t *vm) vm_ = vm; +#if HAVE_OLD_GTK + if (!tips_) tips_ = gtk_tooltips_new (); +#endif + for (k = 0; k < REGISTER_NO_; ++k) { reg_entries_[k] = @@ -404,9 +414,15 @@ update_register_ (mixgtk_widget_id_t reg) gtk_entry_set_text (reg_entries_[reg - MIXGTK_WIDGET_rA], BUFFER); g_snprintf (BUFFER, 20, "%s%ld", mix_word_is_negative (tipval)? "-" : "", mix_word_magnitude (tipval)); + +#if HAVE_OLD_GTK + gtk_tooltips_set_tip (tips_, + GTK_WIDGET (reg_entries_[reg - MIXGTK_WIDGET_rA]), + BUFFER, NULL); +#else gtk_widget_set_tooltip_text ( GTK_WIDGET (reg_entries_[reg - MIXGTK_WIDGET_rA]), BUFFER); - +#endif } -- cgit v1.2.3