gnucash maint: Bug 796945 - Search dialog update

Robert Fewell bobit at code.gnucash.org
Mon Nov 4 05:24:24 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/085aa769 (commit)
	from  https://github.com/Gnucash/gnucash/commit/491088b2 (commit)



commit 085aa76932afe6c68c9b99f0f6c65b889274196c
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Nov 4 10:10:30 2019 +0000

    Bug 796945 - Search dialog update
    
    Change the search dialog so that when adding search criteria, a max
    number of 5 rows are presented before scrolling is required in the
    search criteria scroll window so reducing the height required for the
    this area and when the search is executed the scroll window is hidden
    and the results window has the maximum space available.

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 1d90e74f6..39efe30d1 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -991,6 +991,16 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
 static void
 add_criterion (GtkWidget *button, GNCSearchWindow *sw)
 {
+    gint number_of_buttons = g_list_length (sw->crit_list) + 1;
+    gint button_height = gtk_widget_get_allocated_height (button);
+    gint min_height = MIN (number_of_buttons * button_height, 5 * button_height);
+
+    // this sets the minimum content height for the criteria scroll
+    // window, it is set to a max of 5 buttons visible without scrolling
+    gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW(
+                                                sw->criteria_scroll_window),
+                                                min_height + (button_height/2));
+
     gnc_search_dialog_add_criterion (sw);
 }
 
diff --git a/gnucash/gtkbuilder/dialog-search.glade b/gnucash/gtkbuilder/dialog-search.glade
index 2f46d8cfd..37631aee4 100644
--- a/gnucash/gtkbuilder/dialog-search.glade
+++ b/gnucash/gtkbuilder/dialog-search.glade
@@ -302,7 +302,7 @@
                 </child>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>



Summary of changes:
 gnucash/gnome-search/dialog-search.c   | 10 ++++++++++
 gnucash/gtkbuilder/dialog-search.glade |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list