Commit 763f1a37 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow
Browse files

add padding to warnings provide information dialog if no records are found

2002-01-31  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* advanced-filter.glade : add padding to warnings
	* dialog-advanced-filter.c (advanced_filter_ok_clicked_cb) :
	  provide information dialog if no records are found
	(advanced_filter) : ditto
	(advanced_filter_update_sensitivity_cb) : provide information
	  messages in warning label
	* dialog-sheet-order.c (populate_sheet_list) : disable drag
	starts in sheet list and desensitize column header

2002-01-31  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* src/analysis-tools.h : add warning to GENERIC_TOOL_STATE
parent 3294cf93
......@@ -45,7 +45,7 @@ Long term breakage
under many window managers.
- Data->Filter dialog
: use expr entry widget.
: use expr entry widget. (done in cvs head)
- The autocalc label should use a more readable format and should not get
clipped.
......
......@@ -162,7 +162,8 @@ typedef enum {
Workbook *wb;\
WorkbookControlGUI *wbcg;\
GtkAccelGroup *accel;\
GtkWidget *warning_dialog;
GtkWidget *warning_dialog;\
GtkWidget *warning;
typedef struct {
GENERIC_TOOL_STATE
......
......@@ -345,8 +345,8 @@
<property name="wrap">yes</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="xpad">5</property>
<property name="ypad">5</property>
<property name="visible">yes</property>
</widget>
<packing>
......
......@@ -28,6 +28,7 @@
#define OK 0
#define N_COLUMNS_ERROR 1
#define ERR_INVALID_FIELD 2
#define NO_RECORDS_FOUND 3
#define ADVANCED_FILTER_KEY "advanced-filter-dialog"
......@@ -117,13 +118,18 @@ advanced_filter (WorkbookControl *wbc,
database->v_range.cell.b.row,
crit, unique_only_flag);
free_criterias (crit);
if (rows == NULL)
return NO_RECORDS_FOUND;
prepare_output (wbc, dao, "Filtered");
filter (dao, database->v_range.cell.a.sheet, rows, database->v_range.cell.a.col,
database->v_range.cell.b.col, database->v_range.cell.a.row,
database->v_range.cell.b.row);
free_criterias (crit);
free_rows (rows);
autofit_columns (dao, 0, database->v_range.cell.b.col - database->v_range.cell.a.col);
......@@ -141,11 +147,6 @@ advanced_filter (WorkbookControl *wbc,
static void
advanced_filter_update_sensitivity_cb (GtkWidget *dummy, AdvancedFilterState *state)
{
gboolean ready = TRUE;
gboolean input_ready = FALSE;
gboolean crit_ready = FALSE;
gboolean output_ready = FALSE;
Value *output_range = NULL;
Value *input_range = NULL;
Value *criteria_range = NULL;
......@@ -154,24 +155,38 @@ advanced_filter_update_sensitivity_cb (GtkWidget *dummy, AdvancedFilterState *st
input_range = gnumeric_expr_entry_parse_to_value (
GNUMERIC_EXPR_ENTRY (state->input_entry), state->sheet);
if (input_range == NULL) {
gtk_label_set_text (GTK_LABEL (state->warning), _("The list range is invalid."));
gtk_widget_set_sensitive (state->ok_button, FALSE);
return;
} else
value_release (input_range);
criteria_range = gnumeric_expr_entry_parse_to_value
(GNUMERIC_EXPR_ENTRY (state->input_entry_2), state->sheet);
if (criteria_range == NULL) {
gtk_label_set_text (GTK_LABEL (state->warning),
_("The criteria range is invalid."));
gtk_widget_set_sensitive (state->ok_button, FALSE);
return;
} else
value_release (criteria_range);
i = gnumeric_glade_group_value (state->gui, output_group);
if (i == 2)
if (i == 2) {
output_range = gnumeric_expr_entry_parse_to_value
(GNUMERIC_EXPR_ENTRY (state->output_entry), state->sheet);
if (output_range == NULL) {
gtk_label_set_text (GTK_LABEL (state->warning),
_("The output range is invalid."));
gtk_widget_set_sensitive (state->ok_button, FALSE);
return;
} else
value_release (output_range);
}
input_ready = (input_range != NULL);
crit_ready = (criteria_range != NULL);
output_ready = ((i != 2) || (output_range != NULL));
if (input_range != NULL) value_release (input_range);
if (criteria_range != NULL) value_release (criteria_range);
if (output_range != NULL) value_release (output_range);
ready = ready && input_ready && crit_ready && output_ready;
gtk_widget_set_sensitive (state->ok_button, ready);
gtk_label_set_text (GTK_LABEL (state->warning), "");
gtk_widget_set_sensitive (state->ok_button, TRUE);
return;
}
......@@ -220,6 +235,12 @@ advanced_filter_ok_clicked_cb (GtkWidget *button, AdvancedFilterState *state)
error_in_entry ((GenericToolState *) state, GTK_WIDGET (state->input_entry_2),
_("The given criteria are invalid."));
break;
case NO_RECORDS_FOUND:
gnumeric_notice_nonmodal ((GtkWindow *) state->dialog,
&(state->warning_dialog),
GTK_MESSAGE_INFO,
_("No matching records were found."));
break;
default:
text = g_strdup_printf (_("An unexpected error has occurred: %d."), err);
error_in_entry ((GenericToolState *) state, GTK_WIDGET (state->input_entry), text);
......@@ -300,6 +321,8 @@ dialog_advanced_filter_init (AdvancedFilterState *state)
GDK_MOD1_MASK, 0);
gtk_widget_show (GTK_WIDGET (state->input_entry_2));
state->warning = glade_xml_get_widget (state->gui, "warnings");
wbcg_edit_attach_guru (state->wbcg, state->dialog);
gtk_signal_connect (GTK_OBJECT (state->dialog), "set-focus",
GTK_SIGNAL_FUNC (tool_set_focus), state);
......
......@@ -133,9 +133,9 @@ populate_sheet_list (SheetManager *state)
column = gtk_tree_view_column_new_with_attributes ("Sheets",
gtk_cell_renderer_text_new (),
"text", SHEET_NAME, NULL);
gtk_tree_view_column_set_sort_column_id (column, 0);
/* gtk_tree_view_column_set_sort_column_id (column, 0);*/
gtk_tree_view_append_column (state->sheet_list, column);
gtk_tree_view_set_reorderable (state->sheet_list, TRUE);
gtk_tree_view_set_reorderable (state->sheet_list, FALSE);
/* Init the buttons & selection */
cb_selection_changed (NULL, state);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment