[libchamplain] Remove some unnecessary refs/unrefs



commit 18e147b48516c33c0568392f6e4176577065d290
Author: JiÅ?í Techet <techet gmail com>
Date:   Tue Mar 22 00:54:22 2011 +0100

    Remove some unnecessary refs/unrefs

 champlain/champlain-label.c |   24 ++++-----------------
 champlain/champlain-view.c  |   47 ++++++++++++++----------------------------
 2 files changed, 21 insertions(+), 50 deletions(-)
---
diff --git a/champlain/champlain-label.c b/champlain/champlain-label.c
index 7d22074..dc089b0 100644
--- a/champlain/champlain-label.c
+++ b/champlain/champlain-label.c
@@ -340,22 +340,13 @@ champlain_label_dispose (GObject *object)
   ChamplainLabelPrivate *priv = CHAMPLAIN_LABEL (object)->priv;
 
   if (priv->background)
-    {
-      g_object_unref (priv->background);
-      priv->background = NULL;
-    }
+    priv->background = NULL;
 
   if (priv->shadow)
-    {
-      g_object_unref (priv->shadow);
-      priv->shadow = NULL;
-    }
+    priv->shadow = NULL;
 
   if (priv->text_actor)
-    {
-      g_object_unref (priv->text_actor);
-      priv->text_actor = NULL;
-    }
+    priv->text_actor = NULL;
 
   if (priv->image)
     {
@@ -660,10 +651,9 @@ draw_shadow (ChamplainLabel *label,
     {
       clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
           priv->shadow);
-      g_object_unref (priv->shadow);
     }
 
-  priv->shadow = g_object_ref (shadow);
+  priv->shadow = shadow;
 }
 
 
@@ -720,10 +710,9 @@ draw_background (ChamplainLabel *label,
     {
       clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group),
           priv->background);
-      g_object_unref (priv->background);
     }
 
-  priv->background = g_object_ref (bg);
+  priv->background = bg;
 }
 
 
@@ -750,7 +739,6 @@ draw_label (ChamplainLabel *label)
       if (priv->text_actor == NULL)
         {
           priv->text_actor = clutter_text_new_with_text (priv->font_name, priv->text);
-          g_object_ref (priv->text_actor);
         }
 
       text = CLUTTER_TEXT (priv->text_actor);
@@ -803,14 +791,12 @@ draw_label (ChamplainLabel *label)
       if (priv->background != NULL)
         {
           clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group), priv->background);
-          g_object_unref (G_OBJECT (priv->background));
           priv->background = NULL;
         }
 
       if (priv->shadow != NULL)
         {
           clutter_container_remove_actor (CLUTTER_CONTAINER (priv->content_group), priv->shadow);
-          g_object_unref (G_OBJECT (priv->shadow));
           priv->shadow = NULL;
         }
     }
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index b8e4868..650d163 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -165,8 +165,6 @@ struct _ChamplainViewPrivate
   gint viewport_width;
   gint viewport_height;
 
-  ClutterActor *viewport_container;
-
   ClutterActor *user_layers; /* Contains the markers */
 
   gboolean keep_center_on_resize;
@@ -512,42 +510,28 @@ champlain_view_dispose (GObject *object)
     }
 
   if (priv->view_box != NULL)
-    {
-      g_object_unref (priv->view_box);
-      priv->view_box = NULL;
-    }
+    priv->view_box = NULL;
 
   if (priv->license_actor != NULL)
-    {
-      g_object_unref (priv->license_actor);
-      priv->license_actor = NULL;
-    }
+    priv->license_actor = NULL;
 
   if (priv->kinetic_scroll != NULL)
     {
       champlain_kinetic_scroll_view_stop (CHAMPLAIN_KINETIC_SCROLL_VIEW (priv->kinetic_scroll));
-      g_object_unref (priv->kinetic_scroll);
       priv->kinetic_scroll = NULL;
     }
 
   if (priv->viewport != NULL)
     {
       champlain_viewport_stop (CHAMPLAIN_VIEWPORT (priv->viewport));
-      g_object_unref (priv->viewport);
       priv->viewport = NULL;
     }
 
   if (priv->map_layer != NULL)
