[maemo-commits] [maemo-commits] r13542 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Aug 31 18:17:55 EEST 2007
- Previous message: [maemo-commits] r13541 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
- Next message: [maemo-commits] r13543 - projects/haf/trunk/hildon-application-framework/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll Date: 2007-08-31 18:17:53 +0300 (Fri, 31 Aug 2007) New Revision: 13542 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-private.c projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-upnp.c projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c Log: Make nodes reload on rescan. Fix NB64425. * hildon-fm/hildon-file-system-private.c (create_child_location) Add a weak ref to destroy the node in the private locations tree to guarantee that it will be reloaded again. Remove an unneeded extra ref. * hildon-fm/hildon-file-system-model.c (real_volumes_changed): only rescan a volume when it has potentially changed. (location_rescan): force children nodes destruction before reloading the node contents. Do not trust still in hildon_file_system_special_location_is_visible(), as locations reset their ->has_children, and thus become always invisible. * hildon-fm/hildon-file-system-voldev.c (hildon_file_system_voldev_volumes_change): g_strdup() the data contained in ->fixed_icon, it will be freed when the location is destroyed. * hildon-fm/hildon-file-system-upnp.c (iap_connected_changed): force a rescan. Modified: projects/haf/trunk/hildon-fm/ChangeLog =================================================================== --- projects/haf/trunk/hildon-fm/ChangeLog 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/ChangeLog 2007-08-31 15:17:53 UTC (rev 13542) @@ -1,5 +1,26 @@ 2007-08-31 Marius Vollmer <marius.vollmer at nokia.com> + Make nodes reload on rescan. Fix NB64425. + + * hildon-fm/hildon-file-system-private.c (create_child_location) + Add a weak ref to destroy the node in the private locations tree to + guarantee that it will be reloaded again. Remove an unneeded extra ref. + + * hildon-fm/hildon-file-system-model.c (real_volumes_changed): only + rescan a volume when it has potentially changed. + (location_rescan): force children nodes destruction before reloading + the node contents. Do not trust still in + hildon_file_system_special_location_is_visible(), as + locations reset their ->has_children, and thus become always invisible. + + * hildon-fm/hildon-file-system-voldev.c + (hildon_file_system_voldev_volumes_change): g_strdup() the data + contained in ->fixed_icon, it will be freed when the location is + destroyed. + + * hildon-fm/hildon-file-system-upnp.c (iap_connected_changed): force a + rescan. + * hildon-fm/hildon-file-system-settings.c: change ::bonding-changed property to ::bondings, containing the number of addresses. Modified: projects/haf/trunk/hildon-fm/debian/changelog =================================================================== --- projects/haf/trunk/hildon-fm/debian/changelog 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/debian/changelog 2007-08-31 15:17:53 UTC (rev 13542) @@ -4,7 +4,7 @@ * Do not show USB mass storage device when no volumes are mounted. Fixes: NB#62319. * Correct sort order of top-level items. Fixes: NB#65611. - * Fixes: NB#65543, NB#67080, NB#66863, NB#64420. + * Fixes: NB#65543, NB#67080, NB#66863, NB#64420, NB#64425. -- Marius Vollmer <marius.vollmer at nokia.com> Tue, 14 Aug 2007 19:48:47 +0300 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 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-model.c 2007-08-31 15:17:53 UTC (rev 13542) @@ -1681,12 +1681,15 @@ return node; } -static gboolean notify_volumes_changed(GNode *node, gpointer data) +static gboolean get_locations (GNode *node, gpointer data) { HildonFileSystemModelNode *model_node = node->data; + GHashTable **locations = (GHashTable **) data; if (model_node->location) - hildon_file_system_special_location_volumes_changed(model_node->location, data); + g_hash_table_insert (*locations, + g_strdup (model_node->location->basepath), + g_object_ref (model_node->location)); return FALSE; } @@ -1695,15 +1698,45 @@ { HildonFileSystemModel *model; HildonFileSystemModelPrivate *priv; + GHashTable *locations; + GSList *volumes; ULOG_DEBUG_F("entered"); model = HILDON_FILE_SYSTEM_MODEL (data); priv = CAST_GET_PRIVATE(model); + volumes = gtk_file_system_list_volumes (fs); + locations = g_hash_table_new_full (g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_object_unref); + g_node_traverse(priv->roots, - G_PRE_ORDER, G_TRAVERSE_ALL, -1, - notify_volumes_changed, fs); + G_PRE_ORDER, G_TRAVERSE_ALL, -1, + get_locations, &locations); + + while (volumes) { + GtkFilePath *path; + GtkFileSystemVolume *volume; + HildonFileSystemSpecialLocation *location; + + volume = volumes->data; + path = gtk_file_system_volume_get_base_path (fs, volume); + + if (path) { + location = g_hash_table_lookup (locations, path); + + if (location && + (!gtk_file_system_volume_get_is_mounted (fs, volume) || + !hildon_file_system_special_location_is_visible (location))) { + hildon_file_system_special_location_volumes_changed(location, fs); + } + } + + volumes = volumes->next; + } + + g_hash_table_unref (locations); } static GNode * @@ -2356,19 +2389,15 @@ model_node = node->data; model = model_node->model; - if (!hildon_file_system_special_location_is_visible (location)) - { - unlink_file_folder(node); + /* remove all children */ + child = node->children; + while (child) + child = hildon_file_system_model_kick_node(child, model); - child = node->children; - while (child) - child = hildon_file_system_model_kick_node(child, model); - } - else - { - hildon_file_system_model_reload_node - (HILDON_FILE_SYSTEM_MODEL(model), node, TRUE); - } + unlink_file_folder (node); + + hildon_file_system_model_reload_node + (HILDON_FILE_SYSTEM_MODEL(model), node, TRUE); } static HildonFileSystemModelNode * Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c =================================================================== --- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c 2007-08-31 15:17:53 UTC (rev 13542) @@ -230,13 +230,15 @@ const gchar *uri) { HildonFileSystemSpecialLocation *location; + GNode *node; location = hildon_file_system_special_location_create_child_location ( parent_location, (gchar *) uri); if (location) { - g_object_ref (location); - g_node_append_data (parent, location); + node = g_node_append_data (parent, location); + + g_object_weak_ref (G_OBJECT (location), (GWeakNotify) g_node_destroy, node); } return location; Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-upnp.c =================================================================== --- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-upnp.c 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-upnp.c 2007-08-31 15:17:53 UTC (rev 13542) @@ -72,6 +72,7 @@ upnp->has_children = FALSE; g_signal_emit_by_name (data, "connection-state"); + g_signal_emit_by_name (data, "rescan"); } static void 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 2007-08-31 15:16:13 UTC (rev 13541) +++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-voldev.c 2007-08-31 15:17:53 UTC (rev 13542) @@ -410,19 +410,19 @@ { if (strcmp (location->fixed_icon, "gnome-dev-removable-usb") == 0 || strcmp (location->fixed_icon, "gnome-dev-harddisk-usb") == 0) - location->fixed_icon = "qgn_list_filesys_removable_storage"; + location->fixed_icon = g_strdup ("qgn_list_filesys_removable_storage"); else if (strcmp (location->fixed_icon, "gnome-dev-removable") == 0 || strcmp (location->fixed_icon, "gnome-dev-media-sdmmc") == 0) { if (voldev->vol_type == INT_CARD) { location->sort_weight = SORT_WEIGHT_INTERNAL_MMC; - location->fixed_icon = "qgn_list_gene_internal_memory_card"; + location->fixed_icon = g_strdup ("qgn_list_gene_internal_memory_card"); } else { location->sort_weight = SORT_WEIGHT_EXTERNAL_MMC; - location->fixed_icon = "qgn_list_gene_removable_memory_card"; + location->fixed_icon = g_strdup ("qgn_list_gene_removable_memory_card"); } location->fixed_title = beautify_mmc_name (location->fixed_title,
- Previous message: [maemo-commits] r13541 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
- Next message: [maemo-commits] r13543 - projects/haf/trunk/hildon-application-framework/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]