[gnome-control-center] background: Show 'Adwaita' as the first in the list



commit e5fb92268ff06cfce462787cb12765b1ccc9ebb6
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Feb 12 03:12:52 2011 +0000

    background: Show 'Adwaita' as the first in the list
    
    https://bugzilla.gnome.org/show_bug.cgi?id=637384

 panels/background/bg-wallpapers-source.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index d5f4aa3..b80e2a5 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -152,6 +152,29 @@ item_added (CcBackgroundXml    *xml,
 }
 
 static void
+load_default_bg (BgWallpapersSource *self)
+{
+  const char * const *system_data_dirs;
+  char *filename;
+  guint i;
+
+  /* FIXME We could do this nicer if we had the XML source in GSettings */
+
+  system_data_dirs = g_get_system_data_dirs ();
+  for (i = 0; system_data_dirs[i]; i++) {
+    filename = g_build_filename (system_data_dirs[i],
+				 "gnome-background-properties",
+				 "adwaita.xml",
+				 NULL);
+    if (cc_background_xml_load_xml (self->priv->xml, filename)) {
+      g_free (filename);
+      break;
+    }
+    g_free (filename);
+  }
+}
+
+static void
 bg_wallpapers_source_init (BgWallpapersSource *self)
 {
   BgWallpapersSourcePrivate *priv;
@@ -163,6 +186,10 @@ bg_wallpapers_source_init (BgWallpapersSource *self)
   priv->xml = cc_background_xml_new ();
   g_signal_connect (G_OBJECT (priv->xml), "added",
 		    G_CALLBACK (item_added), self);
+
+  /* Try adding the default background first */
+  load_default_bg (self);
+
   cc_background_xml_load_list_async (priv->xml, NULL, list_load_cb, self);
 }
 



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