/*--------------------------------------------------------------------------*/ static void download_done( DownloadCallbackData *data ) { GList *p; GnomeVFSFileInfo *info, tmp_info = {0}; gchar *hash_name; gchar *hash_path, *hash_text_uri; gchar *file_path, *file_text_uri; gchar *date_min, *date_max, *finish_msg; gchar *data_dir; gbTableModel *table_model; gb_debug (DEBUG_UPDATE, "START"); /* Rename downloaded files (undo name hash) */ data_dir = gb_util_get_home_data_dir(); for ( p=data->list; p != NULL; p=p->next ) { info = (GnomeVFSFileInfo *)p->data; hash_name = hash_filename( info->name ); hash_path = g_build_filename( data_dir, hash_name, NULL ); hash_text_uri = gnome_vfs_get_uri_from_local_path( hash_path ); file_path = g_build_filename( data_dir, info->name, NULL ); file_text_uri = gnome_vfs_get_uri_from_local_path( file_path ); gnome_vfs_get_file_info (hash_text_uri, &tmp_info, GNOME_VFS_FILE_INFO_DEFAULT); if ( info->size == tmp_info.size ) { gnome_vfs_move( hash_text_uri, file_text_uri, FALSE ); } else { g_warning ("%s: Temporary file size (%" GNOME_VFS_OFFSET_FORMAT_STR ") does not match remote size (%" GNOME_VFS_OFFSET_FORMAT_STR ").", info->name, tmp_info.size, info->size); gnome_vfs_unlink (hash_text_uri); } g_free( hash_name ); g_free( hash_path ); g_free( hash_text_uri ); g_free( file_path ); g_free( file_text_uri ); } g_free( data_dir ); /* Now reread redemption tables */ table_model = gb_table_get_model (); gb_table_model_update (table_model); /* customize finish page for this outcome */ gnome_druid_page_edge_set_title( GNOME_DRUID_PAGE_EDGE(finish_page), _( "Download done" ) ); date_min = gb_date_fmt (gb_table_model_get_rdate_min (table_model)); date_max = gb_date_fmt (gb_table_model_get_rdate_max (table_model)); finish_msg = g_strdup_printf( _( "GBonds has successfully downloaded " "%d new redemption files.\n\n" "GBonds is now configured with redemption data\n" "for %s - %s.\n" ), data->n, date_min, date_max ); gnome_druid_page_edge_set_text( GNOME_DRUID_PAGE_EDGE(finish_page), finish_msg ); g_free( date_min ); g_free( date_max ); g_free( finish_msg ); remote_dir_handle = NULL; /* Now jump to the finish page */ gnome_druid_set_page( GNOME_DRUID(update_druid), GNOME_DRUID_PAGE(finish_page) ); gb_debug (DEBUG_UPDATE, "END"); }
static void xfer_folder (EvolutionShellComponent *shell_component, const char *source_physical_uri, const char *destination_physical_uri, const char *type, gboolean remove_source, const GNOME_Evolution_ShellComponentListener listener, void *closure) { CORBA_Environment ev; gchar *source_path; gchar *dest_path; GnomeVFSHandle *handle; GnomeVFSURI *uri; GnomeVFSFileSize out; char *buf; const char *file_name; CORBA_exception_init (&ev); printf("type : %s\n", type); /* check URI */ if (strncmp (source_physical_uri, "file://", 7) || strncmp (destination_physical_uri, "file://", 7)) { GNOME_Evolution_ShellComponentListener_notifyResult ( listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); CORBA_exception_free (&ev); return; } file_name = YANK_FILENAME; /* if (file_name == NULL) { */ /* GNOME_Evolution_ShellComponentListener_notifyResult (listener, */ /* GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, */ /* &ev); */ /* CORBA_exception_free (&ev); */ /* return; */ /* } */ /* open source and destination files */ source_path = g_concat_dir_and_file (source_physical_uri + 7, YANK_FILENAME); dest_path = g_concat_dir_and_file (destination_physical_uri + 7, YANK_FILENAME); if (gnome_vfs_move (source_path, dest_path, TRUE) != GNOME_VFS_OK) { GNOME_Evolution_ShellComponentListener_notifyResult ( listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); g_free (source_path); g_free (dest_path); puts("move bad"); CORBA_exception_free (&ev); return; } g_free (source_path); g_free (dest_path); puts("move ok"); GNOME_Evolution_ShellComponentListener_notifyResult(listener, GNOME_Evolution_ShellComponentListener_OK, &ev); CORBA_exception_free (&ev); }