merge master->gtk3, fixed psppire-output-view.c refactoring; this compiles and runs...
[pspp] / src / ui / gui / psppire-data-sheet.c
index badc204165f49ddcc94ecd1173bae1815c1ee5a0..c7cced23af8740fd7840cc91a93344bf7a8eb4a6 100644 (file)
@@ -675,7 +675,7 @@ add_data_column_cell_renderer (PsppireDataSheet *data_sheet,
   var = g_object_get_data (G_OBJECT (column), "variable");
   g_return_if_fail (var != NULL);
 
-  if (var_has_value_labels (var))
+  if (data_sheet->show_value_labels && var_has_value_labels (var))
     {
       cell = gtk_cell_renderer_combo_new ();
       g_object_set (G_OBJECT (cell),
@@ -944,10 +944,11 @@ psppire_data_sheet_set_value_labels (PsppireDataSheet *ds,
     {
       ds->show_value_labels = show_value_labels;
       g_object_notify (G_OBJECT (ds), "value-labels");
-      gtk_widget_queue_draw (GTK_WIDGET (ds));
 
-      /* Make the cell being edited refresh too. */
-      pspp_sheet_view_stop_editing (PSPP_SHEET_VIEW (ds), TRUE);
+      /* Pretend the model changed, to force the columns to be rebuilt.
+         Otherwise cell renderers won't get changed from combo boxes to text
+         entries or vice versa. */
+      g_object_notify (G_OBJECT (ds), "model");
     }
 }
 
@@ -2309,7 +2310,7 @@ psppire_data_sheet_clipboard_set (GtkSelectionData *selection_data,
       g_assert_not_reached ();
     }
 
-  gtk_selection_data_set (selection_data, selection_data->target,
+  gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data),
                          8,
                          (const guchar *) string->str, string->len);
 
@@ -2442,13 +2443,13 @@ psppire_data_sheet_clip_received_cb (GtkClipboard *clipboard,
   gint first_column;
   char *c;
 
-  if ( sd->length < 0 )
+  if ( gtk_selection_data_get_length (sd) < 0 )
     return;
 
-  if ( sd->type != gdk_atom_intern ("UTF8_STRING", FALSE))
+  if ( gtk_selection_data_get_data_type (sd) != gdk_atom_intern ("UTF8_STRING", FALSE))
     return;
 
-  c = (char *) sd->data;
+  c = (char *) gtk_selection_data_get_data (sd);
 
   /* Get the starting selected position in the data sheet.  (Possibly we should
      only paste into the selected range if it's larger than one cell?) */
@@ -2462,14 +2463,14 @@ psppire_data_sheet_clip_received_cb (GtkClipboard *clipboard,
   g_return_if_fail (next_row >= 0);
   g_return_if_fail (next_column >= 0);
 
-  while (count < sd->length)
+  while (count < gtk_selection_data_get_length (sd))
     {
       gint row = next_row;
       gint column = next_column;
       struct variable *var;
       char *s = c;
 
-      while (*c != '\t' && *c != '\n' && count < sd->length)
+      while (*c != '\t' && *c != '\n' && count < gtk_selection_data_get_length (sd))
         {
           c++;
           count++;