PROP_REORDERABLE,
PROP_SORT_INDICATOR,
PROP_SORT_ORDER,
- PROP_SORT_COLUMN_ID
+ PROP_SORT_COLUMN_ID,
+ PROP_QUICK_EDIT
};
enum
G_MAXINT,
-1,
GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_QUICK_EDIT,
+ g_param_spec_boolean ("quick-edit",
+ P_("Quick edit"),
+ P_("If true, editing starts upon the first click in the column. If false, the first click selects the column and a second click is needed to begin editing. This has no effect on cells that are not editable."),
+ TRUE,
+ GTK_PARAM_READWRITE));
}
static void
tree_column->fixed_width = 1;
tree_column->use_resized_width = FALSE;
tree_column->title = g_strdup ("");
+ tree_column->quick_edit = TRUE;
}
static void
pspp_sheet_view_column_set_sort_column_id (tree_column,
g_value_get_int (value));
break;
-
+
+ case PROP_QUICK_EDIT:
+ pspp_sheet_view_column_set_quick_edit (tree_column,
+ g_value_get_boolean (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_int (value,
pspp_sheet_view_column_get_sort_column_id (tree_column));
break;
-
+
+ case PROP_QUICK_EDIT:
+ g_value_set_boolean (value,
+ pspp_sheet_view_column_get_quick_edit (tree_column));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
return tree_column->reorderable;
}
+/**
+ * pspp_sheet_view_column_set_quick_edit:
+ * @tree_column: A #PsppSheetViewColumn
+ * @quick_edit: If true, editing starts upon the first click in the column. If
+ * false, the first click selects the column and a second click is needed to
+ * begin editing. This has no effect on cells that are not editable.
+ **/
+void
+pspp_sheet_view_column_set_quick_edit (PsppSheetViewColumn *tree_column,
+ gboolean quick_edit)
+{
+ g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column));
+
+ quick_edit = !!quick_edit;
+ if (tree_column->quick_edit != quick_edit)
+ {
+ tree_column->quick_edit = (quick_edit?TRUE:FALSE);
+ g_object_notify (G_OBJECT (tree_column), "quick-edit");
+ }
+}
+
+/**
+ * pspp_sheet_view_column_get_quick_edit:
+ * @tree_column: A #PsppSheetViewColumn
+ *
+ * Returns %TRUE if editing starts upon the first click in the column. Returns
+ * %FALSE, the first click selects the column and a second click is needed to
+ * begin editing. This is not meaningful for cells that are not editable.
+ *
+ * Return value: %TRUE if editing starts upon the first click.
+ **/
+gboolean
+pspp_sheet_view_column_get_quick_edit (PsppSheetViewColumn *tree_column)
+{
+ g_return_val_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column), FALSE);
+
+ return tree_column->quick_edit;
+}
+
/**
* pspp_sheet_view_column_set_sort_column_id: