[goffice] Enhance graph guru behavior when an object is deleted. [#687102]
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Enhance graph guru behavior when an object is deleted. [#687102]
- Date: Sun, 4 Nov 2012 08:18:19 +0000 (UTC)
commit 9d949bf307213f120a7c75bc84870c9056a56f2b
Author: Jean Brefort <jean brefort normalesup org>
Date: Sun Nov 4 09:17:39 2012 +0100
Enhance graph guru behavior when an object is deleted. [#687102]
ChangeLog | 5 +++++
NEWS | 1 +
goffice/graph/gog-guru.c | 29 ++++++++++++++++++++++++-----
3 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c0605c9..192abc0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-04 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-guru.c (cb_graph_guru_delete_item): select another
+ child with the same type when one exists instead of the parent. [#687102]
+
2012-11-03 Jean Brefort <jean brefort normalesup org>
* goffice/Makefile.am: add goffice-utils.c.
diff --git a/NEWS b/NEWS
index 0d258b4..7d6180a 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Jean:
* Fixed position of rotated label frame. [#686478]
* Fixed image clipping. [#686490]
* Improve padding between axis ticks and labels. [#686473]
+ * Enhance graph guru behavior when an object is deleted. [#687102]
Morten:
* Namespace cleanup. [#686501]
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index 9e26168..4723f9d 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -523,11 +523,30 @@ cb_graph_guru_delete_item (GraphGuruState *s)
{
if (s->prop_object != NULL) {
GtkTreeIter iter;
- GogObject *obj = s->prop_object;
-
- /* store parent iter */
- gtk_tree_model_iter_parent (GTK_TREE_MODEL (s->prop_model),
- &iter, &s->prop_iter);
+ GogObject *obj = NULL;
+ GtkTreeModel *model = GTK_TREE_MODEL (s->prop_model);
+
+ /* we select the next or the previous object if they are of the same
+ * type than the deleted object, otherwise, we select the parent */
+ /* search for next object */
+ iter = s->prop_iter;
+ if (gtk_tree_model_iter_next (model, &iter))
+ gtk_tree_model_get (model, &iter, PLOT_ATTR_OBJECT, &obj, -1);
+ if (obj == NULL || G_OBJECT_TYPE (obj) != G_OBJECT_TYPE (s->prop_object)) {
+ /* search for previous object */
+ obj = NULL;
+ iter = s->prop_iter;
+ if (gtk_tree_model_iter_previous (model, &iter))
+ gtk_tree_model_get (model, &iter, PLOT_ATTR_OBJECT, &obj, -1);
+ else
+ obj = NULL;
+ if (obj == NULL || G_OBJECT_TYPE (obj) != G_OBJECT_TYPE (s->prop_object)) {
+ /* store parent iter */
+ gtk_tree_model_iter_parent (model ,
+ &iter, &s->prop_iter);
+ }
+ }
+ obj = s->prop_object;
gog_object_clear_parent (obj);
g_object_unref (obj);
/* then select the parent after we delete */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]