From b40f8032efcf6099f665ce8e7c0669bf0e9d655e Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 3 Jan 2009 21:45:47 +0900 Subject: [PATCH] Migrated rank and recode dialogs to GtkBuilder --- src/ui/gui/automake.mk | 10 +++--- src/ui/gui/rank-dialog.c | 64 ++++++++++++++++----------------- src/ui/gui/recode-dialog.c | 73 +++++++++++++++++++------------------- 3 files changed, 74 insertions(+), 73 deletions(-) diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 3f5d3076..15624497 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -65,10 +65,14 @@ src_ui_gui_psppire_LDADD = \ src_ui_gui_psppiredir = $(pkgdatadir) nodist_src_ui_gui_psppire_DATA = \ - $(top_srcdir)/src/ui/gui/oneway.ui + $(top_srcdir)/src/ui/gui/oneway.ui \ + $(top_srcdir)/src/ui/gui/rank.ui \ + $(top_srcdir)/src/ui/gui/recode.ui EXTRA_DIST += \ - $(top_srcdir)/src/ui/gui/oneway.glade + $(top_srcdir)/src/ui/gui/oneway.glade \ + $(top_srcdir)/src/ui/gui/rank.glade \ + $(top_srcdir)/src/ui/gui/recode.glade dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/data-editor.glade \ @@ -79,8 +83,6 @@ dist_src_ui_gui_psppire_DATA = \ $(top_srcdir)/src/ui/gui/message-dialog.glade \ $(top_srcdir)/src/ui/gui/output-viewer.glade \ $(top_srcdir)/src/ui/gui/psppire.glade \ - $(top_srcdir)/src/ui/gui/rank.glade \ - $(top_srcdir)/src/ui/gui/recode.glade \ $(top_srcdir)/src/ui/gui/regression.glade \ $(top_srcdir)/src/ui/gui/syntax-editor.glade \ $(top_srcdir)/src/ui/gui/text-data-import.glade \ diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c index 174ac6d0..bf44dced 100644 --- a/src/ui/gui/rank-dialog.c +++ b/src/ui/gui/rank-dialog.c @@ -224,73 +224,73 @@ rank_dialog (GObject *o, gpointer data) struct rank_dialog rd; - GladeXML *xml = XML_NEW ("rank.glade"); + GtkBuilder * builder = builder_new ("rank.ui"); - GtkWidget *vars = get_widget_assert (xml, "dict-treeview"); - GtkWidget *selector1 = get_widget_assert (xml, "psppire-selector1"); - GtkWidget *selector2 = get_widget_assert (xml, "psppire-selector2"); + GtkWidget *vars = get_widget_assert (builder, "dict-treeview"); + GtkWidget *selector1 = get_widget_assert (builder, "psppire-selector1"); + GtkWidget *selector2 = get_widget_assert (builder, "psppire-selector2"); - GtkWidget *types_button = get_widget_assert (xml, "button1"); - GtkWidget *ties_button = get_widget_assert (xml, "button2"); + GtkWidget *types_button = get_widget_assert (builder, "button1"); + GtkWidget *ties_button = get_widget_assert (builder, "button2"); PsppireVarStore *vs = NULL; g_object_get (de->data_editor, "var-store", &vs, NULL); rd.dict = vs->dict; - rd.rank_vars = get_widget_assert (xml, "variables-treeview"); - rd.group_vars = get_widget_assert (xml, "group-vars-treeview"); - rd.dialog = get_widget_assert (xml, "rank-dialog"); + rd.rank_vars = get_widget_assert (builder, "variables-treeview"); + rd.group_vars = get_widget_assert (builder, "group-vars-treeview"); + rd.dialog = get_widget_assert (builder, "rank-dialog"); rd.ascending_togglebutton = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "radiobutton1")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "radiobutton1")); rd.summary_togglebutton = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "summary-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "summary-checkbutton")); - rd.types_dialog = get_widget_assert (xml, "rank-types-dialog"); + rd.types_dialog = get_widget_assert (builder, "rank-types-dialog"); - rd.ntiles_entry = get_widget_assert (xml, "ntiles-entry"); + rd.ntiles_entry = get_widget_assert (builder, "ntiles-entry"); rd.func_button[RANK] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rank-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rank-checkbutton")); rd.func_button[SAVAGE] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "savage-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "savage-checkbutton")); rd.func_button[RFRACTION] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rfrac-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rfrac-checkbutton")); rd.func_button[PERCENT] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "percent-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "percent-checkbutton")); rd.func_button[N] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "sum-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "sum-checkbutton")); rd.func_button[NTILES] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "ntiles-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "ntiles-checkbutton")); rd.func_button[PROPORTION] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "prop-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "prop-checkbutton")); rd.func_button[NORMAL] = - GTK_TOGGLE_BUTTON (get_widget_assert (xml, "normal-checkbutton")); + GTK_TOGGLE_BUTTON (get_widget_assert (builder, "normal-checkbutton")); - rd.formula_box = get_widget_assert (xml, "formula-frame"); + rd.formula_box = get_widget_assert (builder, "formula-frame"); - rd.blom = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "blom-button")); - rd.tukey = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "tukey-button")); - rd.rankit = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "rankit-button")); - rd.vw = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "vw-button")); + rd.blom = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "blom-button")); + rd.tukey = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "tukey-button")); + rd.rankit = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "rankit-button")); + rd.vw = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "vw-button")); /* Ties dialog */ - rd.ties_dialog = PSPPIRE_DIALOG (get_widget_assert (xml, "ties-dialog")); + rd.ties_dialog = PSPPIRE_DIALOG (get_widget_assert (builder, "ties-dialog")); - rd.mean = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "mean-button")); - rd.low = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "low-button")); - rd.high = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "high-button")); - rd.condense = GTK_TOGGLE_BUTTON (get_widget_assert (xml, "condense-button")); + rd.mean = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "mean-button")); + rd.low = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "low-button")); + rd.high = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "high-button")); + rd.condense = GTK_TOGGLE_BUTTON (get_widget_assert (builder, "condense-button")); g_signal_connect_swapped (rd.func_button[PROPORTION], "toggled", G_CALLBACK (set_sensitivity), @@ -371,7 +371,7 @@ rank_dialog (GObject *o, gpointer data) break; } - g_object_unref (xml); + g_object_unref (builder); } diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index 31436746..9d1ad79d 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -842,28 +842,27 @@ recode_dialog (struct data_editor *de, gboolean diff) struct recode_dialog rd; - GladeXML *xml = XML_NEW ("recode.glade"); + GtkBuilder *builder = builder_new ("recode.ui"); + GtkWidget *selector = get_widget_assert (builder, "psppire-selector1"); - GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); + GtkWidget *oldandnew = get_widget_assert (builder, "button1"); - GtkWidget *oldandnew = get_widget_assert (xml, "button1"); - - GtkWidget *output_variable_box = get_widget_assert (xml,"frame4"); + GtkWidget *output_variable_box = get_widget_assert (builder,"frame4"); PsppireVarStore *vs = NULL; g_object_get (de->data_editor, "var-store", &vs, NULL); - rd.change_button = get_widget_assert (xml, "change-button"); + rd.change_button = get_widget_assert (builder, "change-button"); - rd.dialog = get_widget_assert (xml, "recode-dialog"); - rd.dict_treeview = get_widget_assert (xml, "treeview1"); - rd.variable_treeview = get_widget_assert (xml, "treeview2"); - rd.new_name_entry = get_widget_assert (xml, "dest-name-entry"); - rd.new_label_entry = get_widget_assert (xml, "dest-label-entry"); + rd.dialog = get_widget_assert (builder, "recode-dialog"); + rd.dict_treeview = get_widget_assert (builder, "treeview1"); + rd.variable_treeview = get_widget_assert (builder, "treeview2"); + rd.new_name_entry = get_widget_assert (builder, "dest-name-entry"); + rd.new_label_entry = get_widget_assert (builder, "dest-label-entry"); rd.dict = vs->dict; @@ -963,40 +962,40 @@ recode_dialog (struct data_editor *de, gboolean diff) /* Set up the Old & New Values subdialog */ { - rd.string_button = get_widget_assert (xml, "checkbutton1"); - rd.width_entry = get_widget_assert (xml, "spinbutton1"); + rd.string_button = get_widget_assert (builder, "checkbutton1"); + rd.width_entry = get_widget_assert (builder, "spinbutton1"); - rd.convert_button = get_widget_assert (xml, "checkbutton2"); + rd.convert_button = get_widget_assert (builder, "checkbutton2"); - rd.ov_range_lower_entry = get_widget_assert (xml, "entry5"); - rd.ov_range_upper_entry = get_widget_assert (xml, "entry3"); - rd.ov_low_up_entry = get_widget_assert (xml, "entry6"); - rd.ov_high_down_entry = get_widget_assert (xml, "entry7"); + rd.ov_range_lower_entry = get_widget_assert (builder, "entry5"); + rd.ov_range_upper_entry = get_widget_assert (builder, "entry3"); + rd.ov_low_up_entry = get_widget_assert (builder, "entry6"); + rd.ov_high_down_entry = get_widget_assert (builder, "entry7"); - rd.new_value_entry = get_widget_assert (xml, "entry1"); - rd.ov_value_entry = get_widget_assert (xml, "entry2"); + rd.new_value_entry = get_widget_assert (builder, "entry1"); + rd.ov_value_entry = get_widget_assert (builder, "entry2"); - rd.toggle[BUTTON_NEW_VALUE] = get_widget_assert (xml, "radiobutton1"); - rd.toggle[BUTTON_NEW_SYSMIS] = get_widget_assert (xml, "radiobutton2"); - rd.toggle[BUTTON_NEW_COPY] = get_widget_assert (xml, "radiobutton3"); - rd.toggle[BUTTON_OLD_VALUE] = get_widget_assert (xml, "radiobutton4"); - rd.toggle[BUTTON_OLD_SYSMIS] = get_widget_assert (xml, "radiobutton6"); - rd.toggle[BUTTON_OLD_MISSING]= get_widget_assert (xml, "radiobutton7"); - rd.toggle[BUTTON_OLD_RANGE] = get_widget_assert (xml, "radiobutton8"); - rd.toggle[BUTTON_OLD_LOW_UP] = get_widget_assert (xml, "radiobutton10"); - rd.toggle[BUTTON_OLD_HIGH_DOWN] = get_widget_assert (xml, "radiobutton5"); - rd.toggle[BUTTON_OLD_ELSE] = get_widget_assert (xml, "radiobutton11"); + rd.toggle[BUTTON_NEW_VALUE] = get_widget_assert (builder, "radiobutton1"); + rd.toggle[BUTTON_NEW_SYSMIS] = get_widget_assert (builder, "radiobutton2"); + rd.toggle[BUTTON_NEW_COPY] = get_widget_assert (builder, "radiobutton3"); + rd.toggle[BUTTON_OLD_VALUE] = get_widget_assert (builder, "radiobutton4"); + rd.toggle[BUTTON_OLD_SYSMIS] = get_widget_assert (builder, "radiobutton6"); + rd.toggle[BUTTON_OLD_MISSING]= get_widget_assert (builder, "radiobutton7"); + rd.toggle[BUTTON_OLD_RANGE] = get_widget_assert (builder, "radiobutton8"); + rd.toggle[BUTTON_OLD_LOW_UP] = get_widget_assert (builder, "radiobutton10"); + rd.toggle[BUTTON_OLD_HIGH_DOWN] = get_widget_assert (builder, "radiobutton5"); + rd.toggle[BUTTON_OLD_ELSE] = get_widget_assert (builder, "radiobutton11"); - rd.new_copy_label = get_widget_assert (xml, "label3"); - rd.strings_box = get_widget_assert (xml, "table3"); + rd.new_copy_label = get_widget_assert (builder, "label3"); + rd.strings_box = get_widget_assert (builder, "table3"); rd.old_and_new_dialog = - PSPPIRE_DIALOG (get_widget_assert (xml, "old-new-values-dialog")); + PSPPIRE_DIALOG (get_widget_assert (builder, "old-new-values-dialog")); gtk_window_set_transient_for (GTK_WINDOW (rd.old_and_new_dialog), de->parent.window); - rd.acr = PSPPIRE_ACR (get_widget_assert (xml, "psppire-acr1")); + rd.acr = PSPPIRE_ACR (get_widget_assert (builder, "psppire-acr1")); g_signal_connect_swapped (rd.toggle[BUTTON_NEW_VALUE], "toggled", G_CALLBACK (set_acr), &rd); @@ -1047,11 +1046,11 @@ recode_dialog (struct data_editor *de, gboolean diff) g_signal_connect (rd.toggle[BUTTON_OLD_RANGE], "toggled", G_CALLBACK (toggle_sensitivity), - get_widget_assert (xml, "entry3")); + get_widget_assert (builder, "entry3")); g_signal_connect (rd.toggle[BUTTON_OLD_RANGE], "toggled", G_CALLBACK (toggle_sensitivity), - get_widget_assert (xml, "entry5")); + get_widget_assert (builder, "entry5")); g_signal_connect (rd.toggle[BUTTON_OLD_LOW_UP], "toggled", G_CALLBACK (toggle_sensitivity), rd.ov_low_up_entry); @@ -1111,7 +1110,7 @@ recode_dialog (struct data_editor *de, gboolean diff) gtk_list_store_clear (GTK_LIST_STORE (rd.value_map)); g_object_unref (rd.value_map); - g_object_unref (xml); + g_object_unref (builder); } /* Initialise VAL to reflect the current status of RD */ -- 2.30.2