-    {
-      g_object_unref (priv->map_layer);
-      priv->map_layer = NULL;
-    }
+    priv->map_layer = NULL;
 
   if (priv->user_layers != NULL)
-    {
-      g_object_unref (priv->user_layers);
-      priv->user_layers = NULL;
-    }
+    priv->user_layers = NULL;
 
   if (priv->goto_context != NULL)
     champlain_view_stop_go_to (view);
@@ -967,6 +951,7 @@ champlain_view_init (ChamplainView *view)
   ChamplainViewPrivate *priv = GET_PRIVATE (view);
   ChamplainMapSourceFactory *factory;
   ChamplainMapSource *source;
+  ClutterActor *viewport_container;
 
   champlain_debug_set_flags (g_getenv ("CHAMPLAIN_DEBUG"));
 
@@ -1000,25 +985,25 @@ champlain_view_init (ChamplainView *view)
   priv->update_viewport_timer = g_timer_new ();
 
   /* Setup map layer */
-  priv->map_layer = g_object_ref (champlain_group_new ());
+  priv->map_layer = champlain_group_new ();
   clutter_actor_show (priv->map_layer);
 
   /* Setup user_layers */
-  priv->user_layers = g_object_ref (clutter_group_new ());
+  priv->user_layers = clutter_group_new ();
   clutter_actor_show (priv->user_layers);
 
-  priv->viewport_container = g_object_ref (clutter_group_new ());
+  viewport_container = clutter_group_new ();
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (priv->viewport_container),
+  clutter_container_add_actor (CLUTTER_CONTAINER (viewport_container),
       priv->map_layer);
-  clutter_container_add_actor (CLUTTER_CONTAINER (priv->viewport_container),
+  clutter_container_add_actor (CLUTTER_CONTAINER (viewport_container),
       priv->user_layers);
 
-  clutter_actor_show (priv->viewport_container);
+  clutter_actor_show (viewport_container);
 
   /* Setup viewport */
-  priv->viewport = g_object_ref (champlain_viewport_new ());
-  champlain_viewport_set_child (CHAMPLAIN_VIEWPORT (priv->viewport), priv->viewport_container);
+  priv->viewport = champlain_viewport_new ();
+  champlain_viewport_set_child (CHAMPLAIN_VIEWPORT (priv->viewport), viewport_container);
 
   g_object_set (G_OBJECT (priv->viewport), "sync-adjustments", FALSE, NULL);
 
@@ -1030,7 +1015,7 @@ champlain_view_init (ChamplainView *view)
   clutter_actor_raise (priv->user_layers, priv->map_layer);
 
   /* Setup kinetic scroll */
-  priv->kinetic_scroll = g_object_ref (champlain_kinetic_scroll_view_new (FALSE));
+  priv->kinetic_scroll = champlain_kinetic_scroll_view_new (FALSE);
 
   g_signal_connect (priv->kinetic_scroll, "scroll-event",
       G_CALLBACK (scroll_event), view);
@@ -1050,7 +1035,7 @@ champlain_view_init (ChamplainView *view)
   /* Setup stage */
   priv->layout_manager = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER,
         CLUTTER_BIN_ALIGNMENT_CENTER);
-  priv->view_box = g_object_ref (clutter_box_new (priv->layout_manager));
+  priv->view_box = clutter_box_new (priv->layout_manager);
 
   clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->layout_manager), priv->kinetic_scroll,
       CLUTTER_BIN_ALIGNMENT_FILL,
@@ -1062,7 +1047,7 @@ champlain_view_init (ChamplainView *view)
   resize_viewport (view);
 
   /* Setup license */
-  priv->license_actor = g_object_ref (champlain_license_new ());
+  priv->license_actor = champlain_license_new ();
   champlain_license_connect_view (CHAMPLAIN_LICENSE (priv->license_actor), view);
   champlain_view_bin_layout_add (view, priv->license_actor,
       CLUTTER_BIN_ALIGNMENT_END,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]