mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #115066: Enable "Search For" dialog that matches all.
Allow to remove all elements which results in an "empty" new/refinement/... search matching all available items. In that case grey out the match-type combo in the upper right corner and add a label "Match all entries" where the criteria list used to sit. Patch by andi5. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17705 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8f3d1df0de
commit
0b5de42bc5
@ -62,6 +62,8 @@ enum search_cols {
|
||||
|
||||
struct _GNCSearchWindow {
|
||||
GtkWidget * dialog;
|
||||
GtkWidget * grouping_combo;
|
||||
GtkWidget * match_all_label;
|
||||
GtkWidget * criteria_table;
|
||||
GtkWidget * result_hbox;
|
||||
|
||||
@ -437,6 +439,14 @@ gnc_search_dialog_reset_widgets (GNCSearchWindow *sw)
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->new_rb), FALSE);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (sw->narrow_rb), TRUE);
|
||||
}
|
||||
|
||||
if (sw->crit_list) {
|
||||
gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
|
||||
gtk_widget_hide(sw->match_all_label);
|
||||
} else {
|
||||
gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
|
||||
gtk_widget_show(sw->match_all_label);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -446,6 +456,9 @@ gnc_search_dialog_crit_ok (GNCSearchWindow *sw)
|
||||
GList *l;
|
||||
gboolean ret;
|
||||
|
||||
if (!sw->crit_list)
|
||||
return TRUE;
|
||||
|
||||
l = g_list_last (sw->crit_list);
|
||||
data = l->data;
|
||||
ret = gnc_search_core_type_validate (data->element);
|
||||
@ -523,7 +536,7 @@ remove_element (GtkWidget *button, GNCSearchWindow *sw)
|
||||
GtkWidget *element;
|
||||
struct _elem_data *data;
|
||||
|
||||
if (g_list_length (sw->crit_list) < 2)
|
||||
if (!sw->crit_list)
|
||||
return;
|
||||
|
||||
element = g_object_get_data (G_OBJECT (button), "element");
|
||||
@ -535,6 +548,12 @@ remove_element (GtkWidget *button, GNCSearchWindow *sw)
|
||||
/* and from the display */
|
||||
gtk_container_remove (GTK_CONTAINER (sw->criteria_table), element);
|
||||
gtk_container_remove (GTK_CONTAINER (sw->criteria_table), button);
|
||||
|
||||
/* disable match-type menu when there is no criterion */
|
||||
if (!sw->crit_list) {
|
||||
gtk_widget_set_sensitive(sw->grouping_combo, FALSE);
|
||||
gtk_widget_show(sw->match_all_label);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -689,9 +708,14 @@ gnc_search_dialog_add_criterion (GNCSearchWindow *sw)
|
||||
if (sw->crit_list) {
|
||||
if (!gnc_search_dialog_crit_ok (sw))
|
||||
return;
|
||||
} else
|
||||
} else {
|
||||
sw->last_param = sw->params_list->data;
|
||||
|
||||
/* no match-all situation anymore */
|
||||
gtk_widget_set_sensitive(sw->grouping_combo, TRUE);
|
||||
gtk_widget_hide(sw->match_all_label);
|
||||
}
|
||||
|
||||
/* create a new criterion element */
|
||||
|
||||
new = gnc_search_core_type_new_type_name
|
||||
@ -803,7 +827,8 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
|
||||
gtk_widget_show (add);
|
||||
|
||||
/* Set the match-type menu */
|
||||
combo_box = GTK_COMBO_BOX(gtk_combo_box_new_text());
|
||||
sw->grouping_combo = gtk_combo_box_new_text();
|
||||
combo_box = GTK_COMBO_BOX(sw->grouping_combo);
|
||||
gtk_combo_box_append_text(combo_box, _("all criteria are met"));
|
||||
gtk_combo_box_append_text(combo_box, _("any criteria are met"));
|
||||
gtk_combo_box_set_active(combo_box, sw->grouping);
|
||||
@ -813,6 +838,9 @@ gnc_search_dialog_init_widgets (GNCSearchWindow *sw, const gchar *title)
|
||||
gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET(combo_box), FALSE, FALSE, 3);
|
||||
gtk_widget_show(GTK_WIDGET(combo_box));
|
||||
|
||||
/* Grab the 'all items match' label */
|
||||
sw->match_all_label = glade_xml_get_widget (xml, "match_all_label");
|
||||
|
||||
/* if there's no original query, make the narrow, add, delete
|
||||
* buttons inaccessible */
|
||||
sw->new_rb = glade_xml_get_widget (xml, "new_search_radiobutton");
|
||||
|
@ -344,6 +344,31 @@
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="match_all_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Match all entries</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">3</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="criteria_table">
|
||||
<property name="border_width">3</property>
|
||||
|
Loading…
Reference in New Issue
Block a user