{
PROP_0,
PROP_FILE_NAME,
- PROP_ENCODING
+ PROP_ENCODING,
+ PROP_MAXIMUM_LINES,
+ PROP_LINE_COUNT
};
enum {MAX_LINE_LEN = 16384}; /* Max length of an acceptable line. */
done:
line_reader_close (reader);
}
-
}
static void
switch (prop_id)
{
+ case PROP_MAXIMUM_LINES:
+ tf->maximum_lines = g_value_get_int (value);
+ break;
case PROP_FILE_NAME:
tf->file_name = g_value_dup_string (value);
read_lines (tf);
switch (prop_id)
{
+ case PROP_MAXIMUM_LINES:
+ g_value_set_int (value, text_file->maximum_lines);
+ break;
+ case PROP_LINE_COUNT:
+ g_value_set_int (value, text_file->line_cnt);
+ break;
case PROP_FILE_NAME:
g_value_set_string (value, text_file->file_name);
break;
static GObjectClass *parent_class = NULL;
-
static gboolean
__tree_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
static gint
__tree_model_get_n_columns (GtkTreeModel *tree_model)
{
- PsppireTextFile *tf = PSPPIRE_TEXT_FILE (tree_model);
return 2;
}
parent_class = g_type_class_peek_parent (class);
object_class = (GObjectClass*) class;
+ GParamSpec *maximum_lines_spec =
+ g_param_spec_int ("maximum-lines",
+ "Maximum Lines",
+ P_("An upper limit on the number of lines to consider"),
+ 0, G_MAXINT, G_MAXINT,
+ G_PARAM_READWRITE);
+
+ GParamSpec *line_count_spec =
+ g_param_spec_int ("line-count",
+ "Line Count",
+ P_("The number of lines in the file"),
+ 0, G_MAXINT, G_MAXINT,
+ G_PARAM_READABLE);
+
GParamSpec *file_name_spec =
g_param_spec_string ("file-name",
"File Name",
object_class->set_property = psppire_text_file_set_property;
object_class->get_property = psppire_text_file_get_property;
+ g_object_class_install_property (object_class,
+ PROP_MAXIMUM_LINES,
+ maximum_lines_spec);
+
+ g_object_class_install_property (object_class,
+ PROP_LINE_COUNT,
+ line_count_spec);
+
g_object_class_install_property (object_class,
PROP_FILE_NAME,
file_name_spec);
object_class->dispose = psppire_text_file_dispose;
}
-
static void
psppire_text_file_init (PsppireTextFile *text_file)
{