[gnumeric: 1/2] fix sheet object view life cycle.
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric: 1/2] fix sheet object view life cycle.
- Date: Thu, 27 Aug 2009 15:26:12 +0000 (UTC)
commit 79145d4cdef206ed7be27664d1413f1daac9aa48
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Aug 27 17:24:57 2009 +0200
fix sheet object view life cycle.
ChangeLog | 19 +++++++++++++++++++
src/gnm-pane.c | 2 --
src/gnm-so-filled.c | 6 ------
src/gnm-so-line.c | 6 ------
src/gnm-so-polygon.c | 6 ------
src/sheet-control-gui.c | 19 +------------------
src/sheet-object-cell-comment.c | 6 ------
src/sheet-object-graph.c | 6 ------
src/sheet-object-image.c | 6 ------
src/sheet-object-impl.h | 2 --
src/sheet-object-widget.c | 8 --------
src/sheet-object.c | 26 +++++---------------------
src/wbc-gtk-edit.c | 13 +------------
13 files changed, 26 insertions(+), 99 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bbdd02e..548fba0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2009-08-27 Jean Brefort <jean brefort normalesup org>
+
+ * src/gnm-so-filled.c (so_filled_item_view_class_init): deprecate the
+ detroy method.
+ * src/gnm-so-line.c (so_line_goc_view_class_init): ditto.
+ * src/gnm-so-polygon.c (so_polygon_goc_view_class_init): ditto.
+ * src/sheet-control-gui.c (scg_resize), (scg_finalize),
+ (scg_object_select), (cb_scg_object_unselect): cleaned.
+ * src/sheet-object-cell-comment.c (comment_view_class_init): deprecate the
+ detroy method.
+ * src/sheet-object-graph.c (so_graph_goc_view_class_init): ditto.
+ * src/sheet-object-image.c (so_image_goc_view_class_init): ditto.
+ * src/sheet-object-impl.h: ditto.
+ * src/sheet-object-widget.c (so_widget_view_class_init): ditto.
+ * src/sheet-object.c (sheet_object_clear_sheet),
+ (sheet_object_new_view): ditto and fix a critical.
+ * src/wbc-gtk-edit.c (workbook_edit_complete_notify),
+ (cb_entry_delete_text): cleaned.
+
2009-08-26 Jean Brefort <jean brefort normalesup org>
* src/cell-draw.c (cell_draw): do no draw extra lines around rotated text.
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 93df29e..6b6cfe0 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -2284,8 +2284,6 @@ cb_so_menu_activate (GObject *menu, GocItem *view)
if (a->func)
(a->func) (sheet_object_view_get_so (SHEET_OBJECT_VIEW (view)),
SHEET_CONTROL (GNM_SIMPLE_CANVAS (view->canvas)->scg));
-
-
}
static GtkWidget *
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index 4243209..1e2e355 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -66,11 +66,6 @@ typedef struct {
} FilledItemView;
static void
-so_filled_view_destroy (SheetObjectView *sov)
-{
- g_object_unref (G_OBJECT (sov));
-}
-static void
so_filled_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocItem *view = GOC_ITEM (sov);
@@ -114,7 +109,6 @@ so_filled_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean
static void
so_filled_item_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_filled_view_destroy;
sov_klass->set_bounds = so_filled_view_set_bounds;
}
diff --git a/src/gnm-so-line.c b/src/gnm-so-line.c
index d16f0e3..78ad5ed 100644
--- a/src/gnm-so-line.c
+++ b/src/gnm-so-line.c
@@ -79,11 +79,6 @@ static SheetObjectClass *gnm_so_line_parent_class;
#ifdef GNM_WITH_GTK
static void
-so_line_view_destroy (SheetObjectView *sov)
-{
- gtk_object_destroy (GTK_OBJECT (sov));
-}
-static void
so_line_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocItem *view = GOC_ITEM (sov), *item = GOC_ITEM (GOC_GROUP (view)->children->data);
@@ -108,7 +103,6 @@ so_line_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean vi
static void
so_line_goc_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_line_view_destroy;
sov_klass->set_bounds = so_line_view_set_bounds;
}
typedef SheetObjectView LineGocView;
diff --git a/src/gnm-so-polygon.c b/src/gnm-so-polygon.c
index 2bf0fd4..5511b3a 100644
--- a/src/gnm-so-polygon.c
+++ b/src/gnm-so-polygon.c
@@ -54,11 +54,6 @@ typedef SheetObjectClass GnmSOPolygonClass;
#ifdef GNM_WITH_GTK
#include "gnm-pane.h"
static void
-so_polygon_view_destroy (SheetObjectView *sov)
-{
- gtk_object_destroy (GTK_OBJECT (sov));
-}
-static void
so_polygon_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocItem *view = GOC_ITEM (sov->base.children->data);
@@ -100,7 +95,6 @@ so_polygon_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean
static void
so_polygon_goc_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_polygon_view_destroy;
sov_klass->set_bounds = so_polygon_view_set_bounds;
}
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 9090529..0e4eef3 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -311,7 +311,6 @@ static void
scg_resize (SheetControlGUI *scg, gboolean force_scroll)
{
Sheet const *sheet = scg_sheet (scg);
- double const scale = 1. / sheet->last_zoom_factor_used;
GnmPane *pane = scg_pane (scg, 0);
int h, w, btn_h, btn_w, tmp;
@@ -1536,7 +1535,7 @@ scg_finalize (GObject *object)
/* remove the object view before we disappear */
for (ptr = sheet->sheet_objects; ptr != NULL ; ptr = ptr->next )
SCG_FOREACH_PANE (scg, pane,
- sheet_object_view_destroy (
+ g_object_unref (
sheet_object_get_view (ptr->data, (SheetObjectViewContainer *)pane));
);
@@ -2087,14 +2086,6 @@ scg_object_select (SheetControlGUI *scg, SheetObject *so)
g_signal_connect_object (so, "unrealized",
G_CALLBACK (scg_mode_edit), scg, G_CONNECT_SWAPPED);
-#if 0
- if (SO_CLASS (so)->set_active != NULL) {
- SCG_FOREACH_PANE (scg, pane, {
- SO_CLASS (so)->set_active (so,
- sheet_object_get_view (so, pane), TRUE);
- });
- }
-#endif
SCG_FOREACH_PANE (scg, pane,
gnm_pane_object_update_bbox (pane, so););
}
@@ -2105,14 +2096,6 @@ cb_scg_object_unselect (SheetObject *so, double *coords, SheetControlGUI *scg)
SCG_FOREACH_PANE (scg, pane, gnm_pane_object_unselect (pane, so););
g_signal_handlers_disconnect_by_func (so,
scg_mode_edit, scg);
-
-#if 0
- if (SO_CLASS (old)->set_active != NULL)
- SCG_FOREACH_PANE (scg, pane, {
- SO_CLASS (old)->set_active (old,
- sheet_object_get_view (old, pane), FALSE);
- });
-#endif
}
/**
diff --git a/src/sheet-object-cell-comment.c b/src/sheet-object-cell-comment.c
index 95fb636..d2cd285 100644
--- a/src/sheet-object-cell-comment.c
+++ b/src/sheet-object-cell-comment.c
@@ -57,11 +57,6 @@ static GObjectClass *parent_klass;
#define TRIANGLE_WIDTH 6
static void
-comment_view_destroy (SheetObjectView *sov)
-{
- gtk_object_destroy (GTK_OBJECT (sov));
-}
-static void
comment_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocPoints *points = goc_points_new (3);
@@ -162,7 +157,6 @@ comment_view_class_init (SheetObjectViewClass *sov_klass)
{
GocItemClass *item_klass = (GocItemClass *) sov_klass;
- sov_klass->destroy = comment_view_destroy;
sov_klass->set_bounds = comment_view_set_bounds;
item_klass->button_pressed = comment_view_button_pressed;
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index f434a45..9404ffb 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -51,11 +51,6 @@
#include <string.h>
static void
-so_graph_view_destroy (SheetObjectView *sov)
-{
- g_object_unref (G_OBJECT (sov));
-}
-static void
so_graph_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocItem *view = GOC_ITEM (GOC_GROUP (sov)->children->data);
@@ -79,7 +74,6 @@ so_graph_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean v
static void
so_graph_goc_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_graph_view_destroy;
sov_klass->set_bounds = so_graph_view_set_bounds;
}
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 14f724e..dd6f28e 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -44,11 +44,6 @@ attr_eq (const xmlChar *a, const char *s)
}
static void
-so_image_view_destroy (SheetObjectView *sov)
-{
- gtk_object_destroy (GTK_OBJECT (sov));
-}
-static void
so_image_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
GocItem *view = GOC_ITEM (GOC_GROUP (sov)->children->data);
@@ -87,7 +82,6 @@ so_image_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean v
static void
so_image_goc_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_image_view_destroy;
sov_klass->set_bounds = so_image_view_set_bounds;
}
typedef SheetObjectView SOImageGocView;
diff --git a/src/sheet-object-impl.h b/src/sheet-object-impl.h
index 22f0710..037ed07 100644
--- a/src/sheet-object-impl.h
+++ b/src/sheet-object-impl.h
@@ -115,7 +115,6 @@ struct _SheetObjectView {
typedef struct {
GocGroupClass base;
- void (*destroy) (SheetObjectView *sov);
void (*active) (SheetObjectView *sov, gboolean is_active);
void (*set_bounds) (SheetObjectView *sov,
double const *coords, gboolean visible);
@@ -130,7 +129,6 @@ typedef struct {
GType sheet_object_view_get_type (void);
SheetObject *sheet_object_view_get_so (SheetObjectView *sov);
-void sheet_object_view_destroy (SheetObjectView *sov);
void sheet_object_view_set_bounds (SheetObjectView *sov,
double const *coords,
gboolean visible);
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 5ee7487..fc8b57c 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -118,13 +118,6 @@ so_clear_sheet (SheetObject *so)
return FALSE;
}
-
-static void
-so_widget_view_destroy (SheetObjectView *sov)
-{
- g_object_unref (G_OBJECT (sov));
-}
-
static void
so_widget_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean visible)
{
@@ -151,7 +144,6 @@ so_widget_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean
static void
so_widget_view_class_init (SheetObjectViewClass *sov_klass)
{
- sov_klass->destroy = so_widget_view_destroy;
sov_klass->set_bounds = so_widget_view_set_bounds;
}
diff --git a/src/sheet-object.c b/src/sheet-object.c
index 17a42a5..4cc50c2 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -406,9 +406,11 @@ sheet_object_clear_sheet (SheetObject *so)
g_object_set_data (G_OBJECT (so), "create_view_handler", NULL);
}
- /* The views remove themselves from the list */
- while (so->realized_list != NULL)
- sheet_object_view_destroy (so->realized_list->data);
+ while (so->realized_list != NULL) {
+ g_object_unref (G_OBJECT (so->realized_list->data));
+ so->realized_list = g_list_remove (so->realized_list, so->realized_list->data);
+
+ }
g_signal_emit (so, signals [UNREALIZED], 0);
if (SO_CLASS (so)->remove_from_sheet &&
@@ -478,13 +480,6 @@ sheet_object_foreach_dep (SheetObject *so,
SO_CLASS (so)->foreach_dep (so, func, user);
}
-
-static void
-cb_sheet_object_view_finalized (SheetObject *so, GObject *view)
-{
- so->realized_list = g_list_remove (so->realized_list, view);
-}
-
/**
* sheet_object_new_view:
* @so :
@@ -515,8 +510,6 @@ sheet_object_new_view (SheetObject *so, SheetObjectViewContainer *container)
/* Store some useful information */
g_object_set_qdata (G_OBJECT (view), sov_so_quark, so);
g_object_set_qdata (G_OBJECT (view), sov_container_quark, container);
- g_object_weak_ref (G_OBJECT (view),
- (GWeakNotify) cb_sheet_object_view_finalized, so);
so->realized_list = g_list_prepend (so->realized_list, view);
sheet_object_update_bounds (so, NULL);
@@ -1154,15 +1147,6 @@ sheet_object_view_button_pressed (GocItem *item, int button, double x, double y)
return TRUE;
}
-void
-sheet_object_view_destroy (SheetObjectView *sov)
-{
- SheetObjectViewClass *klass = SHEET_OBJECT_VIEW_GET_CLASS (sov);
- g_return_if_fail (klass != NULL);
- if (klass->destroy)
- klass->destroy (sov);
-}
-
static void
sheet_object_view_class_init (GocItemClass *item_klass)
{
diff --git a/src/wbc-gtk-edit.c b/src/wbc-gtk-edit.c
index 328071d..c6c2eef 100644
--- a/src/wbc-gtk-edit.c
+++ b/src/wbc-gtk-edit.c
@@ -326,14 +326,9 @@ static void
workbook_edit_complete_notify (char const *text, void *closure)
{
WBCGtk *wbcg = closure;
- SheetControlGUI *scg = wbcg_cur_scg (wbcg);
g_free (wbcg->auto_complete_text);
wbcg->auto_complete_text = g_strdup (text);
-
-/* SCG_FOREACH_PANE (scg, pane,
- if (pane->editor != NULL)
- foo_canvas_item_request_update (FOO_CANVAS_ITEM (pane->editor)););*/
}
static void
@@ -490,14 +485,8 @@ cb_entry_delete_text (GtkEditable *editable,
gint end_pos,
WBCGtk *wbcg)
{
- if (wbcg->auto_completing) {
- SheetControlGUI *scg = wbcg_cur_scg (wbcg);
+ if (wbcg->auto_completing)
wbcg_auto_complete_destroy (wbcg);
-/* if (scg)
- SCG_FOREACH_PANE (scg, pane,
- if (pane->editor != NULL)
- foo_canvas_item_request_update (FOO_CANVAS_ITEM (pane->editor)););*/
- }
if (wbcg->edit_line.full_content) {
char const *str = gtk_entry_get_text (GTK_ENTRY (editable));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]