Merge branch 'master' of /home/john/Development/pspp-window-manager
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 20 Feb 2009 01:26:17 +0000 (10:26 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 20 Feb 2009 01:26:17 +0000 (10:26 +0900)
Conflicts:

src/ui/gui/crosstabs-dialog.c
src/ui/gui/helper.c

src/ui/gui/crosstabs-dialog.c
src/ui/gui/helper.c
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-output-window.c
src/ui/gui/psppire-syntax-window.c
src/ui/gui/psppire-syntax-window.h
src/ui/gui/psppire.c
src/ui/gui/syntax-editor.glade

index a3498d1f6d72c4b70b72a46ccc6569721898c29e..188c4aaa92c66c339c829bef59df4748f6e23516 100644 (file)
@@ -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);
index 6a3a0f9e6ce0b83ee360f62ca9f790205084da7e..1d4ae02729348d495ed79a3ac9938cd44f3939de 100644 (file)
@@ -321,7 +321,6 @@ clone_list_store (const GtkListStore *src)
 }
 
 
-
 void
 paste_syntax_in_new_window (const gchar *syntax)
 {
index 90e749d318af0bab38a7c7f42450e88fe16b2a10..0716804ed5f02a1f5d05536ce5c241cc53abe5ae 100644 (file)
@@ -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);
 }
 
 
index 5fc52e9bea1561177bc5ce33917f7e3a60584f42..89075424e0c6a1465098e68f41009cff05ba9147 100644 (file)
@@ -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);
 }
 
 
index 37bfd35cabe3b086ae6f43edc18763e7a4f0b1c0..31f4966ef33948495e7d65898059776c7314bf79 100644 (file)
@@ -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);
 
index c434e07fab74bee695c23fa3c7817c818221e61f..2144b86fe6f44165575e93c8eb232e458471b19a 100644 (file)
@@ -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
index bdd5ad5332f4062d4b0bf6927a42ea2b57223d30..b87a29f2a48db9d12c692e9a126b66e2f199f2f9 100644 (file)
@@ -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;
       }
index 8895c8f3aa8d78ffee6d663d789d79c92cc28ae3..8f565e12e987e14e3a278ab9aede0447d102f70c 100644 (file)
@@ -3,31 +3,6 @@
 
 <glade-interface>
 
-<widget class="GtkWindow" id="syntax_editor">
-  <property name="default_width">640</property>
-  <property name="default_height">480</property>
-  <property name="can_focus">True</property>
-  <property name="title" translatable="yes">Psppire Syntax Editor</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-
-  <child>
-    <widget class="GtkVBox" id="vbox14">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child>
        <widget class="GtkMenuBar" id="menubar2">
          <property name="visible">True</property>
          <property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
            </widget>
          </child>
        </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">False</property>
-         <property name="fill">False</property>
-       </packing>
-      </child>
-
-      <child>
+
+
        <widget class="GtkScrolledWindow" id="scrolledwindow8">
          <property name="visible">True</property>
          <property name="can_focus">True</property>
            </widget>
          </child>
        </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">True</property>
-         <property name="fill">True</property>
-       </packing>
-      </child>
-
-      <child>
+
        <widget class="GtkStatusbar" id="statusbar2">
          <property name="visible">True</property>
          <property name="has_resize_grip">True</property>
        </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">False</property>
-         <property name="fill">False</property>
-       </packing>
-      </child>
-    </widget>
-  </child>
-</widget>
 
 </glade-interface>