[maemo-commits] [maemo-commits] r14248 - in projects/haf/trunk/hildon-home-webshortcut: . plugin

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Oct 1 20:02:51 EEST 2007
Author: jobi
Date: 2007-10-01 20:02:45 +0300 (Mon, 01 Oct 2007)
New Revision: 14248

Modified:
   projects/haf/trunk/hildon-home-webshortcut/ChangeLog
   projects/haf/trunk/hildon-home-webshortcut/plugin/hhws-background.c
Log:

2007-10-01  Johan Bilien  <johan.bilien at nokia.com>

	* plugin/hws-background.c: Cache the background if located
	on second MMC.



Modified: projects/haf/trunk/hildon-home-webshortcut/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-home-webshortcut/ChangeLog	2007-10-01 16:35:48 UTC (rev 14247)
+++ projects/haf/trunk/hildon-home-webshortcut/ChangeLog	2007-10-01 17:02:45 UTC (rev 14248)
@@ -1,3 +1,8 @@
+2007-10-01  Johan Bilien  <johan.bilien at nokia.com>
+
+	* plugin/hws-background.c: Cache the background if located
+	on second MMC.
+
 2007-09-18  Johan Bilien  <johan.bilien at nokia.com>
 
 	* configure.ac: 1.9.99

Modified: projects/haf/trunk/hildon-home-webshortcut/plugin/hhws-background.c
===================================================================
--- projects/haf/trunk/hildon-home-webshortcut/plugin/hhws-background.c	2007-10-01 16:35:48 UTC (rev 14247)
+++ projects/haf/trunk/hildon-home-webshortcut/plugin/hhws-background.c	2007-10-01 17:02:45 UTC (rev 14248)
@@ -46,6 +46,7 @@
 #include <gconf/gconf-client.h>
 
 #define HHWS_ENV_MMC_MOUNTPOINT               "MMC_MOUNTPOINT"
+#define HHWS_ENV_SECOND_MMC_MOUNTPOINT        "INTERNAL_MMC_MOUNTPOINT"
 #define HHWS_BACKGROUND_CACHE_DIR             ".hhws-cache"
 
 #define HHWS_GCONF_IMAGE_URI    "/apps/osso/apps/hhws/image_uri"
@@ -224,7 +225,7 @@
   gchar        *filename = NULL;
   const gchar  *mmc_mount_point;
   gchar        *mmc_mount_point_uri = NULL;
-  gboolean      on_internal_mmc = FALSE, on_external_fs = FALSE;
+  gboolean      on_first_mmc = FALSE, on_second_mmc = FALSE, on_external_fs = FALSE;
 
   g_object_get (background,
                 "filename", &filename,
@@ -232,24 +233,38 @@
 
   g_return_val_if_fail (filename, FALSE);
 
+  if (filename[0] == '\0')
+    return FALSE;
+
   mmc_mount_point = g_getenv (HHWS_ENV_MMC_MOUNTPOINT);
-  mmc_mount_point_uri = g_strdup_printf ("file://%s", mmc_mount_point);
+  if (mmc_mount_point)
+  {
+    mmc_mount_point_uri = g_strdup_printf ("file://%s", mmc_mount_point);
 
-  if (mmc_mount_point &&
-      (g_str_has_prefix (filename, mmc_mount_point) ||
-       g_str_has_prefix (filename, mmc_mount_point_uri)))
-    on_internal_mmc = TRUE;
+    if (g_str_has_prefix (filename, mmc_mount_point) ||
+        g_str_has_prefix (filename, mmc_mount_point_uri))
+      on_first_mmc = TRUE;
 
-  g_free (mmc_mount_point_uri);
+    g_free (mmc_mount_point_uri);
+  }
 
+  mmc_mount_point = g_getenv (HHWS_ENV_SECOND_MMC_MOUNTPOINT);
+  if (mmc_mount_point)
+  {
+    mmc_mount_point_uri = g_strdup_printf ("file://%s", mmc_mount_point);
+
+    if (g_str_has_prefix (filename, mmc_mount_point) ||
+        g_str_has_prefix (filename, mmc_mount_point_uri))
+      on_second_mmc = TRUE;
+
+    g_free (mmc_mount_point_uri);
+  }
+
   on_external_fs = filename[0] != G_DIR_SEPARATOR &&
       (!g_str_has_prefix (filename, "file://"));
 
-  g_debug ("filename %s requires caching: %i",
-           filename,
-           (on_internal_mmc || on_external_fs));
+  return (on_first_mmc || on_second_mmc || on_external_fs);
 
-  return (on_internal_mmc || on_external_fs);
 
 }
 


More information about the maemo-commits mailing list