From: John Darrington Date: Thu, 12 Mar 2009 23:09:23 +0000 (+0900) Subject: Split data-editor.glade into two files. X-Git-Tag: v0.7.3~236 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df63b7b8aec3bd284ba2c4e62f1fc30924fe2c5b;p=pspp-builds.git Split data-editor.glade into two files. Seperated the glade specification of the data editor widgets from those of the popup dialogs in the variable sheet. --- diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index d37cc29f..5f14e62c 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -72,7 +72,9 @@ nodist_src_ui_gui_psppire_DATA = \ $(top_builddir)/src/ui/gui/regression.ui \ $(top_builddir)/src/ui/gui/syntax-editor.ui \ $(top_builddir)/src/ui/gui/text-data-import.ui \ - $(top_builddir)/src/ui/gui/t-test.ui + $(top_builddir)/src/ui/gui/t-test.ui \ + $(top_builddir)/src/ui/gui/var-sheet-dialogs.ui + dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/pspplogo.png \ @@ -222,7 +224,8 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/regression.glade \ src/ui/gui/syntax-editor.glade \ src/ui/gui/text-data-import.glade \ - src/ui/gui/t-test.glade + src/ui/gui/t-test.glade \ + src/ui/gui/var-sheet-dialogs.glade nodist_src_ui_gui_psppire_SOURCES = \ diff --git a/src/ui/gui/data-editor.glade b/src/ui/gui/data-editor.glade index 1bd5cf22..4d507221 100644 --- a/src/ui/gui/data-editor.glade +++ b/src/ui/gui/data-editor.glade @@ -1076,920 +1076,4 @@ - - 6 - Variable Type - False - True - 485 - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - - - True - 5 - 5 - - - True - 13 - True - - - True - True - Numeric - True - 0 - True - True - - - False - False - - - - - True - True - Comma - True - 0 - True - radiobutton1 - - - False - False - 1 - - - - - True - True - Dot - True - 0 - True - radiobutton1 - - - False - False - 2 - - - - - True - True - Scientific notation - True - 0 - True - radiobutton1 - - - False - False - 3 - - - - - True - True - Date - True - 0 - True - radiobutton1 - - - False - False - 4 - - - - - True - True - Dollar - True - 0 - True - radiobutton1 - - - False - False - 5 - - - - - True - True - Custom currency - True - 0 - True - radiobutton1 - - - False - False - 6 - - - - - True - True - String - True - 0 - True - radiobutton1 - - - False - False - 7 - - - - - False - False - - - - - True - 10 - - - 20 - 194 - True - GTK_POLICY_NEVER - GTK_SHADOW_IN - - - True - True - False - - - - - False - False - - - - - 15 - - - 1 - 120 - True - True - GTK_POLICY_NEVER - GTK_POLICY_NEVER - GTK_SHADOW_IN - - - True - True - False - - - - - - - True - 0 - - - True - 12 - - - True - True - - - True - positive - - - - - True - negative - - - 1 - - - - - - - - - True - Sample - True - - - label_item - - - - - GTK_PACK_END - 1 - - - - - 1 - - - - - True - GTK_POLICY_NEVER - GTK_SHADOW_IN - - - True - True - False - - - - - 2 - - - - - 100 - 50 - True - 2 - 2 - 2 - 1 - - - True - - - True - Width: - GTK_JUSTIFY_RIGHT - - - False - False - GTK_PACK_END - - - - - GTK_FILL - GTK_FILL - - - - - 25 - True - True - - - 1 - 2 - 1 - 2 - - - - - - 25 - True - - - 1 - 2 - - - - - - True - 0 - Decimal Places: - GTK_JUSTIFY_RIGHT - - - 1 - 2 - GTK_FILL - - - - - - 3 - - - - - False - 1 - - - - - True - 5 - GTK_BUTTONBOX_START - - - True - True - True - gtk-ok - True - 0 - - - - - True - True - True - gtk-cancel - True - 0 - - - 1 - - - - - True - True - True - gtk-help - True - 0 - - - 2 - - - - - 2 - - - - - - - Value Labels - False - True - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - - - True - 5 - - - True - 0 - - - True - 8 - 12 - - - True - 2 - 2 - 5 - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_ETCHED_IN - - - True - True - False - False - - - - - 1 - 2 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 5 - 2 - 2 - 5 - 4 - - - True - - - 85 - True - True - - - False - False - 1 - - - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - Value Label: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Value: - - - GTK_FILL - - - - - - 2 - GTK_FILL - - - - - True - 5 - - - True - False - True - True - gtk-add - True - 0 - - - - - True - False - True - True - gtk-apply - True - 0 - - - 1 - - - - - True - False - True - True - gtk-remove - True - 0 - - - 2 - - - - - 1 - 2 - GTK_FILL - - - - - - - - - True - Value Labels - True - - - label_item - - - - - 10 - - - - - True - 5 - 5 - GTK_BUTTONBOX_START - - - True - True - True - gtk-ok - True - 0 - - - - - True - True - True - gtk-cancel - True - 0 - - - 1 - - - - - True - True - True - gtk-help - True - 0 - - - 2 - - - - - False - False - GTK_PACK_END - 1 - - - - - - - 12 - Missing Values - False - True - GDK_WINDOW_TYPE_HINT_DIALOG - True - True - - - True - 12 - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - - - - - - True - True - _No missing values - True - 0 - True - True - - - label_item - - - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - True - 5 - 6 - True - - - 75 - True - True - - - False - False - - - - - 75 - True - True - - - False - False - 1 - - - - - 75 - True - True - - - False - False - 2 - - - - - - - - - True - True - _Discrete missing values - True - False - 0 - True - no_missing - - - label_item - - - - - 1 - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - True - 3 - 2 - 6 - 6 - - - True - _Low: - True - mv-low - - - - - 75 - True - True - - - 1 - 2 - - - - - True - _High: - True - mv-high - - - 1 - 2 - - - - - 75 - True - True - - - 1 - 2 - 1 - 2 - - - - - True - Di_screte value: - True - mv-discrete - - - 2 - 3 - - - - - 75 - True - True - - - 1 - 2 - 2 - 3 - - - - - - - - - True - True - _Range plus one optional discrete missing value - True - False - 0 - True - no_missing - - - label_item - - - - - 2 - - - - - True - 6 - GTK_BUTTONBOX_END - - - True - True - True - gtk-cancel - True - 0 - - - - - True - True - True - gtk-help - True - 0 - - - 1 - - - - - True - True - True - gtk-ok - True - 0 - - - 2 - - - - - 3 - - - - - diff --git a/src/ui/gui/missing-val-dialog.c b/src/ui/gui/missing-val-dialog.c index c80362da..0c9831ae 100644 --- a/src/ui/gui/missing-val-dialog.c +++ b/src/ui/gui/missing-val-dialog.c @@ -218,18 +218,18 @@ on_delete (GtkWidget *w, GdkEvent *e, gpointer data) } -/* Creates the dialog structure from the xml */ +/* Creates the dialog structure */ struct missing_val_dialog * -missing_val_dialog_create (GtkBuilder *xml) +missing_val_dialog_create (GtkWindow *toplevel) { + GtkBuilder *xml = builder_new ("var-sheet-dialogs.ui"); + struct missing_val_dialog *dialog = g_malloc (sizeof (*dialog)); dialog->window = get_widget_assert (xml, "missing_values_dialog"); gtk_window_set_transient_for - (GTK_WINDOW (dialog->window), - GTK_WINDOW (get_widget_assert (xml, "data_editor"))); - + (GTK_WINDOW (dialog->window), toplevel); g_signal_connect_swapped (get_widget_assert (xml, "missing_val_cancel"), "clicked", G_CALLBACK (gtk_widget_hide), dialog->window); @@ -265,6 +265,8 @@ missing_val_dialog_create (GtkBuilder *xml) g_signal_connect (dialog->button_range, "toggled", G_CALLBACK (range), dialog); + g_object_unref (xml); + return dialog; } diff --git a/src/ui/gui/missing-val-dialog.h b/src/ui/gui/missing-val-dialog.h index 0a8ce344..7dc079d7 100644 --- a/src/ui/gui/missing-val-dialog.h +++ b/src/ui/gui/missing-val-dialog.h @@ -47,7 +47,7 @@ struct missing_val_dialog GtkWidget *discrete; }; -struct missing_val_dialog * missing_val_dialog_create (GtkBuilder *xml); +struct missing_val_dialog * missing_val_dialog_create (GtkWindow *toplevel); void missing_val_dialog_show (struct missing_val_dialog *dialog); diff --git a/src/ui/gui/psppire-var-sheet.c b/src/ui/gui/psppire-var-sheet.c index cfcce14c..bffcfd1d 100644 --- a/src/ui/gui/psppire-var-sheet.c +++ b/src/ui/gui/psppire-var-sheet.c @@ -31,6 +31,9 @@ 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 { @@ -176,17 +179,19 @@ psppire_var_sheet_get_property (GObject *object, } - 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; @@ -480,15 +485,41 @@ var_sheet_change_active_cell (PsppireVarSheet *vs, } +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); diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c index 3b56efad..f6d0ab73 100644 --- a/src/ui/gui/val-labs-dialog.c +++ b/src/ui/gui/val-labs-dialog.c @@ -364,12 +364,14 @@ on_select_row (GtkTreeView *treeview, /* Create a new dialog box (there should normally be only one)*/ struct val_labs_dialog * -val_labs_dialog_create (GtkBuilder *xml) +val_labs_dialog_create (GtkWindow *toplevel) { GtkTreeViewColumn *column; GtkCellRenderer *renderer ; + GtkBuilder *xml = builder_new ("var-sheet-dialogs.ui"); + struct val_labs_dialog *dialog = g_malloc (sizeof (*dialog)); dialog->window = get_widget_assert (xml,"val_labs_dialog"); @@ -377,8 +379,7 @@ val_labs_dialog_create (GtkBuilder *xml) dialog->label_entry = get_widget_assert (xml,"label_entry"); gtk_window_set_transient_for - (GTK_WINDOW (dialog->window), - GTK_WINDOW (get_widget_assert (xml, "data_editor"))); + (GTK_WINDOW (dialog->window), toplevel); dialog->add_button = get_widget_assert (xml, "val_labs_add"); dialog->remove_button = get_widget_assert (xml, "val_labs_remove"); @@ -435,6 +436,8 @@ val_labs_dialog_create (GtkBuilder *xml) dialog->labs = 0; + g_object_unref (xml); + return dialog; } diff --git a/src/ui/gui/val-labs-dialog.h b/src/ui/gui/val-labs-dialog.h index 23e7cab6..6b1d0e37 100644 --- a/src/ui/gui/val-labs-dialog.h +++ b/src/ui/gui/val-labs-dialog.h @@ -31,7 +31,7 @@ struct val_labs; -struct val_labs_dialog * val_labs_dialog_create (GtkBuilder *); +struct val_labs_dialog * val_labs_dialog_create (GtkWindow *); void val_labs_dialog_show (struct val_labs_dialog *); diff --git a/src/ui/gui/var-sheet-dialogs.glade b/src/ui/gui/var-sheet-dialogs.glade new file mode 100644 index 00000000..c12790bb --- /dev/null +++ b/src/ui/gui/var-sheet-dialogs.glade @@ -0,0 +1,921 @@ + + + + + + 6 + Variable Type + False + True + 485 + GDK_WINDOW_TYPE_HINT_DIALOG + True + True + + + True + 5 + 5 + + + True + 13 + True + + + True + True + Numeric + True + 0 + True + True + + + False + False + + + + + True + True + Comma + True + 0 + True + radiobutton1 + + + False + False + 1 + + + + + True + True + Dot + True + 0 + True + radiobutton1 + + + False + False + 2 + + + + + True + True + Scientific notation + True + 0 + True + radiobutton1 + + + False + False + 3 + + + + + True + True + Date + True + 0 + True + radiobutton1 + + + False + False + 4 + + + + + True + True + Dollar + True + 0 + True + radiobutton1 + + + False + False + 5 + + + + + True + True + Custom currency + True + 0 + True + radiobutton1 + + + False + False + 6 + + + + + True + True + String + True + 0 + True + radiobutton1 + + + False + False + 7 + + + + + False + False + + + + + True + 10 + + + 20 + 194 + True + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + False + + + + + False + False + + + + + 15 + + + 1 + 120 + True + True + GTK_POLICY_NEVER + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + False + + + + + + + True + 0 + + + True + 12 + + + True + True + + + True + positive + + + + + True + negative + + + 1 + + + + + + + + + True + Sample + True + + + label_item + + + + + GTK_PACK_END + 1 + + + + + 1 + + + + + True + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + False + + + + + 2 + + + + + 100 + 50 + True + 2 + 2 + 2 + 1 + + + True + 0 + Decimal Places: + GTK_JUSTIFY_RIGHT + + + 1 + 2 + GTK_FILL + + + + + + 25 + True + + + 1 + 2 + + + + + + 25 + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + + + True + Width: + GTK_JUSTIFY_RIGHT + + + False + False + GTK_PACK_END + + + + + GTK_FILL + GTK_FILL + + + + + 3 + + + + + False + 1 + + + + + True + 5 + GTK_BUTTONBOX_START + + + True + True + True + gtk-ok + True + 0 + + + + + True + True + True + gtk-cancel + True + 0 + + + 1 + + + + + True + True + True + gtk-help + True + 0 + + + 2 + + + + + 2 + + + + + + + Value Labels + False + True + GDK_WINDOW_TYPE_HINT_DIALOG + True + True + + + True + 5 + + + True + 0 + + + True + 8 + 12 + + + True + 2 + 2 + 5 + + + True + 5 + + + True + False + True + True + gtk-add + True + 0 + + + + + True + False + True + True + gtk-apply + True + 0 + + + 1 + + + + + True + False + True + True + gtk-remove + True + 0 + + + 2 + + + + + 1 + 2 + GTK_FILL + + + + + True + 5 + 2 + 2 + 5 + 4 + + + True + 0 + Value: + + + GTK_FILL + + + + + + True + 0 + Value Label: + + + 1 + 2 + GTK_FILL + + + + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + + + 85 + True + True + + + False + False + 1 + + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 2 + GTK_FILL + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_ETCHED_IN + + + True + True + False + False + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + + + + + True + Value Labels + True + + + label_item + + + + + 10 + + + + + True + 5 + 5 + GTK_BUTTONBOX_START + + + True + True + True + gtk-ok + True + 0 + + + + + True + True + True + gtk-cancel + True + 0 + + + 1 + + + + + True + True + True + gtk-help + True + 0 + + + 2 + + + + + False + False + GTK_PACK_END + 1 + + + + + + + 12 + Missing Values + False + True + GDK_WINDOW_TYPE_HINT_DIALOG + True + True + + + True + 12 + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + + + + + + True + True + _No missing values + True + 0 + True + True + + + label_item + + + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + 5 + 6 + True + + + 75 + True + True + + + False + False + + + + + 75 + True + True + + + False + False + 1 + + + + + 75 + True + True + + + False + False + 2 + + + + + + + + + True + True + _Discrete missing values + True + False + 0 + True + no_missing + + + label_item + + + + + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + 3 + 2 + 6 + 6 + + + 75 + True + True + + + 1 + 2 + 2 + 3 + + + + + True + Di_screte value: + True + mv-discrete + + + 2 + 3 + + + + + 75 + True + True + + + 1 + 2 + 1 + 2 + + + + + True + _High: + True + mv-high + + + 1 + 2 + + + + + 75 + True + True + + + 1 + 2 + + + + + True + _Low: + True + mv-low + + + + + + + + + True + True + _Range plus one optional discrete missing value + True + False + 0 + True + no_missing + + + label_item + + + + + 2 + + + + + True + 6 + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + 0 + + + + + True + True + True + gtk-help + True + 0 + + + 1 + + + + + True + True + True + gtk-ok + True + 0 + + + 2 + + + + + 3 + + + + + + diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index 44afc84e..c433bf3b 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -321,14 +321,14 @@ set_format_type_from_treeview (GtkTreeView *treeview, gpointer data) -/* Create the structure from the XML definitions */ +/* Create the structure */ struct var_type_dialog * -var_type_dialog_create (GtkBuilder *xml) +var_type_dialog_create (GtkWindow *toplevel) { gint i; struct var_type_dialog *dialog = g_malloc (sizeof (struct var_type_dialog)); - g_assert (xml); + GtkBuilder *xml = builder_new ("var-sheet-dialogs.ui"); dialog->window = get_widget_assert (xml,"var_type_dialog"); dialog->active_button = -1; @@ -338,7 +338,7 @@ var_type_dialog_create (GtkBuilder *xml) G_CALLBACK (gtk_widget_hide_on_delete), NULL); gtk_window_set_transient_for (GTK_WINDOW (dialog->window), - GTK_WINDOW (get_widget_assert (xml, "data_editor"))); + toplevel); dialog->radioButton[BUTTON_NUMERIC] = get_widget_assert (xml,"radiobutton1"); @@ -554,10 +554,10 @@ var_type_dialog_create (GtkBuilder *xml) g_signal_connect (get_widget_assert (xml, "var_type_cancel") , "clicked", G_CALLBACK (hide_dialog), dialog); - - } + g_object_unref (xml); + return dialog; } diff --git a/src/ui/gui/var-type-dialog.h b/src/ui/gui/var-type-dialog.h index 536ba465..504b5c7a 100644 --- a/src/ui/gui/var-type-dialog.h +++ b/src/ui/gui/var-type-dialog.h @@ -84,7 +84,7 @@ struct var_type_dialog }; -struct var_type_dialog * var_type_dialog_create (GtkBuilder *xml); +struct var_type_dialog * var_type_dialog_create (GtkWindow *); void var_type_dialog_set_variable (struct var_type_dialog *dialog,