gnucash maint: Bug 699687 - Add a configuration option to not display "since last run" window when opening a file

Geert Janssens gjanssens at code.gnucash.org
Tue May 13 11:20:39 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/dcbeba9e (commit)
	from  https://github.com/Gnucash/gnucash/commit/eeb48d63 (commit)



commit dcbeba9ec369a1d2f4b7ade0a921bd559990ec44
Author: Simon Arlott <bugzilla.gnome.simon at arlott.org>
Date:   Tue May 13 17:12:01 2014 +0200

    Bug 699687 - Add a configuration option to not display "since last run" window when opening a file

diff --git a/src/gnome/dialog-sx-editor.c b/src/gnome/dialog-sx-editor.c
index b3fb1e8..3781455 100644
--- a/src/gnome/dialog-sx-editor.c
+++ b/src/gnome/dialog-sx-editor.c
@@ -1661,6 +1661,7 @@ sxed_excal_update_adapt_cb(GtkObject *o, gpointer ud)
 void
 on_sx_check_toggled_cb (GtkWidget *togglebutton, gpointer user_data)
 {
+    GtkWidget *widget_auto;
     GtkWidget *widget_notify;
     GHashTable *table;
 
@@ -1669,9 +1670,21 @@ on_sx_check_toggled_cb (GtkWidget *togglebutton, gpointer user_data)
 
     /* We need to use the hash table to find the required widget to activate. */
     table = g_object_get_data(G_OBJECT(user_data), "prefs_widget_hash");
+
+    /* "Auto-create" enables "notify before creation" setting */
+    widget_auto = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_SXED "/" GNC_PREF_CREATE_AUTO);
     widget_notify = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_SXED "/" GNC_PREF_NOTIFY);
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(togglebutton)))
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget_auto)))
+        gtk_widget_set_sensitive(widget_notify, TRUE);
+    else
+        gtk_widget_set_sensitive(widget_notify, FALSE);
+
+    /* "Run when opened" enables "show notification window" setting */
+    widget_auto = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_STARTUP "/" GNC_PREF_RUN_AT_FOPEN);
+    widget_notify = g_hash_table_lookup(table, "pref/" GNC_PREFS_GROUP_STARTUP "/" GNC_PREF_SHOW_AT_FOPEN);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget_auto)))
         gtk_widget_set_sensitive(widget_notify, TRUE);
     else
         gtk_widget_set_sensitive(widget_notify, FALSE);
diff --git a/src/gnome/dialog-sx-since-last-run.c b/src/gnome/dialog-sx-since-last-run.c
index 1f13bec..f9bc24f 100644
--- a/src/gnome/dialog-sx-since-last-run.c
+++ b/src/gnome/dialog-sx-since-last-run.c
@@ -62,9 +62,6 @@ G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_GUI_SX;
 
 #define DIALOG_SX_SINCE_LAST_RUN_CM_CLASS "dialog-sx-since-last-run"
 
-#define GNC_PREFS_GROUP        "dialogs.sxs.since-last-run"
-#define GNC_PREF_SHOW_AT_FOPEN "show-at-file-open"
-
 struct _GncSxSinceLastRunDialog
 {
     GtkWidget *dialog;
@@ -801,7 +798,7 @@ gnc_sx_sxsincelast_book_opened(void)
     GncSxInstanceModel *inst_model;
     GncSxSummary summary;
 
-    if (!gnc_prefs_get_bool (GNC_PREFS_GROUP, GNC_PREF_SHOW_AT_FOPEN))
+    if (!gnc_prefs_get_bool (GNC_PREFS_GROUP_STARTUP, GNC_PREF_RUN_AT_FOPEN))
         return;
 
     if (qof_book_is_readonly(gnc_get_current_book()))
@@ -824,6 +821,9 @@ gnc_sx_sxsincelast_book_opened(void)
     {
         if (summary.num_auto_create_no_notify_instances != 0)
         {
+            if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_STARTUP, GNC_PREF_SHOW_AT_FOPEN))
+                return;
+
             gnc_info_dialog
             (NULL,
              ngettext
@@ -996,7 +996,7 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr
     g_signal_connect(G_OBJECT(dialog->dialog), "response", G_CALLBACK(dialog_response_cb), dialog);
     g_signal_connect(G_OBJECT(dialog->dialog), "destroy", G_CALLBACK(dialog_destroy_cb), dialog);
 
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog->dialog));
+    gnc_restore_window_size(GNC_PREFS_GROUP_STARTUP, GTK_WINDOW(dialog->dialog));
 
     dialog->component_id = gnc_register_gui_component
                            (DIALOG_SX_SINCE_LAST_RUN_CM_CLASS, NULL, close_handler, dialog);
