[rhythmbox] display-page: make pixbuf a construct property



commit 323b901261209513ca1a63fcc9d9eb198c4c823a
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Aug 29 22:57:35 2012 +1000

    display-page: make pixbuf a construct property
    
    Playlist and iradio sources need to adapt to this to set their pixbufs
    in constructed rather than init, so it doesn't get overwritten by the
    default.

 plugins/iradio/rb-iradio-source.c   |   25 ++++++++++++-------------
 sources/rb-auto-playlist-source.c   |    8 +++++++-
 sources/rb-display-page.c           |    2 +-
 sources/rb-static-playlist-source.c |   10 +++++++++-
 4 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 06c8050..e1d1c61 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -227,20 +227,7 @@ rb_iradio_source_class_finalize (RBIRadioSourceClass *klass)
 static void
 rb_iradio_source_init (RBIRadioSource *source)
 {
-	gint size;
-	GdkPixbuf *pixbuf;
-
 	source->priv = RB_IRADIO_SOURCE_GET_PRIVATE (source);
-
-	gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
-	pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-					   IRADIO_SOURCE_ICON,
-					   size,
-					   0, NULL);
-	g_object_set (source, "pixbuf", pixbuf, NULL);
-	if (pixbuf != NULL) {
-		g_object_unref (pixbuf);
-	}
 }
 
 static void
@@ -296,6 +283,8 @@ rb_iradio_source_constructed (GObject *object)
 	GtkWidget *grid;
 	GtkWidget *paned;
 	RBSourceToolbar *toolbar;
+	gint size;
+	GdkPixbuf *pixbuf;
 
 	RB_CHAIN_GOBJECT_METHOD (rb_iradio_source_parent_class, constructed, object);
 	source = RB_IRADIO_SOURCE (object);
@@ -310,6 +299,16 @@ rb_iradio_source_constructed (GObject *object)
 		      NULL);
 	g_object_unref (shell);
 
+	gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
+	pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+					   IRADIO_SOURCE_ICON,
+					   size,
+					   0, NULL);
+	g_object_set (source, "pixbuf", pixbuf, NULL);
+	if (pixbuf != NULL) {
+		g_object_unref (pixbuf);
+	}
+
 	settings = g_settings_new ("org.gnome.rhythmbox.plugins.iradio");
 	if (g_settings_get_boolean (settings, "initial-stations-loaded") == FALSE) {
 		GObject *plugin;
diff --git a/sources/rb-auto-playlist-source.c b/sources/rb-auto-playlist-source.c
index 691b80f..680ed49 100644
--- a/sources/rb-auto-playlist-source.c
+++ b/sources/rb-auto-playlist-source.c
@@ -173,7 +173,7 @@ rb_auto_playlist_source_class_init (RBAutoPlaylistSourceClass *klass)
 }
 
 static void
-rb_auto_playlist_source_init (RBAutoPlaylistSource *source)
+set_playlist_pixbuf (RBAutoPlaylistSource *source)
 {
 	if (playlist_pixbuf == NULL) {
 		gint size;
@@ -193,7 +193,11 @@ rb_auto_playlist_source_init (RBAutoPlaylistSource *source)
 	} else {
 		g_object_set (source, "pixbuf", playlist_pixbuf, NULL);
 	}
+}
 
+static void
+rb_auto_playlist_source_init (RBAutoPlaylistSource *source)
+{
 }
 
 static void
@@ -280,6 +284,8 @@ rb_auto_playlist_source_constructed (GObject *object)
 
 	priv->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
 
+	set_playlist_pixbuf (source);
+
 	g_object_get (RB_PLAYLIST_SOURCE (source), "entry-type", &entry_type, NULL);
 	priv->browser = rb_library_browser_new (rb_playlist_source_get_db (RB_PLAYLIST_SOURCE (source)),
 						entry_type);
diff --git a/sources/rb-display-page.c b/sources/rb-display-page.c
index d9dbe31..51babeb 100644
--- a/sources/rb-display-page.c
+++ b/sources/rb-display-page.c
@@ -671,7 +671,7 @@ rb_display_page_class_init (RBDisplayPageClass *klass)
 							      "Pixbuf",
 							      "Page pixbuf",
 							      GDK_TYPE_PIXBUF,
-							      G_PARAM_READWRITE));
+							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 	/**
 	 * RBDisplayPage:visibility:
 	 *
diff --git a/sources/rb-static-playlist-source.c b/sources/rb-static-playlist-source.c
index a8b4ee8..8cede31 100644
--- a/sources/rb-static-playlist-source.c
+++ b/sources/rb-static-playlist-source.c
@@ -220,8 +220,9 @@ rb_static_playlist_source_create_actions (RBShell *shell)
 
 	g_type_class_unref (klass);
 }
+
 static void
-rb_static_playlist_source_init (RBStaticPlaylistSource *source)
+set_playlist_pixbuf (RBStaticPlaylistSource *source)
 {
 	if (playlist_pixbuf == NULL) {
 		gint size;
@@ -245,6 +246,11 @@ rb_static_playlist_source_init (RBStaticPlaylistSource *source)
 }
 
 static void
+rb_static_playlist_source_init (RBStaticPlaylistSource *source)
+{
+}
+
+static void
 rb_static_playlist_source_dispose (GObject *object)
 {
 	RBStaticPlaylistSourcePrivate *priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (object);
@@ -311,6 +317,8 @@ rb_static_playlist_source_constructed (GObject *object)
 	priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (source);
 	psource = RB_PLAYLIST_SOURCE (source);
 
+	set_playlist_pixbuf (source);
+
 	priv->base_model = rb_playlist_source_get_query_model (RB_PLAYLIST_SOURCE (psource));
 	g_object_set (priv->base_model, "show-hidden", TRUE, NULL);
 	g_object_ref (priv->base_model);



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