Edit|Options: Add fields to change behaviour of output window.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 27 Mar 2017 17:30:28 +0000 (19:30 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 27 Mar 2017 17:30:28 +0000 (19:30 +0200)
src/ui/gui/options-dialog.c
src/ui/gui/options.ui
src/ui/gui/psppire-output-window.c

index 45f69f5226d1f61d3410a2fae4092d6f79ffdad2..e2c28940398bdb4b2be67f32898ed849146cc3c6 100644 (file)
@@ -41,6 +41,10 @@ struct options_dialog
   GtkWidget *sort_names;
   GtkWidget *sort_labels;
   GtkWidget *sort_none;
+
+  GtkWidget *maximize;
+  GtkWidget *alert;
+  GtkWidget *raise;
 };
 
 GType
@@ -83,9 +87,12 @@ options_dialog (PsppireDataWindow *de)
   fd.sort_names  = get_widget_assert (fd.xml, "radiobutton-sort-by-name");
   fd.sort_none   = get_widget_assert (fd.xml, "radiobutton-unsorted");
 
+  fd.maximize = get_widget_assert (fd.xml, "checkbutton-maximize");
+  fd.alert    = get_widget_assert (fd.xml, "checkbutton-alert");
+  fd.raise    = get_widget_assert (fd.xml, "checkbutton-raise");
+  
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (de));
 
-
   fd.conf = psppire_conf_new ();
 
   if (psppire_conf_get_boolean (fd.conf,
@@ -116,6 +123,26 @@ options_dialog (PsppireDataWindow *de)
       break;
     }
 
+  {
+    gboolean status;
+    if (psppire_conf_get_boolean (fd.conf, "OutputWindowAction", "maximize",
+                                 &status))
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.maximize), status);
+  }
+  
+  {
+    gboolean status = true;
+    psppire_conf_get_boolean (fd.conf, "OutputWindowAction", "alert", &status);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.alert), status);
+  }
+  
+  {
+    gboolean status;
+    if (psppire_conf_get_boolean (fd.conf, "OutputWindowAction", "raise",
+                                 &status))
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd.raise), status);
+  }
+  
   const int result = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
 
   if (result == GTK_RESPONSE_OK)
@@ -143,6 +170,18 @@ options_dialog (PsppireDataWindow *de)
                             "VariableLists", "sort-order",
                             PSPP_TYPE_OPTIONS_VAR_ORDER,
                             sort_order);
+
+      psppire_conf_set_boolean (fd.conf, "OutputWindowAction", "maximize",
+                               gtk_toggle_button_get_active
+                               (GTK_TOGGLE_BUTTON (fd.maximize)));
+      
+      psppire_conf_set_boolean (fd.conf, "OutputWindowAction", "raise",
+                               gtk_toggle_button_get_active
+                               (GTK_TOGGLE_BUTTON (fd.raise)));
+
+      psppire_conf_set_boolean (fd.conf, "OutputWindowAction", "alert",
+                               gtk_toggle_button_get_active
+                               (GTK_TOGGLE_BUTTON (fd.alert)));
     }
 
   g_object_unref (fd.xml);
index a3f45d9e6ff5a819a66cf7b0e630607739cfe95f..75e827fcf357ffd7d7ad269d7461a1e3b2f79315 100644 (file)
           </packing>
         </child>
 
-
+        <child>
+          <object class="GtkFrame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkButtonBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="layout_style">spread</property>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton-maximize">
+                    <property name="label" translatable="yes">Ma_ximize</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                   <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton-raise">
+                    <property name="label" translatable="yes">_Raise</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                   <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="checkbutton-alert">
+                    <property name="label" translatable="yes">Aler_t</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                   <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Output Window Action</property>
+              </object>
+            </child>
+          </object>
+        </child>
+       
         <child>
           <object class="PsppireButtonbox" id="options-buttonbox">
             <property name="orientation">vertical</property>
index ba2dc8410d6aecc5f3bd439579634acfaeda6992..bd5047a7bc1430f1d0fb8039ab75396874545385 100644 (file)
@@ -38,6 +38,7 @@
 #include "ui/gui/help-menu.h"
 #include "ui/gui/builder-wrapper.h"
 #include "ui/gui/psppire-output-view.h"
+#include "ui/gui/psppire-conf.h"
 #include "ui/gui/windows-menu.h"
 
 #include "gl/xalloc.h"
@@ -164,7 +165,27 @@ psppire_output_submit (struct output_driver *this,
       gtk_widget_show_all (GTK_WIDGET (pod->window));
     }
 
-  gtk_window_set_urgency_hint (GTK_WINDOW (pod->window), TRUE);
+  PsppireConf *conf = psppire_conf_new ();
+  {
+    gboolean status = true;
+    psppire_conf_get_boolean (conf, "OutputWindowAction", "alert",
+                             &status);
+    gtk_window_set_urgency_hint (GTK_WINDOW (pod->window), status);
+  }
+
+  {
+    gboolean status ;
+    if (psppire_conf_get_boolean (conf, "OutputWindowAction", "maximize",
+                                 &status) && status)
+      gtk_window_maximize (GTK_WINDOW (pod->window));
+  }
+
+  {
+    gboolean status ;
+    if (psppire_conf_get_boolean (conf, "OutputWindowAction", "raise",
+                                 &status) && status)
+      gtk_window_present (GTK_WINDOW (pod->window));
+  }
 }
 
 static struct output_driver_class psppire_output_class =