make the file transfer dialog work with GFiles instead gchar paths
2008-07-29 Jens Granseuer <jensgr@gmx.net> * file-transfer-dialog.c: (file_transfer_job_destroy), (file_transfer_job_schedule), (file_transfer_dialog_copy_async): make the file transfer dialog work with GFiles instead gchar paths internally 2008-07-29 Jens Granseuer <jensgr@gmx.net> * theme-installer.c: (gnome_theme_install_from_uri): file transfer dialog now uses GFiles internally, so update the caller svn path=/trunk/; revision=8826
This commit is contained in:
parent
15dc0f2a79
commit
ff258486a6
4 changed files with 36 additions and 23 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-07-29 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
|
* theme-installer.c: (gnome_theme_install_from_uri): file transfer
|
||||||
|
dialog now uses GFiles internally, so update the caller
|
||||||
|
|
||||||
2008-07-28 Bastien Nocera <hadess@hadess.net>
|
2008-07-28 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* theme-installer.c (cleanup_tmp_dir):
|
* theme-installer.c (cleanup_tmp_dir):
|
||||||
|
|
|
@ -654,7 +654,7 @@ gnome_theme_install_from_uri (const gchar *filename, GtkWindow *parent)
|
||||||
}
|
}
|
||||||
g_free (base);
|
g_free (base);
|
||||||
|
|
||||||
src = g_list_append (NULL, g_strdup (filename));
|
src = g_list_append (NULL, g_file_new_for_path (filename));
|
||||||
|
|
||||||
path = NULL;
|
path = NULL;
|
||||||
do {
|
do {
|
||||||
|
@ -667,7 +667,7 @@ gnome_theme_install_from_uri (const gchar *filename, GtkWindow *parent)
|
||||||
} while (g_file_test (path, G_FILE_TEST_EXISTS));
|
} while (g_file_test (path, G_FILE_TEST_EXISTS));
|
||||||
|
|
||||||
|
|
||||||
target = g_list_append (NULL, path);
|
target = g_list_append (NULL, g_file_new_for_path (path));
|
||||||
|
|
||||||
dialog = file_transfer_dialog_new_with_parent (parent);
|
dialog = file_transfer_dialog_new_with_parent (parent);
|
||||||
g_signal_connect (dialog, "cancel",
|
g_signal_connect (dialog, "cancel",
|
||||||
|
@ -681,9 +681,10 @@ gnome_theme_install_from_uri (const gchar *filename, GtkWindow *parent)
|
||||||
G_PRIORITY_DEFAULT);
|
G_PRIORITY_DEFAULT);
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
|
|
||||||
g_list_foreach (src, (GFunc) g_free, NULL);
|
/* don't free the path since we're using that for the signals */
|
||||||
/* don't free the target item since we're using that for the signals */
|
g_list_foreach (src, (GFunc) g_object_unref, NULL);
|
||||||
g_list_free (src);
|
g_list_free (src);
|
||||||
|
g_list_foreach (target, (GFunc) g_object_unref, NULL);
|
||||||
g_list_free (target);
|
g_list_free (target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2008-07-29 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
|
* file-transfer-dialog.c: (file_transfer_job_destroy),
|
||||||
|
(file_transfer_job_schedule), (file_transfer_dialog_copy_async):
|
||||||
|
make the file transfer dialog work with GFiles instead gchar paths
|
||||||
|
internally
|
||||||
|
|
||||||
2008-07-28 Bastien Nocera <hadess@hadess.net>
|
2008-07-28 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* Makefile.am:
|
* Makefile.am:
|
||||||
|
|
|
@ -67,8 +67,8 @@ typedef struct _FileTransferJob
|
||||||
{
|
{
|
||||||
FileTransferDialog *dialog;
|
FileTransferDialog *dialog;
|
||||||
GtkDialog *overwrite_dialog;
|
GtkDialog *overwrite_dialog;
|
||||||
GSList *source_uris;
|
GSList *source_files;
|
||||||
GSList *target_uris;
|
GSList *target_files;
|
||||||
FileTransferDialogOptions options;
|
FileTransferDialogOptions options;
|
||||||
} FileTransferJob;
|
} FileTransferJob;
|
||||||
|
|
||||||
|
@ -399,10 +399,10 @@ static void
|
||||||
file_transfer_job_destroy (FileTransferJob *job)
|
file_transfer_job_destroy (FileTransferJob *job)
|
||||||
{
|
{
|
||||||
g_object_unref (job->dialog);
|
g_object_unref (job->dialog);
|
||||||
g_slist_foreach (job->source_uris, (GFunc) g_free, NULL);
|
g_slist_foreach (job->source_files, (GFunc) g_object_unref, NULL);
|
||||||
g_slist_foreach (job->target_uris, (GFunc) g_free, NULL);
|
g_slist_foreach (job->target_files, (GFunc) g_object_unref, NULL);
|
||||||
g_slist_free (job->source_uris);
|
g_slist_free (job->source_files);
|
||||||
g_slist_free (job->target_uris);
|
g_slist_free (job->target_files);
|
||||||
if (job->overwrite_dialog != NULL)
|
if (job->overwrite_dialog != NULL)
|
||||||
gtk_widget_destroy (GTK_WIDGET (job->overwrite_dialog));
|
gtk_widget_destroy (GTK_WIDGET (job->overwrite_dialog));
|
||||||
g_free (job);
|
g_free (job);
|
||||||
|
@ -477,18 +477,18 @@ file_transfer_job_schedule (GIOSchedulerJob *io_job,
|
||||||
gboolean retry;
|
gboolean retry;
|
||||||
|
|
||||||
/* take the first file from the list and copy it */
|
/* take the first file from the list and copy it */
|
||||||
|
source = job->source_files->data;
|
||||||
|
job->source_files = g_slist_delete_link (job->source_files, job->source_files);
|
||||||
|
|
||||||
|
target = job->target_files->data;
|
||||||
|
job->target_files = g_slist_delete_link (job->target_files, job->target_files);
|
||||||
|
|
||||||
data.dialog = job->dialog;
|
data.dialog = job->dialog;
|
||||||
data.overwrite_dialog = job->overwrite_dialog;
|
data.overwrite_dialog = job->overwrite_dialog;
|
||||||
data.current_file = job->dialog->priv->nth + 1;
|
data.current_file = job->dialog->priv->nth + 1;
|
||||||
data.total_files = job->dialog->priv->total;
|
data.total_files = job->dialog->priv->total;
|
||||||
data.source = job->source_uris->data;
|
data.source = g_file_get_basename (source);
|
||||||
data.target = job->target_uris->data;
|
data.target = g_file_get_basename (target);
|
||||||
|
|
||||||
source = g_file_new_for_path (data.source);
|
|
||||||
job->source_uris = g_slist_delete_link (job->source_uris, job->source_uris);
|
|
||||||
|
|
||||||
target = g_file_new_for_path (data.target);
|
|
||||||
job->target_uris = g_slist_delete_link (job->target_uris, job->target_uris);
|
|
||||||
|
|
||||||
g_io_scheduler_job_send_to_mainloop (io_job,
|
g_io_scheduler_job_send_to_mainloop (io_job,
|
||||||
file_transfer_job_update,
|
file_transfer_job_update,
|
||||||
|
@ -546,7 +546,7 @@ file_transfer_job_schedule (GIOSchedulerJob *io_job,
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (job->source_uris == NULL)
|
if (job->source_files == NULL)
|
||||||
{
|
{
|
||||||
g_io_scheduler_job_send_to_mainloop_async (io_job,
|
g_io_scheduler_job_send_to_mainloop_async (io_job,
|
||||||
(GSourceFunc) file_transfer_dialog_done,
|
(GSourceFunc) file_transfer_dialog_done,
|
||||||
|
@ -587,13 +587,13 @@ file_transfer_dialog_copy_async (FileTransferDialog *dlg,
|
||||||
n = 0;
|
n = 0;
|
||||||
for (l = g_list_last (source_files); l; l = l->prev, ++n)
|
for (l = g_list_last (source_files); l; l = l->prev, ++n)
|
||||||
{
|
{
|
||||||
job->source_uris = g_slist_prepend (job->source_uris,
|
job->source_files = g_slist_prepend (job->source_files,
|
||||||
g_strdup (l->data));
|
g_object_ref (l->data));
|
||||||
}
|
}
|
||||||
for (l = g_list_last (target_files); l; l = l->prev)
|
for (l = g_list_last (target_files); l; l = l->prev)
|
||||||
{
|
{
|
||||||
job->target_uris = g_slist_prepend (job->target_uris,
|
job->target_files = g_slist_prepend (job->target_files,
|
||||||
g_strdup (l->data));
|
g_object_ref (l->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set (dlg, "total_uris", n, NULL);
|
g_object_set (dlg, "total_uris", n, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue