aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-03 09:07:13 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:49 +0800
commita242a2c172878853755efa496b717f867abdd2f8 (patch)
tree65c0521188f811d4973dd947a8d4974ea5583988 /e-util
parent99f04cfe58dd707ecfd02f4b3f792175acabb305 (diff)
downloadgsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar.gz
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar.bz2
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar.lz
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar.xz
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.tar.zst
gsoc2013-evolution-a242a2c172878853755efa496b717f867abdd2f8.zip
GalViewEtable: Remove ETableState member.
Obtain the ETableState from the attached ETable or ETree as needed.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/gal-view-etable.c70
1 files changed, 39 insertions, 31 deletions
diff --git a/e-util/gal-view-etable.c b/e-util/gal-view-etable.c
index 08c612ab2d..4efdc539c3 100644
--- a/e-util/gal-view-etable.c
+++ b/e-util/gal-view-etable.c
@@ -23,7 +23,6 @@
((obj), GAL_TYPE_VIEW_ETABLE, GalViewEtablePrivate))
struct _GalViewEtablePrivate {
- ETableState *state;
gchar *state_filename;
ETable *table;
@@ -83,9 +82,22 @@ gal_view_etable_save (GalView *view,
GalViewEtable *view_etable;
view_etable = GAL_VIEW_ETABLE (view);
- g_return_if_fail (view_etable->priv->state != NULL);
- e_table_state_save_to_file (view_etable->priv->state, filename);
+ if (view_etable->priv->table != NULL) {
+ ETableState *state;
+
+ state = e_table_get_state_object (view_etable->priv->table);
+ e_table_state_save_to_file (state, filename);
+ g_object_unref (state);
+ }
+
+ if (view_etable->priv->tree != NULL) {
+ ETableState *state;
+
+ state = e_tree_get_state_object (view_etable->priv->tree);
+ e_table_state_save_to_file (state, filename);
+ g_object_unref (state);
+ }
}
static const gchar *
@@ -105,10 +117,6 @@ gal_view_etable_clone (GalView *view)
gve = GAL_VIEW_ETABLE (view);
- if (gve->priv->state != NULL)
- GAL_VIEW_ETABLE (clone)->priv->state =
- e_table_state_duplicate (gve->priv->state);
-
GAL_VIEW_ETABLE (clone)->priv->state_filename =
g_strdup (gve->priv->state_filename);
@@ -122,8 +130,6 @@ gal_view_etable_dispose (GObject *object)
gal_view_etable_detach (view);
- g_clear_object (&view->priv->state);
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (gal_view_etable_parent_class)->dispose (object);
}
@@ -181,22 +187,16 @@ gal_view_etable_new (const gchar *title)
static void
table_state_changed (ETable *table,
- GalViewEtable *view)
+ GalView *view)
{
- g_clear_object (&view->priv->state);
- view->priv->state = e_table_get_state_object (table);
-
- gal_view_changed (GAL_VIEW (view));
+ gal_view_changed (view);
}
static void
tree_state_changed (ETree *tree,
- GalViewEtable *view)
+ GalView *view)
{
- g_clear_object (&view->priv->state);
- view->priv->state = e_tree_get_state_object (tree);
-
- gal_view_changed (GAL_VIEW (view));
+ gal_view_changed (view);
}
void
@@ -208,18 +208,22 @@ gal_view_etable_attach_table (GalViewEtable *view,
gal_view_etable_detach (view);
- /* Load the state file now, if necessary. */
- if (view->priv->state == NULL && view->priv->state_filename != NULL) {
+ /* Load the state file now. */
+ if (view->priv->state_filename != NULL) {
ETableSpecification *specification;
- const gchar *filename = view->priv->state_filename;
+ ETableState *state;
specification = table->spec;
- view->priv->state = e_table_state_new (specification);
- e_table_state_load_from_file (view->priv->state, filename);
+ state = e_table_state_new (specification);
+ e_table_state_load_from_file (
+ state, view->priv->state_filename);
+
+ e_table_set_state_object (table, state);
+
+ g_object_unref (state);
}
view->priv->table = g_object_ref (table);
- e_table_set_state_object (view->priv->table, view->priv->state);
view->priv->table_state_changed_id = g_signal_connect (
view->priv->table, "state_change",
@@ -235,18 +239,22 @@ gal_view_etable_attach_tree (GalViewEtable *view,
gal_view_etable_detach (view);
- /* Load the state file now, if necessary. */
- if (view->priv->state == NULL && view->priv->state_filename != NULL) {
+ /* Load the state file now. */
+ if (view->priv->state_filename != NULL) {
ETableSpecification *specification;
- const gchar *filename = view->priv->state_filename;
+ ETableState *state;
specification = e_tree_get_spec (tree);
- view->priv->state = e_table_state_new (specification);
- e_table_state_load_from_file (view->priv->state, filename);
+ state = e_table_state_new (specification);
+ e_table_state_load_from_file (
+ state, view->priv->state_filename);
+
+ e_tree_set_state_object (tree, state);
+
+ g_object_unref (state);
}
view->priv->tree = g_object_ref (tree);
- e_tree_set_state_object (view->priv->tree, view->priv->state);
view->priv->tree_state_changed_id = g_signal_connect (
view->priv->tree, "state_change",