static void psppire_var_sheet_class_init (PsppireVarSheetClass *klass);
static void psppire_var_sheet_init (PsppireVarSheet *vs);
+static void psppire_var_sheet_realize (GtkWidget *w);
+static void psppire_var_sheet_unrealize (GtkWidget *w);
+
enum
{
gint i = 0;
GtkTreeIter iter;
- GtkListStore *list_store;
- list_store = gtk_list_store_new (1, G_TYPE_STRING);
-
+ GtkListStore *list_store = gtk_list_store_new (1, G_TYPE_STRING);
while ( (s = labels[i++]))
{
}
-
static void
psppire_var_sheet_class_init (PsppireVarSheetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GParamSpec *pspec;
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = psppire_var_sheet_dispose;
object_class->finalize = psppire_var_sheet_finalize;
+ widget_class->realize = psppire_var_sheet_realize;
+ widget_class->unrealize = psppire_var_sheet_unrealize;
object_class->set_property = psppire_var_sheet_set_property;
object_class->get_property = psppire_var_sheet_get_property;
-
/*
Callback whenever the active cell changes on the var sheet.
*/
gint oldrow, gint oldcolumn,
gpointer data)
{
- PsppireSheetCellAttr attributes;
PsppireVarStore *var_store;
PsppireVarSheetClass *vs_class =
PSPPIRE_VAR_SHEET_CLASS(G_OBJECT_GET_CLASS (vs));
g_return_if_fail (oldcolumn == PSPPIRE_VAR_STORE_COL_NAME ||
row < psppire_var_store_get_var_cnt (var_store));
- psppire_sheet_get_attributes (sheet, row, column, &attributes);
-
var = psppire_var_store_get_var (var_store, row);
switch (column)
gtk_combo_box_entry_set_text_column (cbe, 0);
- g_signal_connect (G_OBJECT (cbe),"changed",
+ g_signal_connect (cbe, "changed",
G_CALLBACK (change_alignment), var);
}
break;
gtk_combo_box_entry_set_text_column (cbe, 0);
- g_signal_connect (G_OBJECT (cbe),"changed",
+ g_signal_connect (cbe, "changed",
G_CALLBACK (change_measure), var);
}
break;
case PSPPIRE_VAR_STORE_COL_DECIMALS:
case PSPPIRE_VAR_STORE_COL_COLUMNS:
{
- if ( attributes.is_editable)
+ if ( psppire_sheet_model_is_editable (PSPPIRE_SHEET_MODEL(var_store),
+ row, column))
{
gint r_min, r_max;
}
+static void
+psppire_var_sheet_realize (GtkWidget *w)
+{
+ PsppireVarSheet *vs = PSPPIRE_VAR_SHEET (w);
+
+ GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (vs));
+
+ vs->val_labs_dialog = val_labs_dialog_create (GTK_WINDOW (toplevel));
+ vs->missing_val_dialog = missing_val_dialog_create (GTK_WINDOW (toplevel));
+ vs->var_type_dialog = var_type_dialog_create (GTK_WINDOW (toplevel));
+
+ /* Chain up to the parent class */
+ GTK_WIDGET_CLASS (parent_class)->realize (w);
+}
+
+static void
+psppire_var_sheet_unrealize (GtkWidget *w)
+{
+ PsppireVarSheet *vs = PSPPIRE_VAR_SHEET (w);
+
+ g_free (vs->val_labs_dialog);
+ g_free (vs->missing_val_dialog);
+ g_free (vs->var_type_dialog);
+
+ /* Chain up to the parent class */
+ GTK_WIDGET_CLASS (parent_class)->unrealize (w);
+}
+
+
+
static void
psppire_var_sheet_init (PsppireVarSheet *vs)
{
GtkBuilder *builder = builder_new ("data-editor.ui");
- vs->val_labs_dialog = val_labs_dialog_create (builder);
- vs->missing_val_dialog = missing_val_dialog_create (builder);
- vs->var_type_dialog = var_type_dialog_create (builder);
-
connect_help (builder);
g_object_unref (builder);