[maemo-commits] [maemo-commits] r15498 - in projects/haf/trunk/hildon-fm: . debian hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Apr 29 14:11:05 EEST 2008
Author: kihamala
Date: 2008-04-29 14:11:04 +0300 (Tue, 29 Apr 2008)
New Revision: 15498

Modified:
   projects/haf/trunk/hildon-fm/ChangeLog
   projects/haf/trunk/hildon-fm/debian/changelog
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-model.c
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.h
Log:
added voldev_mounted signal


Modified: projects/haf/trunk/hildon-fm/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-fm/ChangeLog	2008-04-29 07:12:02 UTC (rev 15497)
+++ projects/haf/trunk/hildon-fm/ChangeLog	2008-04-29 11:11:04 UTC (rev 15498)
@@ -1,3 +1,16 @@
+2008-04-29  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	* hildon-fm/hildon-file-system-model.c: Add new member
+	signal_voldev_mounted to struct _HildonFileSystemModelPrivate.
+	(notify_volumes_changed): Emit "voldev_mounted" if MMC or USB volume
+	was mounted. Differentiating unmount from mount is based on the
+	hildon_file_system_voldev_is_visible function.
+	(hildon_file_system_model_init): Add new "voldev_mounted" signal.
+	Original patch from Yang. Related to NB#76324
+
+	* hildon-fm/hildon-file-system-voldev.h: Expose
+	hildon_file_system_voldev_is_visible as a library-internal function.
+
 2008-04-28  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	Released 2.0.5

Modified: projects/haf/trunk/hildon-fm/debian/changelog
===================================================================
--- projects/haf/trunk/hildon-fm/debian/changelog	2008-04-29 07:12:02 UTC (rev 15497)
+++ projects/haf/trunk/hildon-fm/debian/changelog	2008-04-29 11:11:04 UTC (rev 15498)
@@ -1,3 +1,9 @@
+libhildonfm (1:2.0.6~unreleased) unstable; urgency=low
+
+  * Patch to add voldev-mounted signal. Related to NB#76324
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue, 29 Apr 2008 13:50:11 +0300
+
 libhildonfm (1:2.0.5) unstable; urgency=low
 
   * Add checks to hildon-file-system-smb.c signal handlers to avoid a crash.
@@ -3,5 +9,5 @@
     Fixes: NB#79106
 
- -- Marius Vollmer <marius.vollmer at nokia.com>  Wed, 23 Apr 2008 17:21:24 +0300
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Mon, 28 Apr 2008 18:28:44 +0300
 
 libhildonfm (1:2.0.4) unstable; urgency=low

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-model.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-model.c	2008-04-29 07:12:02 UTC (rev 15497)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-model.c	2008-04-29 11:11:04 UTC (rev 15498)
@@ -38,6 +38,7 @@
 #include "hildon-file-system-model.h"
 #include "hildon-file-system-private.h"
 #include "hildon-file-system-settings.h"
+#include "hildon-file-system-voldev.h"
 #include <glib/gprintf.h>
 #include <string.h>
 #include <stdlib.h>
@@ -131,6 +132,8 @@
        enumerated at least once.
     */
    gboolean first_root_scan_completed;
+   /* registered new signal for notifying the fm about the volume changes */
+   guint signal_voldev_mounted;
 };
 
 typedef struct {
@@ -1737,10 +1740,33 @@
 static gboolean notify_volumes_changed(GNode *node, gpointer data)
 {
     HildonFileSystemModelNode *model_node = node->data;
-
-    if (model_node->location)
-	hildon_file_system_special_location_volumes_changed(model_node->location, data);
-
+    HildonFileSystemVoldev *voldev = NULL;
+ 
+    if (model_node->location){
+ 	hildon_file_system_special_location_volumes_changed(model_node->location, data);
+	/* check if the special location is voldev */
+	if (HILDON_IS_FILE_SYSTEM_VOLDEV(model_node->location)){
+	  if (model_node->model == NULL){
+	     ULOG_ERR_F("hildon tree model is NULL");
+	  }
+	  else {
+	     voldev = HILDON_FILE_SYSTEM_VOLDEV (model_node->location);
+	     if ((voldev->vol_type == EXT_CARD) || 
+		(voldev->vol_type == USB_STORAGE) ||
+		(voldev->vol_type == INT_CARD)){
+	        voldev->volume = find_volume(model_node->location->basepath);
+	       if (voldev->volume != NULL){
+		 if (hildon_file_system_voldev_is_visible(model_node->location, FALSE) == TRUE){ 
+		    g_signal_emit(model_node->model, 
+				  model_node->model->priv->signal_voldev_mounted, 
+				  0,
+				  model_node->location->basepath);
+		 }
+	       }
+	     }
+	  }
+	}
+    }
     return FALSE;
 }
 
@@ -2102,6 +2128,13 @@
     priv->column_types[HILDON_FILE_SYSTEM_MODEL_COLUMN_IS_DRIVE] =
         G_TYPE_BOOLEAN;
 
+    priv->signal_voldev_mounted = g_signal_new ("voldev_mounted", 
+						HILDON_TYPE_FILE_SYSTEM_MODEL,            
+						G_SIGNAL_RUN_LAST,
+						0, NULL, NULL,             
+						g_cclosure_marshal_VOID__STRING, 
+						G_TYPE_NONE, 1, G_TYPE_STRING);
+
     priv->stamp = g_random_int();
     priv->cache_queue = g_queue_new();
     priv->first_root_scan_completed = FALSE;

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c	2008-04-29 07:12:02 UTC (rev 15497)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c	2008-04-29 11:11:04 UTC (rev 15498)
@@ -47,10 +47,6 @@
 static void
 hildon_file_system_voldev_init (HildonFileSystemVoldev *device);
 
-static gboolean
-hildon_file_system_voldev_is_visible (HildonFileSystemSpecialLocation *location,
-				      gboolean has_children);
-
 static void
 hildon_file_system_voldev_volumes_changed (HildonFileSystemSpecialLocation
                                            *location, GtkFileSystem *fs);
@@ -166,7 +162,7 @@
     G_OBJECT_CLASS (hildon_file_system_voldev_parent_class)->finalize (obj);
 }
 
-static gboolean
+gboolean __attribute__ ((visibility("hidden")))
 hildon_file_system_voldev_is_visible (HildonFileSystemSpecialLocation *location,
 				      gboolean has_children)
 {
@@ -248,7 +244,7 @@
   return drive;
 }
 
-static GnomeVFSVolume *
+GnomeVFSVolume *
 find_volume (const char *uri)
 {
   GnomeVFSVolumeMonitor *monitor;

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.h
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.h	2008-04-29 07:12:02 UTC (rev 15497)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.h	2008-04-29 11:11:04 UTC (rev 15498)
@@ -67,6 +67,12 @@
 
 GType hildon_file_system_voldev_get_type (void) G_GNUC_CONST;
 
+GnomeVFSVolume *find_volume (const char *uri);
+
+gboolean
+hildon_file_system_voldev_is_visible (HildonFileSystemSpecialLocation *location,
+				      gboolean has_children);
+
 G_END_DECLS
 
 #endif


More information about the maemo-commits mailing list