From: John Darrington Date: Thu, 1 Jan 2009 07:35:50 +0000 (+0900) Subject: Refactor common code in dialog implementations X-Git-Tag: v0.7.3~296^2~15 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c4f035bfad520dc54f0d5a9e30e36d4fb009efc;p=pspp-builds.git Refactor common code in dialog implementations --- diff --git a/src/ui/gui/comments-dialog.c b/src/ui/gui/comments-dialog.c index 9b521a76..34c9957d 100644 --- a/src/ui/gui/comments-dialog.c +++ b/src/ui/gui/comments-dialog.c @@ -21,7 +21,7 @@ #include "psppire-data-window.h" #include "psppire-data-editor.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include "psppire-var-store.h" #include @@ -168,6 +168,7 @@ comments_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&cd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -178,11 +179,7 @@ comments_dialog (GObject *o, gpointer data) { gchar *syntax = generate_syntax (&cd); - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c index 17611ac8..96ea6630 100644 --- a/src/ui/gui/compute-dialog.c +++ b/src/ui/gui/compute-dialog.c @@ -27,7 +27,7 @@ #include #include -#include "psppire-syntax-window.h" +#include "helper.h" static void function_list_populate (GtkTreeView *tv); @@ -447,6 +447,7 @@ compute_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&scd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -457,11 +458,7 @@ compute_dialog (GObject *o, gpointer data) { gchar *syntax = generate_syntax (&scd); - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index dfe03e3c..9654a27c 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -487,6 +487,7 @@ crosstabs_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&cd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -497,11 +498,7 @@ crosstabs_dialog (GObject *o, gpointer data) { gchar *syntax = generate_syntax (&cd); - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/descriptives-dialog.c b/src/ui/gui/descriptives-dialog.c index f909ed02..aaed7eee 100644 --- a/src/ui/gui/descriptives-dialog.c +++ b/src/ui/gui/descriptives-dialog.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -263,6 +263,7 @@ descriptives_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&scd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -272,13 +273,7 @@ descriptives_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&scd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break; diff --git a/src/ui/gui/examine-dialog.c b/src/ui/gui/examine-dialog.c index 33f8b129..3c11a08a 100644 --- a/src/ui/gui/examine-dialog.c +++ b/src/ui/gui/examine-dialog.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -346,13 +346,7 @@ examine_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&ex_d); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break; diff --git a/src/ui/gui/frequencies-dialog.c b/src/ui/gui/frequencies-dialog.c index cba8573d..978bfcd2 100644 --- a/src/ui/gui/frequencies-dialog.c +++ b/src/ui/gui/frequencies-dialog.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -393,6 +393,7 @@ frequencies_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&fd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -402,13 +403,7 @@ frequencies_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&fd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break; diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index c8b1a745..12003e2a 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -20,6 +20,8 @@ */ #include +#include "psppire-syntax-window.h" + #include #include @@ -297,3 +299,14 @@ clone_list_store (const GtkListStore *src) } + + +void +paste_syntax_in_new_window (const gchar *syntax) +{ + GtkWidget *se = psppire_syntax_window_new (); + + gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); + + gtk_widget_show (se); +} diff --git a/src/ui/gui/helper.h b/src/ui/gui/helper.h index 1a620908..25ff0aa0 100644 --- a/src/ui/gui/helper.h +++ b/src/ui/gui/helper.h @@ -26,6 +26,10 @@ #include #include + + +void paste_syntax_in_new_window (const gchar *syntax); + /* GtkRecentChooserMenu was added in 2.10.0 but it didn't support GtkRecentFilters until diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c index 505d9039..45e88807 100644 --- a/src/ui/gui/oneway-anova-dialog.c +++ b/src/ui/gui/oneway-anova-dialog.c @@ -31,7 +31,7 @@ #include -#include "psppire-syntax-window.h" +#include "helper.h" #include "gettext.h" @@ -232,6 +232,7 @@ oneway_anova_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&ow); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -241,12 +242,7 @@ oneway_anova_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&ow); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 37747e07..91b96f64 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -308,8 +308,6 @@ delete_variable_callback (GObject *obj, gint dict_index, #endif } - - static void variable_changed_callback (GObject *obj, gint var_num, gpointer data) { @@ -319,7 +317,6 @@ variable_changed_callback (GObject *obj, gint var_num, gpointer data) psppire_sheet_column_columns_changed (PSPPIRE_SHEET_COLUMN (store), var_num, 1); - psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), -1, var_num, -1, var_num); diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index fdc4087b..21226ea5 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -1705,8 +1705,7 @@ psppire_data_window_init (PsppireDataWindow *de) de->data_sheet_cases_popup_menu = GTK_MENU (create_data_sheet_cases_popup_menu (de)); - PSPPIRE_WINDOW (de)->menu = GTK_MENU (get_widget_assert (de->xml,"Windows_menu")); - g_object_ref (PSPPIRE_WINDOW (de)->menu); + PSPPIRE_WINDOW (de)->menu = GTK_MENU_SHELL (get_widget_assert (de->xml,"Windows_menu")); g_object_set (de->data_editor, "datasheet-column-menu", de->data_sheet_variable_popup_menu, diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 766134b2..c8fede09 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -75,8 +75,6 @@ psppire_syntax_window_finalize (GObject *object) { GObjectClass *class = G_OBJECT_GET_CLASS (object); - PsppireSyntaxWindow *window = PSPPIRE_SYNTAX_WINDOW (object); - GObjectClass *parent_class = g_type_class_peek_parent (class); if (G_OBJECT_CLASS (parent_class)->finalize) @@ -575,8 +573,7 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) "activate", G_CALLBACK (psppire_window_minimise_all), NULL); - PSPPIRE_WINDOW (window)->menu = GTK_MENU (get_widget_assert (xml,"windows_menu")); - g_object_ref (PSPPIRE_WINDOW (window)->menu); + PSPPIRE_WINDOW (window)->menu = GTK_MENU_SHELL (get_widget_assert (xml,"windows_menu")); g_object_unref (xml); diff --git a/src/ui/gui/psppire-syntax-window.h b/src/ui/gui/psppire-syntax-window.h index 18946413..c434e07f 100644 --- a/src/ui/gui/psppire-syntax-window.h +++ b/src/ui/gui/psppire-syntax-window.h @@ -18,7 +18,6 @@ #ifndef __PSPPIRE_SYNTAX_WINDOW_H__ #define __PSPPIRE_SYNTAX_WINDOW_H__ - #include #include #include diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c index c75f64f2..307e3733 100644 --- a/src/ui/gui/rank-dialog.c +++ b/src/ui/gui/rank-dialog.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -349,6 +349,7 @@ rank_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&rd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -358,13 +359,7 @@ rank_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&rd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break; diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index da32620b..642dae02 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include "psppire-acr.h" @@ -1085,6 +1085,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&rd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -1094,12 +1095,7 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&rd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/regression-dialog.c b/src/ui/gui/regression-dialog.c index 4988261a..b0c11b07 100644 --- a/src/ui/gui/regression-dialog.c +++ b/src/ui/gui/regression-dialog.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -307,6 +307,7 @@ regression_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&rd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -316,12 +317,7 @@ regression_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&rd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c index 9d711d31..58b2879d 100644 --- a/src/ui/gui/select-cases-dialog.c +++ b/src/ui/gui/select-cases-dialog.c @@ -26,7 +26,7 @@ #include "dict-display.h" #include "widget-io.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include @@ -354,6 +354,7 @@ select_cases_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&scd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -363,12 +364,7 @@ select_cases_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&scd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c index 9e294861..6da083be 100644 --- a/src/ui/gui/sort-cases-dialog.c +++ b/src/ui/gui/sort-cases-dialog.c @@ -25,7 +25,7 @@ #include "dict-display.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" static void refresh (PsppireDialog *dialog, GtkTreeView *dest) @@ -143,6 +143,7 @@ sort_cases_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&scd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -152,12 +153,7 @@ sort_cases_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&scd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/split-file-dialog.c b/src/ui/gui/split-file-dialog.c index f548a7aa..c44d5591 100644 --- a/src/ui/gui/split-file-dialog.c +++ b/src/ui/gui/split-file-dialog.c @@ -23,7 +23,7 @@ #include "psppire-data-window.h" #include "dict-display.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include #include @@ -221,6 +221,7 @@ split_file_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&sfd); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -230,12 +231,7 @@ split_file_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&sfd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index a54a94ad..4ceab4d8 100644 --- a/src/ui/gui/t-test-independent-samples-dialog.c +++ b/src/ui/gui/t-test-independent-samples-dialog.c @@ -32,7 +32,7 @@ #include #include -#include "psppire-syntax-window.h" +#include "helper.h" #include @@ -475,6 +475,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&tt_d); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -484,13 +485,7 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&tt_d); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break; diff --git a/src/ui/gui/t-test-one-sample.c b/src/ui/gui/t-test-one-sample.c index 6ce649b9..98584501 100644 --- a/src/ui/gui/t-test-one-sample.c +++ b/src/ui/gui/t-test-one-sample.c @@ -31,7 +31,6 @@ #include "t-test-options.h" #include -#include "psppire-syntax-window.h" #include #define _(msgid) gettext (msgid) @@ -181,6 +180,7 @@ t_test_one_sample_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&tt_d); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -191,11 +191,7 @@ t_test_one_sample_dialog (GObject *o, gpointer data) { gchar *syntax = generate_syntax (&tt_d); - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/t-test-paired-samples.c b/src/ui/gui/t-test-paired-samples.c index b84bee9b..58b68b2f 100644 --- a/src/ui/gui/t-test-paired-samples.c +++ b/src/ui/gui/t-test-paired-samples.c @@ -31,8 +31,6 @@ #include "dialog-common.h" #include "psppire-dialog.h" -#include "psppire-syntax-window.h" - #include "helper.h" #include "psppire-var-ptr.h" @@ -255,6 +253,7 @@ t_test_paired_samples_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (&tt_d); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -264,12 +263,7 @@ t_test_paired_samples_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&tt_d); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/text-data-import-dialog.c b/src/ui/gui/text-data-import-dialog.c index f749de38..fa55bba5 100644 --- a/src/ui/gui/text-data-import-dialog.c +++ b/src/ui/gui/text-data-import-dialog.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include "error.h" #include "xalloc.h" @@ -293,13 +293,7 @@ text_data_import_assistant (GObject *o, gpointer de_) case PSPPIRE_RESPONSE_PASTE: { char *syntax = generate_syntax (ia); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); free (syntax); } break; diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c index 1a98a6a5..9e8c18f4 100644 --- a/src/ui/gui/transpose-dialog.c +++ b/src/ui/gui/transpose-dialog.c @@ -23,7 +23,7 @@ #include "psppire-data-window.h" #include "dict-display.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include "dialog-common.h" @@ -129,6 +129,7 @@ transpose_dialog (GObject *o, gpointer data) case GTK_RESPONSE_OK: { gchar *syntax = generate_syntax (vs->dict, xml); + struct getl_interface *sss = create_syntax_string_source (syntax); execute_syntax (sss); @@ -138,12 +139,7 @@ transpose_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (vs->dict, xml); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/variable-info-dialog.c b/src/ui/gui/variable-info-dialog.c index 09b545bd..43a3832c 100644 --- a/src/ui/gui/variable-info-dialog.c +++ b/src/ui/gui/variable-info-dialog.c @@ -29,7 +29,7 @@ #include "helper.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include @@ -214,12 +214,7 @@ variable_info_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (GTK_TREE_VIEW (treeview)); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); + paste_syntax_in_new_window (syntax); g_free (syntax); } diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c index 121a523d..9d103e1c 100644 --- a/src/ui/gui/weight-cases-dialog.c +++ b/src/ui/gui/weight-cases-dialog.c @@ -23,7 +23,7 @@ #include "psppire-data-window.h" #include "dict-display.h" #include -#include "psppire-syntax-window.h" +#include "helper.h" #include #include @@ -172,13 +172,7 @@ weight_cases_dialog (GObject *o, gpointer data) case PSPPIRE_RESPONSE_PASTE: { gchar *syntax = generate_syntax (&wcd); - - GtkWidget *se = psppire_syntax_window_new (); - - gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1); - - gtk_widget_show (se); - + paste_syntax_in_new_window (syntax); g_free (syntax); } break;