From 89ca2311946d399ae677478b78861cfbf63893bc Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 19 Feb 2008 00:35:19 +0000 Subject: [PATCH] Applied patch #6420 --- ChangeLog | 4 +++ INSTALL | 3 +- configure.ac | 4 +-- src/ui/gui/ChangeLog | 5 ++++ src/ui/gui/dict-display.c | 58 ++++++++++++++++++++++++++++++++++++--- 5 files changed, 66 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 751b7494..06fed4f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-02-19 John Darrington + + * configure.ac INSTALL: We now depend on GTK+ 2.12 + 2007-12-11 John Darrington * t-test-independent-samples-dialog.c: Quoted the group values, when diff --git a/INSTALL b/INSTALL index dd278038..4997fd52 100644 --- a/INSTALL +++ b/INSTALL @@ -48,8 +48,7 @@ use the GUI, you must run `configure' with --without-gui. 0.18 and 0.19 have a bug that will prevent library detection, but other versions should be fine. - * GTK+ (http://www.gtk.org/), version 2.8.0 or later, although we - recommend version 2.10.2 or later. + * GTK+ (http://www.gtk.org/), version 2.12.0 or later. * libglade (http://www.jamesh.id.au/software/libglade/), version 2.6 or later. diff --git a/configure.ac b/configure.ac index 708911ed..9df062ae 100644 --- a/configure.ac +++ b/configure.ac @@ -39,8 +39,8 @@ AC_ARG_WITH( [AS_HELP_STRING([--without-gui], [don't build the PSPPIRE gui])]) if test x"$with_gui" != x"no" ; then - PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0,, - [PSPP_REQUIRED_PREREQ([gtk+ 2.0 v2.8.0 or later (or use --without-gui)])]) + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0,, + [PSPP_REQUIRED_PREREQ([gtk+ 2.0 v2.12.0 or later (or use --without-gui)])]) PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.6.0,, [PSPP_REQUIRED_PREREQ([libglade 2.0 (or use --without-gui)])]) fi diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 845a2eef..23004c9a 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,8 @@ +2008-02-19 John Darrington + + * dict-display.c: Display names of variables in dialog box + dictionary treeviews, when the mouse hovers over the variable. + 2008-02-13 John Darrington * variable-info-dialog.c: Fix crash when clicking "Jump" when no diff --git a/src/ui/gui/dict-display.c b/src/ui/gui/dict-display.c index 1c2858d6..d665edd6 100644 --- a/src/ui/gui/dict-display.c +++ b/src/ui/gui/dict-display.c @@ -136,10 +136,9 @@ var_description_cell_data_func (GtkTreeViewColumn *col, if ( var_has_label (var)) { gchar *text = g_strdup_printf ( - "%s" - " (%s)", - var_get_label (var), - var_get_name (var)); + "%s", + var_get_label (var)); + char *utf8 = pspp_locale_to_utf8 (text, -1, NULL); @@ -153,6 +152,53 @@ var_description_cell_data_func (GtkTreeViewColumn *col, } } + +/* Sets the tooltip to be the name of the variable under the cursor */ +static gboolean +set_tooltip_for_variable (GtkTreeView *treeview, + gint x, + gint y, + gboolean keyboard_mode, + GtkTooltip *tooltip, + gpointer user_data) + +{ + gint bx, by; + GtkTreeIter iter; + GtkTreePath *path; + GtkTreeModel *tree_model; + struct variable *var = NULL; + gboolean ok; + + gtk_tree_view_convert_widget_to_bin_window_coords (treeview, + x, y, &bx, &by); + + if (!gtk_tree_view_get_path_at_pos (treeview, bx, by, + &path, NULL, NULL, NULL)) + return FALSE; + + tree_model = gtk_tree_view_get_model (treeview); + + + gtk_tree_view_set_tooltip_row (treeview, tooltip, path); + + ok = gtk_tree_model_get_iter (tree_model, &iter, path); + + gtk_tree_path_free (path); + if (!ok) + return FALSE; + + + gtk_tree_model_get (tree_model, &iter, DICT_TVM_COL_VAR, &var, -1); + + if ( ! var_has_label (var)) + return FALSE; + + gtk_tooltip_set_text (tooltip, var_get_name (var)); + + return TRUE; +} + /* Sets up TREEVIEW to display the variables of DICT. MODE is the selection mode for TREEVIEW. PREDICATE determines which variables should be visible, or NULL if @@ -219,6 +265,10 @@ attach_dictionary_to_treeview (GtkTreeView *treeview, PsppireDict *dict, gtk_tree_view_append_column (treeview, col); gtk_tree_selection_set_mode (selection, mode); + + g_object_set (treeview, "has-tooltip", TRUE, NULL); + + g_signal_connect (treeview, "query-tooltip", G_CALLBACK (set_tooltip_for_variable), NULL); } -- 2.30.2