static void bg_pictures_source_init (BgPicturesSource *self) { const gchar *pictures_path; BgPicturesSourcePrivate *priv; GFile *dir; char *cache_path; priv = self->priv = PICTURES_SOURCE_PRIVATE (self); priv->cancellable = g_cancellable_new (); priv->known_items = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES); dir = g_file_new_for_path (pictures_path); g_file_enumerate_children_async (dir, ATTRIBUTES, G_FILE_QUERY_INFO_NONE, G_PRIORITY_LOW, priv->cancellable, dir_enum_async_ready, self); g_object_unref (dir); cache_path = bg_pictures_source_get_cache_path (); dir = g_file_new_for_path (cache_path); g_file_enumerate_children_async (dir, ATTRIBUTES, G_FILE_QUERY_INFO_NONE, G_PRIORITY_LOW, priv->cancellable, dir_enum_async_ready, self); g_object_unref (dir); priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE); }
static void bg_pictures_source_init (BgPicturesSource *self) { const gchar *pictures_path; BgPicturesSourcePrivate *priv; GFile *dir; char *cache_path; GtkListStore *store; priv = self->priv = PICTURES_SOURCE_PRIVATE (self); priv->cancellable = g_cancellable_new (); priv->known_items = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); pictures_path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES); if (pictures_path == NULL) pictures_path = g_get_home_dir (); g_mkdir_with_parents (pictures_path, USER_DIR_MODE); dir = g_file_new_for_path (pictures_path); g_file_enumerate_children_async (dir, ATTRIBUTES, G_FILE_QUERY_INFO_NONE, G_PRIORITY_LOW, priv->cancellable, dir_enum_async_ready, self); priv->picture_dir_monitor = g_file_monitor_directory (dir, G_FILE_MONITOR_NONE, priv->cancellable, NULL); if (priv->picture_dir_monitor) g_signal_connect (priv->picture_dir_monitor, "changed", G_CALLBACK (files_changed_cb), self); g_object_unref (dir); cache_path = bg_pictures_source_get_cache_path (); g_mkdir_with_parents (cache_path, USER_DIR_MODE); dir = g_file_new_for_path (cache_path); g_file_enumerate_children_async (dir, ATTRIBUTES, G_FILE_QUERY_INFO_NONE, G_PRIORITY_LOW, priv->cancellable, dir_enum_async_ready, self); g_free (cache_path); priv->cache_dir_monitor = g_file_monitor_directory (dir, G_FILE_MONITOR_NONE, priv->cancellable, NULL); if (priv->cache_dir_monitor) g_signal_connect (priv->cache_dir_monitor, "changed", G_CALLBACK (files_changed_cb), self); g_object_unref (dir); priv->grl_miner = cc_background_grilo_miner_new (); g_signal_connect_swapped (priv->grl_miner, "media-found", G_CALLBACK (media_found_cb), self); cc_background_grilo_miner_start (priv->grl_miner); priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE); store = bg_source_get_liststore (BG_SOURCE (self)); gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store), 1, (GtkTreeIterCompareFunc)sort_func, self, NULL); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 1, GTK_SORT_ASCENDING); }