[X2Go-Commits] [mteleplayer] 08/29: FileOpenerDialog Improved

git-admin at x2go.org git-admin at x2go.org
Fri Aug 29 21:12:02 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch gzng
in repository mteleplayer.

commit 795e298a2ca5b2d2b7c444fcbf1b9dab37b76082
Author: gznget <opensource at gznianguan.com>
Date:   Mon Jun 30 16:34:31 2014 +0200

    FileOpenerDialog Improved
---
 serverside/bin/mteleplayer |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/serverside/bin/mteleplayer b/serverside/bin/mteleplayer
index b69f01d..293ad8e 100755
--- a/serverside/bin/mteleplayer
+++ b/serverside/bin/mteleplayer
@@ -43,6 +43,7 @@ our $APPDNAME = "mTelePlayer";
 our $WINDOWTITLE = "mTelePlayer";
 our $APPVER = "0.0.3.0";
 use File::Spec;
+use File::Basename;
 use Glib qw/TRUE FALSE/; 
 use IO::Socket::UNIX qw( SOCK_STREAM );
 use Time::HiRes qw( usleep gettimeofday tv_interval clock_gettime clock_getres clock_nanosleep clock stat );
@@ -76,6 +77,7 @@ our %sstatusi;$sstatusi{'sockState'} = 0;$sstatusi{'sockRetryCnt'} = 0;$sstatusi
 $sstatusi{'lastCOMtime'} = (time()+2);$sstatusi{'remoteInitCnt'} = 0;
 my %PlayerStatus;$PlayerStatus{'timePos'} = 0;$PlayerStatus{'timeLength'} = 0;$PlayerStatus{'paused'} = 0;$PlayerStatus{'stoped'} = 0;$PlayerStatus{'muted'} = 0;$PlayerStatus{'volume'} = 100;$PlayerStatus{'caching'} = 0;
    $PlayerStatus{'seekTimeLag'} = 0;$PlayerStatus{'initialMediaID'} = 0;$PlayerStatus{'fullscreen'} = 0;
+   $PlayerStatus{'theOpenerDir'} = setOpenerDir(0);
 our  ($UserName,$UserHome,$X2GoSID,$X2GoSesHome,$X2GoTKSHome,$TeKiLSockPath) = getBasicServersideInfo();
 my $LocalSocket;
 my $mTPMainMediaEBOX;
@@ -1008,11 +1010,13 @@ sub crankFileChooser {
   $fileFilter->add_mime_type("video/*");
   my $theFileChooser = Gtk2::FileChooserDialog->new ('Open media file...', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok');
   $theFileChooser->add_filter($fileFilter);
+  $theFileChooser->set_current_folder($PlayerStatus{'theOpenerDir'});
   if ($theFileChooser->run eq 'ok') {
     my $playThisFile = $theFileChooser->get_filename;
     if (-f $playThisFile) {
       my $isItLoaded = mtpTeKiRemoteFileSetup("FILE:$playThisFile","$X2GoTKSHome/remote/appData/mteleplayer\_$selfSID");
       if ($isItLoaded ne 0) {
+        setOpenerDir($playThisFile);
         actOnEnqueuedMEDIA($isItLoaded,"FILE",0);
       }
     }
@@ -1020,6 +1024,19 @@ sub crankFileChooser {
   $theFileChooser->destroy;
 }
 
+sub setOpenerDir {
+  if ($_[0] eq 0) {
+    my $TheDIR = sanitizeDirPath($ENV{'PWD'});
+    unless (-d $TheDIR) {$TheDIR = $UserHome;}
+    unless (-d $TheDIR) {$TheDIR = "";} 
+    $PlayerStatus{'theOpenerDir'} = $TheDIR;
+  } else {
+    my $TheDIR = sanitizeDirPath(dirname(File::Spec->rel2abs($_[0])));
+    if (-d $TheDIR) {
+      $PlayerStatus{'theOpenerDir'} = $TheDIR;      
+    }
+  }
+}
 ########################################################################################################
 # GET Media FILE Info 
 # Initially we we're using another perl module for this but it turned out to have some (b) ithchy dependencies on some never distros so...

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git


More information about the x2go-commits mailing list