aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-download.c
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2013-08-06 16:01:35 +0800
committerLAN-TW <lantw44@gmail.com>2013-09-16 22:04:48 +0800
commit4e4b08a78e30e5c8129a6793f876351dc6a8a4a8 (patch)
treea6ad5f1f7468de0c8e2eb8f09cef53fca8ef6c60 /embed/ephy-download.c
parentb99f628c991b2224a2240b2f321a70e453af9a21 (diff)
downloadgsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar.gz
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar.bz2
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar.lz
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar.xz
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.tar.zst
gsoc2013-epiphany-4e4b08a78e30e5c8129a6793f876351dc6a8a4a8.zip
Add cancellable support to download panel when extracting archives
Diffstat (limited to 'embed/ephy-download.c')
-rw-r--r--embed/ephy-download.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index ec217e468..daed46c22 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -660,11 +660,13 @@ ephy_download_do_extract_archive (EphyDownload *download)
AutoarPref *arpref;
AutoarExtract *arextract;
GSettings *settings;
+ GCancellable *cancellable;
settings = g_settings_new (AUTOAR_PREF_DEFAULT_GSCHEMA_ID);
arpref = autoar_pref_new_with_gsettings (settings);
- if (!autoar_pref_check_file_name (arpref, download->priv->destination)) {
+ if (!autoar_pref_check_file_name (arpref, download->priv->destination) &&
+ !autoar_pref_check_mime_type (arpref, download->priv->destination)) {
LOG ("ephy_download_do_extract_archive: not an archive");
g_object_unref (settings);
g_object_unref (arpref);
@@ -679,12 +681,14 @@ ephy_download_do_extract_archive (EphyDownload *download)
g_object_unref (download->priv->arextract);
download->priv->arextract = arextract;
- g_signal_emit_by_name (download, "archive");
+ cancellable = g_cancellable_new ();
+ g_signal_emit_by_name (download, "archive", cancellable);
- autoar_extract_start_async (arextract, NULL);
+ autoar_extract_start_async (arextract, cancellable);
g_object_unref (settings);
g_object_unref (arpref);
+ g_object_unref (cancellable);
return;
}
@@ -888,9 +892,10 @@ ephy_download_class_init (EphyDownloadClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyDownloadClass, archive),
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE,
- 0);
+ 1,
+ G_TYPE_CANCELLABLE);
/**
* EphyDownload::error:
*