Change view and scroll to position on header double click
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Mar 2016 16:15:18 +0000 (17:15 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 12 Mar 2016 16:15:18 +0000 (17:15 +0100)
src/ui/gui/psppire-data-editor.c
src/ui/gui/psppire-var-sheet-header.c

index 14f2076f359de9d3b8bd42af7826909b50c61e42..7838e5f810d206bc7cb5fabe5ba41dd13f013f4d 100644 (file)
@@ -301,18 +301,27 @@ psppire_data_editor_class_init (PsppireDataEditorClass *klass)
 }
 
 
-static gboolean
+static void
 on_var_sheet_var_double_clicked (PsppireVarSheet *var_sheet, gint dict_index,
                                  PsppireDataEditor *de)
 {
-
   gtk_notebook_set_current_page (GTK_NOTEBOOK (de),
                                  PSPPIRE_DATA_EDITOR_DATA_VIEW);
 
+  jmd_sheet_scroll_to (de->data_sheet, dict_index, -1);
+}
+
+static void
+on_data_sheet_var_double_clicked (JmdSheet *data_sheet, gint dict_index,
+                                 PsppireDataEditor *de)
+{
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (de),
+                                 PSPPIRE_DATA_EDITOR_VARIABLE_VIEW);
 
-  return TRUE;
+  jmd_sheet_scroll_to (de->var_sheet, -1, dict_index);
 }
 
+
 /* Refreshes 'de->cell_ref_label' and 'de->datum_entry' from the currently
    active cell or cells. */
 static void
@@ -386,9 +395,12 @@ psppire_data_editor_init (PsppireDataEditor *de)
 
   gtk_widget_show_all (de->var_sheet);
   
-  g_signal_connect (de->var_sheet, "var-double-clicked",
+  g_signal_connect (de->var_sheet, "row-header-double-clicked",
                     G_CALLBACK (on_var_sheet_var_double_clicked), de);
 
+  g_signal_connect (de->data_sheet, "column-header-double-clicked",
+                    G_CALLBACK (on_data_sheet_var_double_clicked), de);
+
   g_object_set (de, "can-focus", FALSE, NULL);
 
   if (psppire_conf_get_string (psppire_conf_new (),
index 5032c3897914e0704c84c5ece38fca01dde960d8..8930826aaac939bfe8c233fce78d00dac4f07581 100644 (file)
@@ -79,7 +79,7 @@ gi (GListModel *list, guint position)
       break;
     default:
       //      g_assert_not_reached ();
-      g_print ("Bug: Request for item %d", position);
+      g_print ("Bug: Request for item %d\n", position);
       break;
     }