aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-06-21 21:56:34 +0800
committerMilan Crha <mcrha@redhat.com>2013-06-21 21:56:34 +0800
commit4a101290fdb546296f7bc0a9a34ba342e741895a (patch)
tree3a5cecac900e672a87f2865a8288f30dbeea4c34 /e-util
parent97c70105b71adc9b7cb9f4db15bf44f98133a82c (diff)
downloadgsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.gz
gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.tar.zst
gsoc2013-evolution-4a101290fdb546296f7bc0a9a34ba342e741895a.zip
Calendar views inline text edit with Ctrl+C/V/X does not work
The shortcuts Ctrl+C/V/X are used for whole calendar items copy/paste/cut, not for text when editing event details inline, either in a day/week view or in a list view. By tracking the is-editing property of respective cell editor and using it when enabling/disabling clipboard actions makes the respective text operations work as expected.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-table-click-to-add.c46
-rw-r--r--e-util/e-table-click-to-add.h1
-rw-r--r--e-util/e-table-group-container.c29
-rw-r--r--e-util/e-table-group-container.h2
-rw-r--r--e-util/e-table-group-leaf.c35
-rw-r--r--e-util/e-table-group-leaf.h2
-rw-r--r--e-util/e-table-group.c59
-rw-r--r--e-util/e-table-group.h2
-rw-r--r--e-util/e-table-item.c32
-rw-r--r--e-util/e-table-item.h2
-rw-r--r--e-util/e-table.c57
-rw-r--r--e-util/e-table.h1
-rw-r--r--e-util/e-tree.c36
-rw-r--r--e-util/e-tree.h2
14 files changed, 302 insertions, 4 deletions
diff --git a/e-util/e-table-click-to-add.c b/e-util/e-table-click-to-add.c
index 8d80e197f4..2f36b1899d 100644
--- a/e-util/e-table-click-to-add.c
+++ b/e-util/e-table-click-to-add.c
@@ -60,7 +60,8 @@ enum {
PROP_MODEL,
PROP_MESSAGE,
PROP_WIDTH,
- PROP_HEIGHT
+ PROP_HEIGHT,
+ PROP_IS_EDITING
};
static void
@@ -311,6 +312,9 @@ etcta_get_property (GObject *object,
case PROP_HEIGHT:
g_value_set_double (value, etcta->height);
break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_click_to_add_is_editing (etcta));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -368,6 +372,16 @@ set_initial_selection (ETableClickToAdd *etcta)
}
static void
+table_click_to_add_row_is_editing_changed_cb (ETableItem *item,
+ GParamSpec *param,
+ ETableClickToAdd *etcta)
+{
+ g_return_if_fail (E_IS_TABLE_CLICK_TO_ADD (etcta));
+
+ g_object_notify (G_OBJECT (etcta), "is-editing");
+}
+
+static void
finish_editing (ETableClickToAdd *etcta)
{
if (etcta->row) {
@@ -401,7 +415,13 @@ finish_editing (ETableClickToAdd *etcta)
etcta->row, "key_press",
G_CALLBACK (item_key_press), etcta);
+ g_signal_connect (
+ etcta->row, "notify::is-editing",
+ G_CALLBACK (table_click_to_add_row_is_editing_changed_cb), etcta);
+
set_initial_selection (etcta);
+
+ g_object_notify (G_OBJECT (etcta), "is-editing");
}
}
@@ -452,9 +472,15 @@ etcta_event (GnomeCanvasItem *item,
etcta->row, "key_press",
G_CALLBACK (item_key_press), etcta);
+ g_signal_connect (
+ etcta->row, "notify::is-editing",
+ G_CALLBACK (table_click_to_add_row_is_editing_changed_cb), etcta);
+
e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etcta->row), TRUE);
set_initial_selection (etcta);
+
+ g_object_notify (G_OBJECT (etcta), "is-editing");
}
break;
@@ -588,6 +614,16 @@ e_table_click_to_add_class_init (ETableClickToAddClass *class)
G_PARAM_READABLE |
G_PARAM_LAX_VALIDATION));
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_EDITING,
+ g_param_spec_boolean (
+ "is-editing",
+ "Whether is in an editing mode",
+ "Whether is in an editing mode",
+ FALSE,
+ G_PARAM_READABLE));
+
etcta_signals[CURSOR_CHANGE] = g_signal_new (
"cursor_change",
G_OBJECT_CLASS_TYPE (object_class),
@@ -665,3 +701,11 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta)
create_rect_and_text (etcta);
e_canvas_item_move_absolute (etcta->text, 3, 3);
}
+
+gboolean
+e_table_click_to_add_is_editing (ETableClickToAdd *etcta)
+{
+ g_return_val_if_fail (E_IS_TABLE_CLICK_TO_ADD (etcta), FALSE);
+
+ return etcta->row && e_table_item_is_editing (E_TABLE_ITEM (etcta->row));
+}
diff --git a/e-util/e-table-click-to-add.h b/e-util/e-table-click-to-add.h
index cd1519b82e..7c0c400f35 100644
--- a/e-util/e-table-click-to-add.h
+++ b/e-util/e-table-click-to-add.h
@@ -93,6 +93,7 @@ struct _ETableClickToAddClass {
GType e_table_click_to_add_get_type (void) G_GNUC_CONST;
void e_table_click_to_add_commit (ETableClickToAdd *etcta);
+gboolean e_table_click_to_add_is_editing (ETableClickToAdd *etcta);
G_END_DECLS
diff --git a/e-util/e-table-group-container.c b/e-util/e-table-group-container.c
index 72fee11c26..fece704449 100644
--- a/e-util/e-table-group-container.c
+++ b/e-util/e-table-group-container.c
@@ -60,7 +60,8 @@ enum {
PROP_CURSOR_MODE,
PROP_SELECTION_MODEL,
PROP_LENGTH_THRESHOLD,
- PROP_UNIFORM_ROW_HEIGHT
+ PROP_UNIFORM_ROW_HEIGHT,
+ PROP_IS_EDITING
};
static EPrintable *
@@ -992,6 +993,9 @@ etgc_get_property (GObject *object,
case PROP_UNIFORM_ROW_HEIGHT:
g_value_set_boolean (value, etgc->uniform_row_height);
break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_group_container_is_editing (etgc));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1148,6 +1152,11 @@ e_table_group_container_class_init (ETableGroupContainerClass *class)
"Minimum Width",
0.0, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
+
+ g_object_class_override_property (
+ object_class,
+ PROP_IS_EDITING,
+ "is-editing");
}
static void
@@ -1666,3 +1675,21 @@ etgc_get_printable (ETableGroup *etg)
return printable;
}
+
+gboolean
+e_table_group_container_is_editing (ETableGroupContainer *etgc)
+{
+ GList *list;
+
+ g_return_val_if_fail (E_IS_TABLE_GROUP_CONTAINER (etgc), FALSE);
+
+ for (list = etgc->children; list; list = g_list_next (list)) {
+ ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
+
+ if (e_table_group_is_editing (child_node->child)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
diff --git a/e-util/e-table-group-container.h b/e-util/e-table-group-container.h
index 2f1457d279..f06dc746aa 100644
--- a/e-util/e-table-group-container.h
+++ b/e-util/e-table-group-container.h
@@ -133,6 +133,8 @@ void e_table_group_container_construct
ETableSortInfo *sort_info,
gint n);
+gboolean e_table_group_container_is_editing (ETableGroupContainer *etgc);
+
G_END_DECLS
#endif /* _E_TABLE_GROUP_CONTAINER_H_ */
diff --git a/e-util/e-table-group-leaf.c b/e-util/e-table-group-leaf.c
index 027ba299ec..a052e36913 100644
--- a/e-util/e-table-group-leaf.c
+++ b/e-util/e-table-group-leaf.c
@@ -55,10 +55,21 @@ enum {
PROP_CURSOR_MODE,
PROP_LENGTH_THRESHOLD,
PROP_SELECTION_MODEL,
- PROP_UNIFORM_ROW_HEIGHT
+ PROP_UNIFORM_ROW_HEIGHT,
+ PROP_IS_EDITING
};
static void
+etgl_item_is_editing_changed_cb (ETableItem *item,
+ GParamSpec *param,
+ ETableGroupLeaf *etgl)
+{
+ g_return_if_fail (E_IS_TABLE_GROUP_LEAF (etgl));
+
+ g_object_notify (G_OBJECT (etgl), "is-editing");
+}
+
+static void
etgl_dispose (GObject *object)
{
ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
@@ -98,6 +109,9 @@ etgl_dispose (GObject *object)
etgl->item,
etgl->etgl_start_drag_id);
+ g_signal_handlers_disconnect_by_func (etgl->item,
+ etgl_item_is_editing_changed_cb, etgl);
+
etgl->etgl_cursor_change_id = 0;
etgl->etgl_cursor_activated_id = 0;
etgl->etgl_double_click_id = 0;
@@ -354,6 +368,9 @@ etgl_realize (GnomeCanvasItem *item)
etgl->item, "start_drag",
G_CALLBACK (etgl_start_drag), etgl);
+ g_signal_connect (etgl->item, "notify::is-editing",
+ G_CALLBACK (etgl_item_is_editing_changed_cb), etgl);
+
e_canvas_item_request_reflow (item);
}
@@ -650,6 +667,10 @@ etgl_get_property (GObject *object,
break;
case PROP_UNIFORM_ROW_HEIGHT:
g_value_set_boolean (value, etgl->uniform_row_height);
+ break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_group_leaf_is_editing (etgl));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -804,6 +825,11 @@ e_table_group_leaf_class_init (ETableGroupLeafClass *class)
"Uniform row height",
FALSE,
G_PARAM_READWRITE));
+
+ g_object_class_override_property (
+ object_class,
+ PROP_IS_EDITING,
+ "is-editing");
}
static void
@@ -837,3 +863,10 @@ e_table_group_leaf_init (ETableGroupLeaf *etgl)
e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (etgl), etgl_reflow);
}
+gboolean
+e_table_group_leaf_is_editing (ETableGroupLeaf *etgl)
+{
+ g_return_val_if_fail (E_IS_TABLE_GROUP_LEAF (etgl), FALSE);
+
+ return etgl->item && e_table_item_is_editing (etgl->item);
+}
diff --git a/e-util/e-table-group-leaf.h b/e-util/e-table-group-leaf.h
index 8c47e2e52e..d9f1546a9b 100644
--- a/e-util/e-table-group-leaf.h
+++ b/e-util/e-table-group-leaf.h
@@ -104,6 +104,8 @@ ETableGroup * e_table_group_leaf_new (GnomeCanvasGroup *parent,
ETableModel *model,
ETableSortInfo *sort_info);
+gboolean e_table_group_leaf_is_editing (ETableGroupLeaf *etgl);
+
G_END_DECLS
#endif /* _E_TABLE_GROUP_LEAF_H_ */
diff --git a/e-util/e-table-group.c b/e-util/e-table-group.c
index a4a23bef67..1c9ed2c39b 100644
--- a/e-util/e-table-group.c
+++ b/e-util/e-table-group.c
@@ -50,6 +50,11 @@ enum {
LAST_SIGNAL
};
+enum {
+ PROP_0,
+ PROP_IS_EDITING
+};
+
static guint etg_signals[LAST_SIGNAL] = { 0, };
static gboolean etg_get_focus (ETableGroup *table_group);
@@ -78,6 +83,24 @@ etg_dispose (GObject *object)
G_OBJECT_CLASS (e_table_group_parent_class)->dispose (object);
}
+static void
+etg_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ETableGroup *etg = E_TABLE_GROUP (object);
+
+ switch (property_id) {
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_group_is_editing (etg));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
/**
* e_table_group_new
* @parent: The %GnomeCanvasGroup to create a child of.
@@ -640,6 +663,7 @@ e_table_group_class_init (ETableGroupClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = etg_dispose;
+ object_class->get_property = etg_get_property;
item_class->event = etg_event;
@@ -665,6 +689,16 @@ e_table_group_class_init (ETableGroupClass *class)
class->get_mouse_over = NULL;
class->get_cell_geometry = NULL;
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_EDITING,
+ g_param_spec_boolean (
+ "is-editing",
+ "Whether is in an editing mode",
+ "Whether is in an editing mode",
+ FALSE,
+ G_PARAM_READABLE));
+
etg_signals[CURSOR_CHANGE] = g_signal_new (
"cursor_change",
G_OBJECT_CLASS_TYPE (object_class),
@@ -751,3 +785,28 @@ e_table_group_init (ETableGroup *table_group)
{
/* nothing to do */
}
+
+gboolean
+e_table_group_is_editing (ETableGroup *table_group)
+{
+ static gboolean in = FALSE;
+ gboolean is_editing = FALSE;
+
+ g_return_val_if_fail (E_IS_TABLE_GROUP (table_group), FALSE);
+
+ /* this should be called from the main thread only,
+ and each descendant overrides the property,
+ thus might cause no call recursion */
+ if (in) {
+ g_warn_if_reached ();
+ return FALSE;
+ }
+
+ in = TRUE;
+
+ g_object_get (G_OBJECT (table_group), "is-editing", &is_editing, NULL);
+
+ in = FALSE;
+
+ return is_editing;
+}
diff --git a/e-util/e-table-group.h b/e-util/e-table-group.h
index 985450074b..a1f0acbfba 100644
--- a/e-util/e-table-group.h
+++ b/e-util/e-table-group.h
@@ -237,6 +237,8 @@ void e_table_group_apply_to_leafs (ETableGroup *table_group,
ETableGroupLeafFn fn,
gpointer closure);
+gboolean e_table_group_is_editing (ETableGroup *table_group);
+
G_END_DECLS
#endif /* _E_TABLE_GROUP_H_ */
diff --git a/e-util/e-table-item.c b/e-util/e-table-item.c
index 289d26d973..66477f5cba 100644
--- a/e-util/e-table-item.c
+++ b/e-util/e-table-item.c
@@ -100,6 +100,7 @@ enum {
PROP_LENGTH_THRESHOLD,
PROP_CURSOR_ROW,
PROP_UNIFORM_ROW_HEIGHT,
+ PROP_IS_EDITING,
PROP_MINIMUM_WIDTH,
PROP_WIDTH,
@@ -1699,6 +1700,9 @@ eti_get_property (GObject *object,
case PROP_UNIFORM_ROW_HEIGHT:
g_value_set_boolean (value, eti->uniform_row_height);
break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_item_is_editing (eti));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -3275,6 +3279,16 @@ e_table_item_class_init (ETableItemClass *class)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_EDITING,
+ g_param_spec_boolean (
+ "is-editing",
+ "Whether is in an editing mode",
+ "Whether is in an editing mode",
+ FALSE,
+ G_PARAM_READABLE));
+
eti_signals[CURSOR_CHANGE] = g_signal_new (
"cursor_change",
G_OBJECT_CLASS_TYPE (object_class),
@@ -3584,6 +3598,8 @@ e_table_item_enter_edit (ETableItem *eti,
eti->editing_row = row;
eti->edit_ctx = e_cell_enter_edit (eti->cell_views[col], view_to_model_col (eti, col), col, row);
+
+ g_object_notify (G_OBJECT (eti), "is-editing");
}
/**
@@ -3618,6 +3634,8 @@ e_table_item_leave_edit (ETableItem *eti)
eti->cell_views[col],
view_to_model_col (eti, col),
col, row, edit_ctx);
+
+ g_object_notify (G_OBJECT (eti), "is-editing");
}
/**
@@ -4041,3 +4059,17 @@ e_table_item_get_printable (ETableItem *item)
return printable;
}
+
+/**
+ * e_table_item_is_editing:
+ * @eti: an %ETableItem
+ *
+ * Returns: Whether the table item is currently editing cell content.
+ **/
+gboolean
+e_table_item_is_editing (ETableItem *eti)
+{
+ g_return_val_if_fail (E_IS_TABLE_ITEM (eti), FALSE);
+
+ return eti_editing (eti);
+}
diff --git a/e-util/e-table-item.h b/e-util/e-table-item.h
index 656c46b0a7..01e6a227dd 100644
--- a/e-util/e-table-item.h
+++ b/e-util/e-table-item.h
@@ -256,6 +256,8 @@ gint e_table_item_row_diff (ETableItem *eti,
gint start_row,
gint end_row);
+gboolean e_table_item_is_editing (ETableItem *eti);
+
G_END_DECLS
#endif /* _E_TABLE_ITEM_H_ */
diff --git a/e-util/e-table.c b/e-util/e-table.c
index 1777474984..a4c809a99c 100644
--- a/e-util/e-table.c
+++ b/e-util/e-table.c
@@ -105,7 +105,8 @@ enum {
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HSCROLL_POLICY,
- PROP_VSCROLL_POLICY
+ PROP_VSCROLL_POLICY,
+ PROP_IS_EDITING
};
enum {
@@ -1067,6 +1068,16 @@ et_table_rows_deleted (ETableModel *table_model,
}
static void
+group_is_editing_changed_cb (ETableClickToAdd *etcta,
+ GParamSpec *param,
+ ETable *table)
+{
+ g_return_if_fail (E_IS_TABLE (table));
+
+ g_object_notify (G_OBJECT (table), "is-editing");
+}
+
+static void
et_build_groups (ETable *et)
{
gboolean was_grouped = et->is_grouped;
@@ -1123,6 +1134,9 @@ et_build_groups (ETable *et)
g_signal_connect (
et->group, "start_drag",
G_CALLBACK (group_start_drag), et);
+ g_signal_connect (
+ et->group, "notify::is-editing",
+ G_CALLBACK (group_is_editing_changed_cb), et);
if (!(et->is_grouped) && was_grouped)
et_disconnect_model (et);
@@ -1352,6 +1366,16 @@ canvas_vbox_event (ECanvasVbox *vbox,
return TRUE;
}
+static void
+click_to_add_is_editing_changed_cb (ETableClickToAdd *etcta,
+ GParamSpec *param,
+ ETable *table)
+{
+ g_return_if_fail (E_IS_TABLE (table));
+
+ g_object_notify (G_OBJECT (table), "is-editing");
+}
+
static gboolean
click_to_add_event (ETableClickToAdd *etcta,
GdkEventKey *key,
@@ -1492,6 +1516,9 @@ e_table_setup_table (ETable *e_table,
g_signal_connect (
e_table->click_to_add, "cursor_change",
G_CALLBACK (click_to_add_cursor_change), e_table);
+ g_signal_connect (
+ e_table->click_to_add, "notify::is-editing",
+ G_CALLBACK (click_to_add_is_editing_changed_cb), e_table);
}
}
@@ -2254,6 +2281,9 @@ et_get_property (GObject *object,
else
g_value_set_enum (value, 0);
break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_table_is_editing (etable));
+ break;
default:
break;
}
@@ -2326,9 +2356,15 @@ et_set_property (GObject *object,
etable->click_to_add);
g_signal_connect (
+ etable->click_to_add, "event",
+ G_CALLBACK (click_to_add_event), etable);
+ g_signal_connect (
etable->click_to_add, "cursor_change",
G_CALLBACK (click_to_add_cursor_change),
etable);
+ g_signal_connect (
+ etable->click_to_add, "notify::is-editing",
+ G_CALLBACK (click_to_add_is_editing_changed_cb), etable);
} else {
g_object_run_dispose (G_OBJECT (etable->click_to_add));
etable->click_to_add = NULL;
@@ -3562,6 +3598,16 @@ e_table_class_init (ETableClass *class)
E_TYPE_TABLE_MODEL,
G_PARAM_READABLE));
+ g_object_class_install_property (
+ object_class,
+ PROP_IS_EDITING,
+ g_param_spec_boolean (
+ "is-editing",
+ "Whether is in an editing mode",
+ "Whether is in an editing mode",
+ FALSE,
+ G_PARAM_READABLE));
+
gtk_widget_class_install_style_property (
widget_class,
g_param_spec_int (
@@ -3610,3 +3656,12 @@ e_table_thaw_state_change (ETable *table)
e_table_state_change (table);
}
}
+
+gboolean
+e_table_is_editing (ETable *table)
+{
+ g_return_val_if_fail (E_IS_TABLE (table), FALSE);
+
+ return (table->click_to_add && e_table_click_to_add_is_editing (E_TABLE_CLICK_TO_ADD (table->click_to_add))) ||
+ (table->group && e_table_group_is_editing (table->group));
+}
diff --git a/e-util/e-table.h b/e-util/e-table.h
index c18ca084fb..01e73cc1d6 100644
--- a/e-util/e-table.h
+++ b/e-util/e-table.h
@@ -395,6 +395,7 @@ void e_table_commit_click_to_add (ETable *table);
void e_table_freeze_state_change (ETable *table);
void e_table_thaw_state_change (ETable *table);
+gboolean e_table_is_editing (ETable *table);
G_END_DECLS
diff --git a/e-util/e-tree.c b/e-util/e-tree.c
index 8db2009fa0..d8fb95e6d2 100644
--- a/e-util/e-tree.c
+++ b/e-util/e-tree.c
@@ -97,6 +97,7 @@ enum {
PROP_DRAW_FOCUS,
PROP_ETTA,
PROP_UNIFORM_ROW_HEIGHT,
+ PROP_IS_EDITING,
PROP_ALWAYS_SEARCH,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
@@ -259,6 +260,16 @@ G_DEFINE_TYPE_WITH_CODE (ETree, e_tree, GTK_TYPE_TABLE,
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
static void
+tree_item_is_editing_changed_cb (ETableItem *item,
+ GParamSpec *param,
+ ETree *tree)
+{
+ g_return_if_fail (E_IS_TREE (tree));
+
+ g_object_notify (G_OBJECT (tree), "is-editing");
+}
+
+static void
et_disconnect_from_etta (ETree *tree)
{
if (tree->priv->table_model_change_id != 0)
@@ -1131,6 +1142,9 @@ et_build_item (ETree *tree)
g_signal_connect (
tree->priv->item, "start_drag",
G_CALLBACK (item_start_drag), tree);
+ g_signal_connect (
+ tree->priv->item, "notify::is-editing",
+ G_CALLBACK (tree_item_is_editing_changed_cb), tree);
}
static void
@@ -1888,6 +1902,10 @@ et_get_property (GObject *object,
g_value_set_boolean (value, tree->priv->uniform_row_height);
break;
+ case PROP_IS_EDITING:
+ g_value_set_boolean (value, e_tree_is_editing (tree));
+ break;
+
case PROP_ALWAYS_SEARCH:
g_value_set_boolean (value, tree->priv->always_search);
break;
@@ -3198,6 +3216,16 @@ e_tree_class_init (ETreeClass *class)
g_object_class_install_property (
object_class,
+ PROP_IS_EDITING,
+ g_param_spec_boolean (
+ "is-editing",
+ "Whether is in an editing mode",
+ "Whether is in an editing mode",
+ FALSE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
PROP_ALWAYS_SEARCH,
g_param_spec_boolean (
"always_search",
@@ -3336,3 +3364,11 @@ e_tree_thaw_state_change (ETree *tree)
e_tree_state_change (tree);
}
}
+
+gboolean
+e_tree_is_editing (ETree *tree)
+{
+ g_return_val_if_fail (E_IS_TREE (tree), FALSE);
+
+ return tree->priv->item && e_table_item_is_editing (E_TABLE_ITEM (tree->priv->item));
+}
diff --git a/e-util/e-tree.h b/e-util/e-tree.h
index a443c94324..5f97d54a6e 100644
--- a/e-util/e-tree.h
+++ b/e-util/e-tree.h
@@ -268,6 +268,8 @@ void e_tree_set_info_message (ETree *tree,
void e_tree_freeze_state_change (ETree *tree);
void e_tree_thaw_state_change (ETree *tree);
+gboolean e_tree_is_editing (ETree *tree);
+
G_END_DECLS
#endif /* E_TREE_H */