@@ -1058,7 +1058,7 @@ close_handler(gpointer user_data)
 {
     GncSxSinceLastRunDialog *app_dialog = user_data;
 
-    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(app_dialog->dialog));
+    gnc_save_window_size(GNC_PREFS_GROUP_STARTUP, GTK_WINDOW(app_dialog->dialog));
     gtk_widget_destroy(app_dialog->dialog);
 }
 
diff --git a/src/gnome/dialog-sx-since-last-run.h b/src/gnome/dialog-sx-since-last-run.h
index e0f4e34..01a622a 100644
--- a/src/gnome/dialog-sx-since-last-run.h
+++ b/src/gnome/dialog-sx-since-last-run.h
@@ -31,6 +31,10 @@
 #include "gnc-sx-instance-model.h"
 #include "gnc-plugin-page-sx-list.h"
 
+#define GNC_PREFS_GROUP_STARTUP "dialogs.sxs.since-last-run"
+#define GNC_PREF_RUN_AT_FOPEN   "show-at-file-open"
+#define GNC_PREF_SHOW_AT_FOPEN  "show-notify-window-at-file-open"
+
 typedef struct _GncSxSlrTreeModelAdapter GncSxSlrTreeModelAdapter;
 typedef struct _GncSxSinceLastRunDialog GncSxSinceLastRunDialog;
 
diff --git a/src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in b/src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
index 5d71461..d5c8a61 100644
--- a/src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
+++ b/src/gnome/gschemas/org.gnucash.dialogs.sxs.gschema.xml.in.in
@@ -14,8 +14,13 @@
     </key>
     <key name="show-at-file-open" type="b">
       <default>true</default>
-      <summary>Show "since last run" dialog when a file is opened.</summary>
-      <description>This setting controls whether the scheduled transactions "since last run" dialog is shown automatically when a data file is opened. This includes the initial opening of the data file when GnuCash starts. If this setting is active, show the dialog, otherwise it is not shown.</description>
+      <summary>Run "since last run" dialog when a file is opened.</summary>
+      <description>This setting controls whether the scheduled transactions "since last run" processing is run automatically when a data file is opened. This includes the initial opening of the data file when GnuCash starts. If this setting is active, run the "since last run" process, otherwise it is not run.</description>
+    </key>
+    <key name="show-notify-window-at-file-open" type="b">
+      <default>true</default>
+      <summary>Show "since last run" notification dialog when a file is opened.</summary>
+      <description>This setting controls whether the scheduled transactions notification-only "since last run" dialog is shown when a data file is opened (if "since last run" processing is enabled on file open).  This includes the initial opening of the data file when GnuCash starts.  If this setting is active, show the dialog, otherwise it is not shown.</description>
     </key>
   </schema>
 
diff --git a/src/gnome/gtkbuilder/dialog-sx.glade b/src/gnome/gtkbuilder/dialog-sx.glade
index ebac3f4..bc1f034 100644
--- a/src/gnome/gtkbuilder/dialog-sx.glade
+++ b/src/gnome/gtkbuilder/dialog-sx.glade
@@ -105,7 +105,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="border_width">6</property>
-        <property name="n_rows">8</property>
+        <property name="n_rows">9</property>
         <property name="n_columns">4</property>
         <property name="column_spacing">12</property>
         <child>
@@ -113,7 +113,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes"><b>Since Last Run Dialog</b></property>
+            <property name="label" translatable="yes"><b>Since Last Run</b></property>
             <property name="use_markup">True</property>
           </object>
           <packing>
@@ -128,8 +128,8 @@
             <property name="xalign">0</property>
           </object>
           <packing>
