From: John Darrington Date: Fri, 20 Feb 2009 01:26:17 +0000 (+0900) Subject: Merge branch 'master' of /home/john/Development/pspp-window-manager X-Git-Tag: v0.7.3~296^2~8 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=deb4fd96c0c171fc8eb64f7f1e7f5c2af4931416;hp=8953baa61127d6d3b91f763663ea647bf3e4e793;p=pspp-builds.git Merge branch 'master' of /home/john/Development/pspp-window-manager Conflicts: src/ui/gui/crosstabs-dialog.c src/ui/gui/helper.c --- diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index a3498d1f..188c4aaa 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -388,7 +388,6 @@ crosstabs_dialog (GObject *o, gpointer data) struct crosstabs_dialog cd; GtkBuilder *xml = builder_new ("crosstabs.ui"); - PsppireVarStore *vs = NULL; PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (data); diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index 6a3a0f9e..1d4ae027 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -321,7 +321,6 @@ clone_list_store (const GtkListStore *src) } - void paste_syntax_in_new_window (const gchar *syntax) { diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 90e749d3..0716804e 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -100,19 +100,15 @@ psppire_data_window_get_type (void) return psppire_data_window_type; } +static GObjectClass *parent_class ; static void psppire_data_window_finalize (GObject *object) { PsppireDataWindow *de = PSPPIRE_DATA_WINDOW (object); - GObjectClass *class = G_OBJECT_GET_CLASS (object); - - GObjectClass *parent_class = g_type_class_peek_parent (class); - g_object_unref (de->xml); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -121,6 +117,7 @@ psppire_data_window_finalize (GObject *object) static void psppire_data_window_class_init (PsppireDataWindowClass *class) { + parent_class = g_type_class_peek_parent (class); } diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 5fc52e9b..89075424 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -75,24 +75,20 @@ psppire_output_window_get_type (void) return psppire_output_window_type; } +static GObjectClass *parent_class; static void psppire_output_window_finalize (GObject *object) { - GObjectClass *class = G_OBJECT_GET_CLASS (object); - - GObjectClass *parent_class = g_type_class_peek_parent (class); - - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); - } static void psppire_output_window_class_init (PsppireOutputWindowClass *class) { + parent_class = g_type_class_peek_parent (class); } diff --git a/src/ui/gui/psppire-syntax-window.c b/src/ui/gui/psppire-syntax-window.c index 37bfd35c..31f4966e 100644 --- a/src/ui/gui/psppire-syntax-window.c +++ b/src/ui/gui/psppire-syntax-window.c @@ -70,13 +70,11 @@ psppire_syntax_window_get_type (void) return psppire_syntax_window_type; } +static GObjectClass *parent_class ; + static void psppire_syntax_window_finalize (GObject *object) { - GObjectClass *class = G_OBJECT_GET_CLASS (object); - - GObjectClass *parent_class = g_type_class_peek_parent (class); - if (G_OBJECT_CLASS (parent_class)->finalize) (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -85,6 +83,7 @@ psppire_syntax_window_finalize (GObject *object) static void psppire_syntax_window_class_init (PsppireSyntaxWindowClass *class) { + parent_class = g_type_class_peek_parent (class); } @@ -248,8 +247,11 @@ save_editor_to_file (PsppireSyntaxWindow *se, if ( result ) { + gchar *msg = g_strdup_printf (_("Saved file \"%s\""), filename); + gtk_statusbar_push (GTK_STATUSBAR (se->sb), se->text_context, msg); psppire_window_set_filename (PSPPIRE_WINDOW (se), filename); gtk_text_buffer_set_modified (buffer, FALSE); + g_free (msg); } return result; @@ -261,7 +263,6 @@ save_editor_to_file (PsppireSyntaxWindow *se, static void save_if_modified (PsppireSyntaxWindow *se) { - if ( TRUE == gtk_text_buffer_get_modified (se->buffer)) { gint response; @@ -282,14 +283,15 @@ save_if_modified (PsppireSyntaxWindow *se) gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_YES, GTK_RESPONSE_ACCEPT); + gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_NO, GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); @@ -472,6 +474,11 @@ open_syntax_window (GtkMenuItem *menuitem, gpointer parent) } +static void +on_text_changed (GtkTextBuffer *buffer, PsppireSyntaxWindow *window) +{ + gtk_statusbar_pop (GTK_STATUSBAR (window->sb), window->text_context); +} extern struct source_stream *the_source_stream ; @@ -483,29 +490,31 @@ psppire_syntax_window_init (PsppireSyntaxWindow *window) GtkWidget *menubar = get_widget_assert (xml, "menubar2"); GtkWidget *sw = get_widget_assert (xml, "scrolledwindow8"); - GtkWidget *sb = get_widget_assert (xml, "statusbar2"); + GtkWidget *text_view = get_widget_assert (xml, "syntax_text_view"); window->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)); window->lexer = lex_create (the_source_stream); + window->sb = get_widget_assert (xml, "statusbar2"); + window->text_context = gtk_statusbar_get_context_id (GTK_STATUSBAR (window->sb), "Text Context"); + + g_signal_connect (window->buffer, "changed", G_CALLBACK (on_text_changed), window); + connect_help (xml); gtk_container_add (GTK_CONTAINER (window), box); g_object_ref (menubar); - gtk_widget_unparent (menubar); g_object_ref (sw); - gtk_widget_unparent (sw); - g_object_ref (sb); - gtk_widget_unparent (sb); + g_object_ref (window->sb); gtk_box_pack_start (GTK_BOX (box), menubar, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (box), sb, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (box), window->sb, FALSE, TRUE, 0); gtk_widget_show_all (box); diff --git a/src/ui/gui/psppire-syntax-window.h b/src/ui/gui/psppire-syntax-window.h index c434e07f..2144b86f 100644 --- a/src/ui/gui/psppire-syntax-window.h +++ b/src/ui/gui/psppire-syntax-window.h @@ -49,6 +49,8 @@ struct _PsppireSyntaxWindow GtkTextBuffer *buffer; /* The buffer which contains the text */ struct lexer *lexer; /* Lexer to parse syntax */ + GtkWidget *sb; + guint text_context; }; struct _PsppireSyntaxWindowClass diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index bdd5ad53..b87a29f2 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -295,7 +295,7 @@ parse_non_options (int key, char *arg, struct argp_state *state) ds_destroy (&syntax); - psppire_window_set_filename (the_data_window, arg); + psppire_window_set_filename (PSPPIRE_WINDOW (the_data_window), arg); break; } diff --git a/src/ui/gui/syntax-editor.glade b/src/ui/gui/syntax-editor.glade index 8895c8f3..8f565e12 100644 --- a/src/ui/gui/syntax-editor.glade +++ b/src/ui/gui/syntax-editor.glade @@ -3,31 +3,6 @@ - - 640 - 480 - True - Psppire Syntax Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - True GTK_PACK_DIRECTION_LTR @@ -275,14 +250,8 @@ - - 0 - False - False - - - - + + True True @@ -311,26 +280,10 @@ - - 0 - True - True - - - - + True True - - 0 - False - False - - - - -