From: John Darrington Date: Fri, 29 Jun 2007 00:52:03 +0000 (+0000) Subject: Re-enabled updates in the cell reference entry box. X-Git-Tag: v0.6.0~422 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e2bf013a731344daed7ab206d4a3c2460688208;p=pspp-builds.git Re-enabled updates in the cell reference entry box. --- diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 4b2fc7c4..cb2cae25 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,8 @@ +2007-06-29 John Darrington + + * data-editor.c data-sheet.c: Moved update_cell_ref_entry from + data-sheet.c to data-editor.c and made it work again. + 2007-06-06 Ben Pfaff Adapt case sources, sinks, and clients of procedure code to the diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c index b2c506dd..2f15096c 100644 --- a/src/ui/gui/data-editor.c +++ b/src/ui/gui/data-editor.c @@ -52,6 +52,11 @@ #include "psppire-data-store.h" #include "psppire-var-store.h" + +/* Update the data_ref_entry with the reference of the active cell */ +static gint update_data_ref_entry (const GtkSheet *sheet, + gint row, gint col, gpointer data); + static void register_data_editor_actions (struct data_editor *de); static void insert_variable (GtkCheckMenuItem *m, gpointer data); @@ -177,6 +182,7 @@ new_data_editor (void) struct data_editor *de ; struct editor_window *e; GtkSheet *var_sheet ; + GtkSheet *data_sheet ; PsppireVarStore *vs; de = g_malloc0 (sizeof (*de)); @@ -186,11 +192,16 @@ new_data_editor (void) de->xml = XML_NEW ("data-editor.glade"); var_sheet = GTK_SHEET (get_widget_assert (de->xml, "variable_sheet")); + data_sheet = GTK_SHEET (get_widget_assert (de->xml, "data_sheet")); vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet)); g_assert(vs); /* Traps a possible bug in win32 build */ + g_signal_connect (G_OBJECT (data_sheet), "activate", + G_CALLBACK (update_data_ref_entry), + de->xml); + g_signal_connect (vs->dict, "weight-changed", G_CALLBACK (on_weight_change), de); @@ -1227,3 +1238,44 @@ open_data_dialog (GtkAction *action, struct data_editor *de) gtk_widget_destroy (dialog); } + + + +/* Update the data_ref_entry with the reference of the active cell */ +static gint +update_data_ref_entry (const GtkSheet *sheet, gint row, gint col, gpointer data) +{ + GladeXML *data_editor_xml = data; + + /* The entry where the reference to the current cell is displayed */ + GtkEntry *cell_ref_entry; + + PsppireDataStore *data_store = PSPPIRE_DATA_STORE (gtk_sheet_get_model (sheet)); + + g_return_val_if_fail (data_editor_xml, FALSE); + + if (data_store) + { + const struct variable *pv = + psppire_dict_get_variable (data_store->dict, col); + + gchar *text ; + gchar *s ; + + text = g_strdup_printf ("%d: %s", row, + pv ? var_get_name (pv) : ""); + + cell_ref_entry = GTK_ENTRY (get_widget_assert (data_editor_xml, + "cell_ref_entry")); + + s = pspp_locale_to_utf8 (text, -1, 0); + + g_free (text); + + gtk_entry_set_text (cell_ref_entry, s); + + g_free (s); + } + + return FALSE; +} diff --git a/src/ui/gui/data-sheet.c b/src/ui/gui/data-sheet.c index 18b4e359..8d77bdef 100644 --- a/src/ui/gui/data-sheet.c +++ b/src/ui/gui/data-sheet.c @@ -74,49 +74,6 @@ traverse_callback (GtkSheet * sheet, return TRUE; } - - -/* Update the data_ref_entry with the reference of the active cell */ -gint -update_data_ref_entry (const GtkSheet *sheet, gint row, gint col) -{ - - GladeXML *data_editor_xml = NULL; /* FIXME !!!! */ - - - /* The entry where the reference to the current cell is displayed */ - GtkEntry *cell_ref_entry; - - PsppireDataStore *data_store = PSPPIRE_DATA_STORE (gtk_sheet_get_model (sheet)); - if (data_store) - { - const struct variable *pv = - psppire_dict_get_variable (data_store->dict, col); - - gchar *text ; - gchar *s ; - - if ( !data_editor_xml) - return FALSE; - - text = g_strdup_printf ("%d: %s", row, - pv ? var_get_name (pv) : ""); - - cell_ref_entry = GTK_ENTRY (get_widget_assert (data_editor_xml, - "cell_ref_entry")); - - s = pspp_locale_to_utf8 (text, -1, 0); - - g_free (text); - - gtk_entry_set_text (cell_ref_entry, s); - - g_free (s); - } - - return FALSE; -} - extern PsppireDataStore *the_data_store ; @@ -169,10 +126,6 @@ psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2, the_data_store->width_of_m = calc_m_width (sheet, the_data_store->font_desc); - g_signal_connect (G_OBJECT (sheet), "activate", - G_CALLBACK (update_data_ref_entry), - 0); - g_signal_connect (G_OBJECT (sheet), "traverse", G_CALLBACK (traverse_callback), 0);