~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): Jonathan Marsden
  • Date: 2011-05-07 18:12:59 UTC
  • Revision ID: james.westby@ubuntu.com-20110507181259-yrlu64g4d33h3f5j
Tags: 1.1.0~rc1-2ubuntu4
* scripts/xdg-mime:
 - Fix detectDE to detect LXDE.
 - Create ~/.local/share/applications/mimeapps.list when needed in
   non-gnome/kde environments.

* scripts/xdg-email:
 - Fix detectDE to detect LXDE.
 - Added open_lxde shell function, used when LXDE detected.
 - Added run_sylpheed function, used to call sylpheed (LP: 779156).

Show diffs side-by-side

added added

removed removed

Lines of Context:
321
321
        file="$dir/applications/$desktop"
322
322
        [ -r "$file" ] || continue
323
323
        # Remove any arguments (%F, %f, %U, %u, etc.).
324
 
        command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
 
324
        command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
325
325
        command="`which "$command"`"
326
326
        readlink -f "$command"
327
327
        return
380
380
    elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
381
381
    elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
382
382
    elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde;
 
383
    elif [ x"$XDG_CURRENT_DESKTOP" = x"LXDE" ]; then DE=lxde;
383
384
    elif [ -r ~/.muttrc ] && which mutt > /dev/null 2>&1; then
384
385
        DE=envvar
385
386
        MAILER="x-terminal-emulator -e mutt"
386
387
    else DE=""
387
388
    fi
 
389
    DEBUG 2 "DE is \"$DE\""
388
390
}
389
391
 
390
392
#----------------------------------------------------------------------------
456
458
    fi
457
459
}
458
460
 
 
461
run_sylpheed()
 
462
{
 
463
    DEBUG 1 "Running $1 --compose \"$2\""
 
464
    "$1" --compose "$2"
 
465
    if [ $? -eq 0 ]; then
 
466
        exit_success
 
467
    else
 
468
        exit_failure_operation_failed
 
469
    fi
 
470
}
 
471
 
459
472
open_kde()
460
473
{
461
474
    local client kde_email_profile_name
550
563
    exit_failure_operation_failed
551
564
}
552
565
 
 
566
open_lxde()
 
567
{
 
568
    DEBUG 3 "Running open_lxde \"$1\""
 
569
 
 
570
    local client
 
571
    local desktop
 
572
    desktop=`xdg-mime query default "x-scheme-handler/mailto"`
 
573
    client=`desktop_file_to_binary "$desktop"`
 
574
 
 
575
    # If no xdg-mime default was set, 
 
576
    #   and if we are running Lubuntu, fallback to sylpheed
 
577
    if [ -z "$desktop" -a "$DESKTOP_SESSION" = "Lubuntu" ]; then
 
578
        client=`desktop_file_to_binary "sylpheed.desktop"`
 
579
    fi
 
580
 
 
581
    echo $client | grep thunderbird > /dev/null 2>&1
 
582
    if [ $? -eq 0 ] ; then
 
583
        run_thunderbird "$client" "$1"
 
584
    fi
 
585
 
 
586
    echo $client | grep sylpheed > /dev/null 2>&1
 
587
    if [ $? -eq 0 ] ; then
 
588
        DEBUG 3 "Running run_sylpheed \"$client\" \"$1\""
 
589
        run_sylpheed "$client" "$1"
 
590
    fi
 
591
 
 
592
    if [ $? -eq 0 ]; then
 
593
        exit_success
 
594
    else
 
595
        exit_failure_operation_failed
 
596
    fi
 
597
}
 
598
 
553
599
open_generic()
554
600
{
555
601
    IFS=":"
761
807
    open_xfce "${mailto}"
762
808
    ;;
763
809
 
764
 
    generic|lxde)
 
810
    lxde)
 
811
    open_lxde "${mailto}"
 
812
    ;;
 
813
 
 
814
    generic)
765
815
    open_generic "${mailto}"
766
816
    ;;
767
817