projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed intialization of coefficients
[pspp]
/
src
/
ui
/
gui
/
val-labs-dialog.c
diff --git
a/src/ui/gui/val-labs-dialog.c
b/src/ui/gui/val-labs-dialog.c
index 070a4f50da0aa93db7ea00f294bbce785a025b47..a17d8e10f059101f1168d79521013d08f4a2fa97 100644
(file)
--- a/
src/ui/gui/val-labs-dialog.c
+++ b/
src/ui/gui/val-labs-dialog.c
@@
-34,11
+34,12
@@
static void
on_label_entry_change(GtkEntry *entry, gpointer data)
{
static void
on_label_entry_change(GtkEntry *entry, gpointer data)
{
+ union value v;
+ const gchar *text ;
struct val_labs_dialog *dialog = data;
g_assert(dialog->labs);
struct val_labs_dialog *dialog = data;
g_assert(dialog->labs);
- union value v;
- const gchar *text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
+ text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
text_to_value(text, &v,
*psppire_variable_get_write_spec(dialog->pv));
text_to_value(text, &v,
*psppire_variable_get_write_spec(dialog->pv));
@@
-61,6
+62,8
@@
on_label_entry_change(GtkEntry *entry, gpointer data)
static void
select_treeview_from_value(GtkTreeView *treeview, union value *val)
{
static void
select_treeview_from_value(GtkTreeView *treeview, union value *val)
{
+ GtkTreePath *path ;
+
/*
We do this with a linear search through the model --- hardly
efficient, but the list is short ... */
/*
We do this with a linear search through the model --- hardly
efficient, but the list is short ... */
@@
-73,11
+76,11
@@
select_treeview_from_value(GtkTreeView *treeview, union value *val)
success;
success = gtk_tree_model_iter_next(model, &iter))
{
success;
success = gtk_tree_model_iter_next(model, &iter))
{
+ union value v;
GValue gvalue = {0};
gtk_tree_model_get_value(model, &iter, 1, &gvalue);
GValue gvalue = {0};
gtk_tree_model_get_value(model, &iter, 1, &gvalue);
- union value v;
v.f = g_value_get_double(&gvalue);
if ( 0 == memcmp(&v, val, sizeof (union value)))
v.f = g_value_get_double(&gvalue);
if ( 0 == memcmp(&v, val, sizeof (union value)))
@@
-86,7
+89,7
@@
select_treeview_from_value(GtkTreeView *treeview, union value *val)
}
}
}
}
-
GtkTreePath *
path = gtk_tree_model_get_path(model, &iter);
+ path = gtk_tree_model_get_path(model, &iter);
if ( path )
{
gtk_tree_view_set_cursor(treeview, path, 0, 0);
if ( path )
{
gtk_tree_view_set_cursor(treeview, path, 0, 0);
@@
-101,6
+104,8
@@
select_treeview_from_value(GtkTreeView *treeview, union value *val)
static void
on_value_entry_change(GtkEntry *entry, gpointer data)
{
static void
on_value_entry_change(GtkEntry *entry, gpointer data)
{
+ char *s;
+
struct val_labs_dialog *dialog = data;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
struct val_labs_dialog *dialog = data;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(dialog->value_entry));
@@
-116,7
+121,6
@@
on_value_entry_change(GtkEntry *entry, gpointer data)
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry),"");
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry),"");
- char *s;
if ( (s = val_labs_find (dialog->labs, v)) )
{
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry), s);
if ( (s = val_labs_find (dialog->labs, v)) )
{
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry), s);
@@
-267,6
+271,7
@@
static void
on_select_row (GtkTreeView *treeview,
gpointer data)
{
on_select_row (GtkTreeView *treeview,
gpointer data)
{
+ gchar *labeltext;
struct val_labs_dialog *dialog = data;
struct val_lab * vl = get_selected_tuple(dialog);
struct val_labs_dialog *dialog = data;
struct val_lab * vl = get_selected_tuple(dialog);
@@
-286,8
+291,10
@@
on_select_row (GtkTreeView *treeview,
g_signal_handler_block(GTK_ENTRY(dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_block(GTK_ENTRY(dialog->label_entry),
dialog->change_handler_id);
+ labeltext = pspp_locale_to_utf8(vl->label, -1, 0);
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry),
gtk_entry_set_text(GTK_ENTRY(dialog->label_entry),
- vl->label);
+ labeltext);
+ g_free(labeltext);
g_signal_handler_unblock(GTK_ENTRY(dialog->label_entry),
dialog->change_handler_id);
g_signal_handler_unblock(GTK_ENTRY(dialog->label_entry),
dialog->change_handler_id);
@@
-302,6
+309,10
@@
on_select_row (GtkTreeView *treeview,
struct val_labs_dialog *
val_labs_dialog_create(GladeXML *xml)
{
struct val_labs_dialog *
val_labs_dialog_create(GladeXML *xml)
{
+ GtkTreeViewColumn *column;
+
+ GtkCellRenderer *renderer ;
+
struct val_labs_dialog *dialog = g_malloc(sizeof(*dialog));
dialog->window = get_widget_assert(xml,"val_labs_dialog");
struct val_labs_dialog *dialog = g_malloc(sizeof(*dialog));
dialog->window = get_widget_assert(xml,"val_labs_dialog");
@@
-321,9
+332,7
@@
val_labs_dialog_create(GladeXML *xml)
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(dialog->treeview), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(dialog->treeview), FALSE);
- GtkTreeViewColumn *column;
-
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes ("Title",
renderer,
column = gtk_tree_view_column_new_with_attributes ("Title",
renderer,
@@
-406,21
+415,25
@@
repopulate_dialog(struct val_labs_dialog *dialog)
vl;
vl = val_labs_next(dialog->labs, &vli))
{
vl;
vl = val_labs_next(dialog->labs, &vli))
{
+
gchar *const vstr =
value_to_text(vl->value,
*psppire_variable_get_write_spec(dialog->pv));
gchar *const vstr =
value_to_text(vl->value,
*psppire_variable_get_write_spec(dialog->pv));
+ gchar *labeltext =
+ pspp_locale_to_utf8(vl->label, -1, 0);
-
gchar *const text = g_strdup_printf("%s = \"%s\"",
gchar *const text = g_strdup_printf("%s = \"%s\"",
- vstr, vl->label);
-
+ vstr, labeltext);
+
+
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
0, text,
1, vl->value.f,
-1);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
0, text,
1, vl->value.f,
-1);
+ g_free(labeltext);
g_free(text);
g_free(vstr);
}
g_free(text);
g_free(vstr);
}