コード例 #1
0
static void
dialog_set_main_button_sensitivity (G_GNUC_UNUSED GtkWidget *dummy,
				    SolverState *state)
{
	gboolean ready;

	ready = gnm_expr_entry_is_cell_ref (state->target_entry, state->sheet,
					    FALSE)
		&& gnm_expr_entry_is_cell_ref (state->change_cell_entry,
					       state->sheet, TRUE);
	gtk_widget_set_sensitive (state->solve_button, ready);
}
コード例 #2
0
ファイル: dialog-merge.c プロジェクト: UIKit0/gnumeric
static void
cb_merge_update_buttons (G_GNUC_UNUSED gpointer ignored,
			 MergeState *state)
{
/* Note: ignored could be NULL or  an expr-entry. */
	GtkTreeIter  iter;
	GtkTreeSelection *selection = gtk_tree_view_get_selection (state->list);
	gboolean has_selection, has_data, has_work;

	has_selection = gtk_tree_selection_get_selected (selection, NULL, &iter);
	has_data = gnm_expr_entry_is_cell_ref (state->data, state->sheet, TRUE)
		&& gnm_expr_entry_is_cell_ref (state->field, state->sheet, FALSE);
	has_work = (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (state->model), NULL) > 0)
		&& gnm_expr_entry_is_cell_ref (state->zone, state->sheet, TRUE);

	gtk_widget_set_sensitive (state->add_btn, has_data);
	gtk_widget_set_sensitive (state->change_btn, has_data && has_selection);
	gtk_widget_set_sensitive (state->delete_btn, has_selection);
	gtk_widget_set_sensitive (state->merge_btn, has_work);
}
コード例 #3
0
ファイル: gnm-dao.c プロジェクト: nzinfo/gnumeric
gboolean
gnm_dao_get_data (GnmDao *gdao, data_analysis_output_t **dao)
{
	gboolean dao_ready  = FALSE;
	int grp_val;

	g_return_val_if_fail (gdao != NULL, FALSE);

	grp_val = gnm_gui_group_value (gdao->gui, dao_group);

	dao_ready =  ((grp_val  != 2) ||
		      gnm_expr_entry_is_cell_ref
		      (GNM_EXPR_ENTRY (gdao->output_entry),
		       wb_control_cur_sheet (GNM_WBC (gdao->wbcg)),
		       TRUE));

	if (dao_ready && NULL != dao) {
		GtkWidget *button;
		GnmValue *output_range = NULL;

		switch (grp_val) {
		case 0:
		default:
			*dao = dao_init_new_sheet (*dao);
			break;
		case 1:
			*dao = dao_init (*dao, NewWorkbookOutput);
			break;
		case 2:
			output_range = gnm_expr_entry_parse_as_value
				(GNM_EXPR_ENTRY (gdao->output_entry),
				 wb_control_cur_sheet (GNM_WBC
						       (gdao->wbcg)));
			*dao = dao_init (*dao, RangeOutput);
			dao_load_from_value (*dao, output_range);
			value_release (output_range);
			break;
		case 3:
			(*dao) = dao_init ((*dao), InPlaceOutput);
			/* It is the callers responsibility to fill the */
			/* dao with the appropriate range. */
			break;
		}

		button = go_gtk_builder_get_widget (gdao->gui, "autofit_button");
		(*dao)->autofit_flag = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (button));

		(*dao)->clear_outputrange = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (gdao->clear_outputrange_button));
		(*dao)->retain_format = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (gdao->retain_format_button));
		(*dao)->retain_comments = gtk_toggle_button_get_active (
			GTK_TOGGLE_BUTTON (gdao->retain_comments_button));

		(*dao)->put_formulas
			= (gtk_combo_box_get_active
			   (GTK_COMBO_BOX (gdao->put_menu))
			   != 0);
	}

	return dao_ready;
}