X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fpsppire-data-sheet.c;h=3da9e0455068d68e94826a26279530e312430d48;hb=d8ea74cb614cf7b28291fcc5f98e12673a69ee5f;hp=01afb5ed8772e50a9bd136241de385429a0d646e;hpb=19cf39ef8802208ca67fc3e1cf12ce4b239aaabf;p=pspp diff --git a/src/ui/gui/psppire-data-sheet.c b/src/ui/gui/psppire-data-sheet.c index 01afb5ed87..3da9e04550 100644 --- a/src/ui/gui/psppire-data-sheet.c +++ b/src/ui/gui/psppire-data-sheet.c @@ -337,13 +337,15 @@ on_data_column_editing_started (GtkCellRenderer *cell, if (var_has_value_labels (var) && GTK_IS_COMBO_BOX (editable)) { const struct val_labs *labels = var_get_value_labels (var); - const struct val_lab *vl; + const struct val_lab **vls = val_labs_sorted (labels); + size_t n_vls = val_labs_count (labels); GtkListStore *list_store; + int i; list_store = gtk_list_store_new (1, G_TYPE_STRING); - for (vl = val_labs_first (labels); vl != NULL; - vl = val_labs_next (labels, vl)) + for (i = 0; i < n_vls; ++i) { + const struct val_lab *vl = vls[i]; GtkTreeIter iter; gtk_list_store_append (list_store, &iter); @@ -351,6 +353,7 @@ on_data_column_editing_started (GtkCellRenderer *cell, 0, val_lab_get_label (vl), -1); } + free (vls); gtk_combo_box_set_model (GTK_COMBO_BOX (editable), GTK_TREE_MODEL (list_store)); @@ -2302,7 +2305,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); @@ -2435,13 +2438,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?) */ @@ -2455,14 +2458,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++;