summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-12-12 13:26:33 +0100
committerRex Dieter <rdieter@math.unl.edu>2016-12-12 09:08:31 -0600
commit0d6eebb27c562e8644ccf616ebdbddf82d0d2dd8 (patch)
treed95e37ec1ce9251de28849a3a63b23193874d0db
parent09c51e937e61c735bcfb1422ab4883626f33f900 (diff)
Add gio tool support
gvfs- utils were deprecated in favour of new gio tool. Prefer gio tool in recent GNOME 3 and Cinnamon over gvfs- utils.
-rwxr-xr-xautotests/t-xdg-open.sh28
-rw-r--r--scripts/xdg-copy.in4
-rw-r--r--scripts/xdg-email.in10
-rw-r--r--scripts/xdg-mime.in5
-rw-r--r--scripts/xdg-open.in14
5 files changed, 47 insertions, 14 deletions
diff --git a/autotests/t-xdg-open.sh b/autotests/t-xdg-open.sh
index 36919a6..810bdc3 100755
--- a/autotests/t-xdg-open.sh
+++ b/autotests/t-xdg-open.sh
@@ -39,17 +39,28 @@ test_generic_open_file() {
assert_run textedit "$LABDIR/$1"
}
-test_that_it opens a URL with gvfs-open in GNOME 2, 3, and Cinnamon
+test_that_it opens a URL with "gio open" in recent GNOME 3, and Cinnamon
+mock "gio open"
+test_open_url gnome3 "gio open"
+test_open_url cinnamon "gio open"
+
+test_that_it opens a URL with gvfs-open if "gio open" is missing in GNOME 3, \
+ GNOME 2, and Cinnamon
+mock_missing "gio open"
+mock gvfs-open
test_open_url gnome3 gvfs-open
test_open_url gnome2 gvfs-open
test_open_url cinnamon gvfs-open
-test_that_it opens a URL with gnome-open if gvfs-open is missing in GNOME 2
+test_that_it opens a URL with gnome-open if "gio open" and gvfs-open are \
+ missing in GNOME 2
+mock_missing "gio open"
mock_missing gvfs-open
test_open_url gnome2 gnome-open
-test_that_it opens a URL with the generic method if gvfs-open is missing \
- in GNOME 3 and Cinnamon
+test_that_it opens a URL with the generic method if "gio open" and gvfs-open \
+ are missing in GNOME 3, and Cinnamon
+mock_missing "gio open"
mock_missing gvfs-open
mock gnome-open
mock_desktop_file mosaic %u
@@ -57,8 +68,9 @@ mock_default_app x-scheme-handler/http mosaic
test_open_url gnome3 mosaic
test_open_url cinnamon mosaic
-test_that_it opens a URL with the generic method if gvfs-open and gnome-open \
- are missing in GNOME 2
+test_that_it opens a URL with the generic method if "gio open", gvfs-open and \
+ gnome-open are missing in GNOME 2
+mock_missing "gio open"
mock_missing gvfs-open
mock_missing gnome-open
mock_desktop_file mosaic %u
@@ -77,7 +89,9 @@ test_open_url kde5 kde-open5
test_that_it opens a URL with gvfs-open in MATE
test_open_url mate gvfs-open
-test_that_it opens a URL with mate-open if gvfs-open is missing in MATE
+test_that_it opens a URL with mate-open if "gio open" and gvfs-open are \
+ missing in MATE
+mock_missing "gio open"
mock_missing gvfs-open
test_open_url mate mate-open
diff --git a/scripts/xdg-copy.in b/scripts/xdg-copy.in
index 2536d9b..12317b6 100644
--- a/scripts/xdg-copy.in
+++ b/scripts/xdg-copy.in
@@ -43,7 +43,9 @@ copy_kde()
copy_gnome()
{
- if gvfs-copy --help 2>/dev/null 1>&2; then
+ if gio help copy 2>/dev/null 1>&2; then
+ gio copy "$1" "$2"
+ elif gvfs-copy --help 2>/dev/null 1>&2; then
gvfs-copy "$1" "$2"
else
gnomevfs-copy "$1" "$2"
diff --git a/scripts/xdg-email.in b/scripts/xdg-email.in
index 1b653b8..d6b2715 100644
--- a/scripts/xdg-email.in
+++ b/scripts/xdg-email.in
@@ -144,7 +144,10 @@ open_gnome3()
run_thunderbird "$client" "$1"
fi
- if gvfs-open --help 2>/dev/null 1>&2; then
+ if gio help open 2>/dev/null 1>&2; then
+ DEBUG 1 "Running gio open \"$1\""
+ gio open "$1"
+ elif gvfs-open --help 2>/dev/null 1>&2; then
DEBUG 1 "Running gvfs-open \"$1\""
gvfs-open "$1"
else
@@ -168,7 +171,10 @@ open_gnome()
run_thunderbird "$client" "$1"
fi
- if gvfs-open --help 2>/dev/null 1>&2; then
+ if gio help open 2>/dev/null 1>&2; then
+ DEBUG 1 "Running gio open \"$1\""
+ gio open "$1"
+ elif gvfs-open --help 2>/dev/null 1>&2; then
DEBUG 1 "Running gvfs-open \"$1\""
gvfs-open "$1"
else
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
index e85fd62..f629254 100644
--- a/scripts/xdg-mime.in
+++ b/scripts/xdg-mime.in
@@ -75,7 +75,10 @@ info_kde()
info_gnome()
{
- if gvfs-info --help 2>/dev/null 1>&2; then
+ if gio help info 2>/dev/null 1>&2; then
+ DEBUG 1 "Running gio info \"$1\""
+ gio info "$1" 2> /dev/null | grep standard::content-type | cut -d' ' -f4
+ elif gvfs-info --help 2>/dev/null 1>&2; then
DEBUG 1 "Running gvfs-info \"$1\""
gvfs-info "$1" 2> /dev/null | grep standard::content-type | cut -d' ' -f4
elif gnomevfs-info --help 2>/dev/null 1>&2; then
diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index f93e005..c8d7f93 100644
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -144,7 +144,9 @@ open_kde()
open_gnome3()
{
- if gvfs-open --help 2>/dev/null 1>&2; then
+ if gio help open 2>/dev/null 1>&2; then
+ gio open "$1"
+ elif gvfs-open --help 2>/dev/null 1>&2; then
gvfs-open "$1"
else
open_generic "$1"
@@ -159,7 +161,9 @@ open_gnome3()
open_gnome()
{
- if gvfs-open --help 2>/dev/null 1>&2; then
+ if gio help open 2>/dev/null 1>&2; then
+ gio open "$1"
+ elif gvfs-open --help 2>/dev/null 1>&2; then
gvfs-open "$1"
elif gnome-open --help 2>/dev/null 1>&2; then
gnome-open "$1"
@@ -176,7 +180,9 @@ open_gnome()
open_mate()
{
- if gvfs-open --help 2>/dev/null 1>&2; then
+ if gio help open 2>/dev/null 1>&2; then
+ gio open "$1"
+ elif gvfs-open --help 2>/dev/null 1>&2; then
gvfs-open "$1"
elif mate-open --help 2>/dev/null 1>&2; then
mate-open "$1"
@@ -195,6 +201,8 @@ open_xfce()
{
if exo-open --help 2>/dev/null 1>&2; then
exo-open "$1"
+ if gio help open 2>/dev/null 1>&2; then
+ gio open "$1"
elif gvfs-open --help 2>/dev/null 1>&2; then
gvfs-open "$1"
else