gui: clipboard CUT and COPY store same data with/without label
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sun, 12 Jul 2020 18:59:35 +0000 (20:59 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sun, 12 Jul 2020 18:59:35 +0000 (20:59 +0200)
clipboard store data with or without value labels depending on
the setting in the data view. clipboard cut was always storing
the raw data.
With this patch copy and cut both store raw data or labels
depending on the view setting.

Closes: https://savannah.gnu.org/bugs/?58757
src/ui/gui/psppire-data-editor.c
src/ui/gui/psppire-data-editor.h
src/ui/gui/psppire-data-window.c

index e852b7d92b403d2d1647c7ea8b863cddd648def5..d1b185c681e91f57062a3b5d546439c540d33f3e 100644 (file)
@@ -173,6 +173,7 @@ psppire_data_editor_set_property (GObject         *object,
     case PROP_VALUE_LABELS:
       {
        gboolean l = g_value_get_boolean (value);
+       de->use_value_labels = l;
        g_object_set (de->data_sheet, "forward-conversion",
                      l ?
                      psppire_data_store_value_to_string_with_labels :
@@ -207,6 +208,7 @@ psppire_data_editor_get_property (GObject         *object,
       g_value_set_pointer (value, de->dict);
       break;
     case PROP_VALUE_LABELS:
+      g_value_set_boolean (value, de->use_value_labels);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -504,6 +506,7 @@ psppire_data_editor_init (PsppireDataEditor *de)
   gtk_box_pack_start (GTK_BOX (hbox), de->datum_entry, TRUE, TRUE, 0);
 
   de->split = FALSE;
+  de->use_value_labels = FALSE;
   de->data_sheet = psppire_data_sheet_new ();
 
   GtkWidget *data_button = ssw_sheet_get_button (SSW_SHEET (de->data_sheet));
index a5152bb759cbb2ea47fc362b1cc5d1321d45a0fc..7da33113331af1451ba7b34a2be3e52d262d0eb1 100644 (file)
@@ -70,6 +70,7 @@ struct _PsppireDataEditor
   GtkWidget *datum_entry;      /* PsppireValueEntry for editing current cell. */
 
   gboolean split;              /* True if the sheets are in split view. */
+  gboolean use_value_labels;   /* True if labels instead of data are shown. */
 };
 
 struct _PsppireDataEditorClass
index de4502ff823e47fd7188ea315b053c78f379c45f..2f31923af286c0517ab5b796beaaa8321198a77e 100644 (file)
@@ -1087,8 +1087,10 @@ on_cut (PsppireDataWindow *dw)
          for (x = sel.start_x ; x <= sel.end_x; ++x)
            {
              const struct variable * var = psppire_dict_get_variable (dict, x);
+             gboolean use_value_label = FALSE;
+             g_object_get (dw->data_editor, "value-labels", &use_value_label, NULL);
              gchar *s = psppire_data_store_get_string (dw->data_editor->data_store,
-                                                         y, var, FALSE);
+                                                         y, var, use_value_label);
              g_string_append (str, s);
               if (x < sel.end_x)
                 g_string_append (str, "\t");