[maemo-commits] [maemo-commits] r8516 - projects/haf/branches/hildon-fm/1.x/hildon-fm

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Thu Nov 30 18:36:47 EET 2006
Author: marivoll
Date: 2006-11-30 18:36:46 +0200 (Thu, 30 Nov 2006)
New Revision: 8516

Modified:
   projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-model.c
Log:
	* hildon-fm/hildon-file-system-model.c (location_rescan): New.
	(setup_node_for_location): Connect it.
	(hildon_file_system_model_destroy_model_node): Expect three
	signals to be disconnected.
	(hildon_file_system_model_queue_node_reload): Refactored out of
	_hildon_file_system_model_queue_reload in order to be able to
	reload nodes directly without having to construct a iter first.


Modified: projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-model.c
===================================================================
--- projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-model.c	2006-11-30 16:32:08 UTC (rev 8515)
+++ projects/haf/branches/hildon-fm/1.x/hildon-fm/hildon-file-system-model.c	2006-11-30 16:36:46 UTC (rev 8516)
@@ -176,7 +176,13 @@
 static void 
 location_connection_state_changed(HildonFileSystemSpecialLocation *location,
     GNode *node);
+static void 
+location_rescan (HildonFileSystemSpecialLocation *location, GNode *node);
 static void setup_node_for_location(GNode *node);
+static void
+hildon_file_system_model_queue_node_reload (HildonFileSystemModel *model,
+					    GNode *node,
+					    gboolean force);
 
 static GtkTreePath *hildon_file_system_model_get_path(GtkTreeModel * model,
                                                       GtkTreeIter * iter);
@@ -1616,7 +1622,7 @@
              Ensure that all expected handlers were disconnected. */
           gint check = g_signal_handlers_disconnect_matched(
             model_node->location, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, node);
-          g_assert(check == 2);
+          g_assert(check == 3);
           g_object_unref(model_node->location);
       }
 
@@ -2325,6 +2331,24 @@
     }
 }
 
+static void 
+location_rescan(HildonFileSystemSpecialLocation *location, GNode *node)
+{
+    HildonFileSystemModelNode *model_node;
+    HildonFileSystemModel *model;
+
+    g_assert(HILDON_IS_FILE_SYSTEM_SPECIAL_LOCATION(location));
+    g_assert(node != NULL && node->data != NULL);
+
+    ULOG_INFO("LOCATION RESCAN: %s", location->basepath);
+
+    model_node = node->data;
+    model = model_node->model;
+
+    hildon_file_system_model_queue_node_reload
+      (HILDON_FILE_SYSTEM_MODEL(model), node, TRUE);
+}
+
 static HildonFileSystemModelNode * 
 create_model_node_for_location(HildonFileSystemModel *self,
     HildonFileSystemSpecialLocation *location)
@@ -2385,6 +2409,8 @@
                 G_CALLBACK(location_changed), node);
             g_signal_connect(location, "connection-state",
                 G_CALLBACK(location_connection_state_changed), node);    
+            g_signal_connect(location, "rescan",
+                G_CALLBACK(location_rescan), node);
         }
         else
             (void) link_file_folder(node, model_node->path, &error);
@@ -2789,17 +2815,13 @@
     return FALSE;
 }
 
-void _hildon_file_system_model_queue_reload(HildonFileSystemModel *model,
-  GtkTreeIter *parent_iter, gboolean force)
+static void
+hildon_file_system_model_queue_node_reload (HildonFileSystemModel *model,
+					    GNode *node,
+					    gboolean force)
 {
-  GNode *node;
-
   g_return_if_fail(HILDON_IS_FILE_SYSTEM_MODEL(model));
-  g_return_if_fail(parent_iter != NULL);
-  g_return_if_fail(parent_iter->stamp == model->priv->stamp);
 
-  node = parent_iter->user_data;
-
   if (!node_needs_reload (model, node, force))
     return;
 
@@ -2810,6 +2832,20 @@
     }
 }
 
+void _hildon_file_system_model_queue_reload(HildonFileSystemModel *model,
+  GtkTreeIter *parent_iter, gboolean force)
+{
+  GNode *node;
+
+  g_return_if_fail(HILDON_IS_FILE_SYSTEM_MODEL(model));
+  g_return_if_fail(parent_iter != NULL);
+  g_return_if_fail(parent_iter->stamp == model->priv->stamp);
+
+  node = parent_iter->user_data;
+
+  hildon_file_system_model_queue_node_reload (model, node, force);
+}
+
 static void
 _hildon_file_system_model_load_children(HildonFileSystemModel *model,
                                         GtkTreeIter *parent_iter)


More information about the maemo-commits mailing list