~willismonroe/ubuntu/precise/xdg-utils/typo-fix-996304

« back to all changes in this revision

Viewing changes to scripts/xdg-email

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2011-04-08 02:00:05 UTC
  • Revision ID: james.westby@ubuntu.com-20110408020005-w273n8dprc3nylw6
Tags: 1.1.0~rc1-2ubuntu2
* Fix LP: #670128 - gnome-open uses firefox while it's not the preferred
  browser. Backport upstream changes to use the x-scheme-handler types
  for checking/setting the default browser/mail client in xdg-settings
  and xdg-email. In addition to this, we fix xdg-mime to get/set
  default mimetype handlers using the users mimeapps.list, rather than
  the defaults.list, which doesn't work anywhere
  - add debian/patches/gnome-3.0.diff
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
    fi
311
311
}
312
312
 
 
313
desktop_file_to_binary()
 
314
{
 
315
    search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
 
316
    desktop="`basename "$1"`"
 
317
    IFS=:
 
318
    for dir in $search; do
 
319
        unset IFS
 
320
        [ "$dir" -a -d "$dir/applications" ] || continue
 
321
        file="$dir/applications/$desktop"
 
322
        [ -r "$file" ] || continue
 
323
        # Remove any arguments (%F, %f, %U, %u, etc.).
 
324
        command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
 
325
        command="`which "$command"`"
 
326
        readlink -f "$command"
 
327
        return
 
328
    done
 
329
}
 
330
 
313
331
#----------------------------------------
314
332
# Checks for shared commands, e.g. --help
315
333
 
479
497
open_gnome()
480
498
{
481
499
    local client
482
 
    client=`gconftool-2 --get /desktop/gnome/url-handlers/mailto/command | cut -d ' ' -f 1` || ""
 
500
    local desktop
 
501
    desktop=`xdg-mime query default "x-scheme-handler/mailto"`
 
502
    client=`desktop_file_to_binary "$browser"`
483
503
    echo $client | grep thunderbird > /dev/null 2>&1
484
504
    if [ $? -eq 0 ] ; then
485
505
        run_thunderbird "$client" "$1"