Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/xdg-utils/scripts/xdg-settings

Issue 160184: Fix xdg-settings to work around bugs in xdg-mime and kdeinit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/xdg-utils/scripts/xdg-settings.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 #--------------------------------------------- 2 #---------------------------------------------
3 # xdg-settings 3 # xdg-settings
4 # 4 #
5 # Utility script to get various settings from the desktop environment. 5 # Utility script to get various settings from the desktop environment.
6 # 6 #
7 # Refer to the usage() function below for usage. 7 # Refer to the usage() function below for usage.
8 # 8 #
9 # Copyright 2009, Google Inc. 9 # Copyright 2009, Google Inc.
10 # 10 #
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if [ $oldlines -le $newlines ]; then 383 if [ $oldlines -le $newlines ]; then
384 mv "$temp" "$apps/$1" 384 mv "$temp" "$apps/$1"
385 # This can take a little bit to get noticed 385 # This can take a little bit to get noticed
386 sleep 4 386 sleep 4
387 else 387 else
388 rm -f "$temp" 388 rm -f "$temp"
389 return 1 389 return 1
390 fi 390 fi
391 } 391 }
392 392
393 xdg_mime_fixup()
394 {
395 # xdg-mime may use ktradertest, which will fork off a copy of kdeinit if
396 # one does not already exist. It will exit after about 15 seconds if no
397 # further processes need it around. But since it does not close its stdout,
398 # the shell (via grep) will wait around for kdeinit to exit. If we start a
399 # copy here, that copy will be used in xdg-mime and we will avoid waiting.
400 if [ "$DE" = kde -a -z "$XDG_MIME_FIXED" ]; then
401 ktradertest text/html Application > /dev/null 2>&1
402 # Only do this once, as we only need it once.
403 XDG_MIME_FIXED=yes
404 fi
405 }
406
393 get_browser_mime() 407 get_browser_mime()
394 { 408 {
409 xdg_mime_fixup
395 xdg-mime query default text/html 410 xdg-mime query default text/html
396 } 411 }
397 412
398 set_browser_mime() 413 set_browser_mime()
399 { 414 {
415 xdg_mime_fixup
400 orig="`get_browser_mime`" 416 orig="`get_browser_mime`"
401 # Fixing the local desktop file can actually change the default browser all 417 # Fixing the local desktop file can actually change the default browser all
402 # by itself, so we fix it only after querying to find the current default 418 # by itself, so we fix it only after querying to find the current default
403 fix_local_desktop_file "$1" || return 419 fix_local_desktop_file "$1" || return
404 mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/applications" 420 mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/applications"
405 xdg-mime default "$1" text/html || return 421 xdg-mime default "$1" text/html || return
406 if [ x"`get_browser_mime`" != x"$1" ]; then 422 if [ x"`get_browser_mime`" != x"$1" ]; then
407 # Put back the original value 423 # Put back the original value
408 xdg-mime default "$orig" text/html 424 xdg-mime default "$orig" text/html
409 exit_failure_operation_failed 425 exit_failure_operation_failed
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 ;; 794 ;;
779 795
780 generic) 796 generic)
781 dispatch_generic "$@" 797 dispatch_generic "$@"
782 ;; 798 ;;
783 799
784 *) 800 *)
785 exit_failure_operation_impossible "unknown desktop environment" 801 exit_failure_operation_impossible "unknown desktop environment"
786 ;; 802 ;;
787 esac 803 esac
OLDNEW
« no previous file with comments | « no previous file | third_party/xdg-utils/scripts/xdg-settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698