[gnome-control-center] background: Rearrange the GObject boilerplate



commit b950a69f3be3d29a560a74f699d90265532b9dcc
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 17 11:59:58 2014 +0200

    background: Rearrange the GObject boilerplate
    
    ... so that it is possible to override virtual functions and change
    the order of the object creation and destruction process without having
    to write a bunch of prototypes. Having the class_init below the others
    helps us do that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731713

 panels/background/bg-colors-source.c     |   10 +++---
 panels/background/bg-wallpapers-source.c |   42 +++++++++++++++---------------
 2 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/panels/background/bg-colors-source.c b/panels/background/bg-colors-source.c
index 8426439..2a67c53 100644
--- a/panels/background/bg-colors-source.c
+++ b/panels/background/bg-colors-source.c
@@ -32,11 +32,6 @@ G_DEFINE_TYPE (BgColorsSource, bg_colors_source, BG_TYPE_SOURCE)
 #define COLORS_SOURCE_PRIVATE(o) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), BG_TYPE_COLORS_SOURCE, BgColorsSourcePrivate))
 
-static void
-bg_colors_source_class_init (BgColorsSourceClass *klass)
-{
-}
-
 struct {
   GDesktopBackgroundShading type;
   int orientation;
@@ -109,6 +104,11 @@ bg_colors_source_init (BgColorsSource *self)
   g_object_unref (thumb_factory);
 }
 
+static void
+bg_colors_source_class_init (BgColorsSourceClass *klass)
+{
+}
+
 BgColorsSource *
 bg_colors_source_new (void)
 {
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index a741bbf..16bef34 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -41,27 +41,6 @@ struct _BgWallpapersSourcePrivate
 
 
 static void
-bg_wallpapers_source_dispose (GObject *object)
-{
-  BgWallpapersSourcePrivate *priv = BG_WALLPAPERS_SOURCE (object)->priv;
-
-  g_clear_object (&priv->thumb_factory);
-  g_clear_object (&priv->xml);
-
-  G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->dispose (object);
-}
-
-static void
-bg_wallpapers_source_class_init (BgWallpapersSourceClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  g_type_class_add_private (klass, sizeof (BgWallpapersSourcePrivate));
-
-  object_class->dispose = bg_wallpapers_source_dispose;
-}
-
-static void
 load_wallpapers (gchar              *key,
                  CcBackgroundItem   *item,
                  BgWallpapersSource *source)
@@ -132,6 +111,17 @@ load_default_bg (BgWallpapersSource *self)
 }
 
 static void
+bg_wallpapers_source_dispose (GObject *object)
+{
+  BgWallpapersSourcePrivate *priv = BG_WALLPAPERS_SOURCE (object)->priv;
+
+  g_clear_object (&priv->thumb_factory);
+  g_clear_object (&priv->xml);
+
+  G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->dispose (object);
+}
+
+static void
 bg_wallpapers_source_init (BgWallpapersSource *self)
 {
   BgWallpapersSourcePrivate *priv;
@@ -150,6 +140,16 @@ bg_wallpapers_source_init (BgWallpapersSource *self)
   cc_background_xml_load_list_async (priv->xml, NULL, list_load_cb, self);
 }
 
+static void
+bg_wallpapers_source_class_init (BgWallpapersSourceClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (BgWallpapersSourcePrivate));
+
+  object_class->dispose = bg_wallpapers_source_dispose;
+}
+
 BgWallpapersSource *
 bg_wallpapers_source_new (void)
 {


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