-            <property name="top_attach">2</property>
-            <property name="bottom_attach">3</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
@@ -143,8 +143,8 @@
             <property name="use_markup">True</property>
           </object>
           <packing>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
+            <property name="top_attach">4</property>
+            <property name="bottom_attach">5</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
           </packing>
@@ -155,10 +155,11 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">False</property>
-            <property name="tooltip_text" translatable="yes">Show the "since last run" window when a file is opened.</property>
+            <property name="tooltip_text" translatable="yes">Run the "since last run" process when a file is opened.</property>
             <property name="use_action_appearance">False</property>
             <property name="use_underline">True</property>
             <property name="draw_indicator">True</property>
+            <signal name="toggled" handler="on_sx_check_toggled_cb" swapped="no"/>
           </object>
           <packing>
             <property name="right_attach">4</property>
@@ -170,6 +171,28 @@
           </packing>
         </child>
         <child>
+          <object class="GtkCheckButton" id="pref/dialogs.sxs.since-last-run/show-notify-window-at-file-open">
+            <property name="label" translatable="yes">_Show notification window</property>
+            <property name="visible">True</property>
+            <property name="sensitive">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="tooltip_text" translatable="yes">Show the notification window for the "since last run" process when a file is opened.</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+            <property name="draw_indicator">True</property>
+            <signal name="toggled" handler="on_sx_check_toggled_cb" swapped="no"/>
+          </object>
+          <packing>
+            <property name="right_attach">4</property>
+            <property name="top_attach">2</property>
+            <property name="bottom_attach">3</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options"></property>
+            <property name="x_padding">30</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkCheckButton" id="pref/dialogs.sxs.transaction-editor/create-auto">
             <property name="label" translatable="yes">_Auto-create new transactions</property>
             <property name="visible">True</property>
@@ -183,8 +206,8 @@
           </object>
           <packing>
             <property name="right_attach">4</property>
-            <property name="top_attach">4</property>
-            <property name="bottom_attach">5</property>
+            <property name="top_attach">5</property>
+            <property name="bottom_attach">6</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
             <property name="x_padding">12</property>
@@ -207,8 +230,8 @@
             </child>
           </object>
           <packing>
-            <property name="top_attach">6</property>
-            <property name="bottom_attach">7</property>
+            <property name="top_attach">7</property>
+            <property name="bottom_attach">8</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
@@ -230,8 +253,8 @@
             </child>
           </object>
           <packing>
-            <property name="top_attach">7</property>
-            <property name="bottom_attach">8</property>
+            <property name="top_attach">8</property>
+            <property name="bottom_attach">9</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
@@ -276,8 +299,8 @@
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">7</property>
-            <property name="bottom_attach">8</property>
+            <property name="top_attach">8</property>
+            <property name="bottom_attach">9</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
@@ -322,8 +345,8 @@
           <packing>
             <property name="left_attach">1</property>
             <property name="right_attach">2</property>
-            <property name="top_attach">6</property>
-            <property name="bottom_attach">7</property>
+            <property name="top_attach">7</property>
+            <property name="bottom_attach">8</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options">GTK_FILL</property>
           </packing>
@@ -339,11 +362,12 @@
             <property name="use_action_appearance">False</property>
             <property name="use_underline">True</property>
             <property name="draw_indicator">True</property>
+            <signal name="toggled" handler="on_sx_check_toggled_cb" swapped="no"/>
           </object>
           <packing>
             <property name="right_attach">4</property>
-            <property name="top_attach">5</property>
-            <property name="bottom_attach">6</property>
+            <property name="top_attach">6</property>
+            <property name="bottom_attach">7</property>
             <property name="x_options">GTK_FILL</property>
             <property name="y_options"></property>
             <property name="x_padding">30</property>



Summary of changes:
 src/gnome/dialog-sx-editor.c                       | 15 +++++-
 src/gnome/dialog-sx-since-last-run.c               | 12 ++---
 src/gnome/dialog-sx-since-last-run.h               |  4 ++
 .../org.gnucash.dialogs.sxs.gschema.xml.in.in      |  9 +++-
 src/gnome/gtkbuilder/dialog-sx.glade               | 62 +++++++++++++++-------
 5 files changed, 74 insertions(+), 28 deletions(-)



More information about the gnucash-changes mailing list