Exemple #1
0
        /// When User Switch Notebook Viewer Page,
        /// This Method Catch event and if page is Folder Viewer object
        /// Do Folder Refresh & set menu/toolbar actions.
        /// Else if isn't Folder Viewer object
        /// setup toolbar & menu action (On/Off GoUp, GoHome, ecc)
        private void OnSwitchPage(object o, SwitchPageArgs args)
        {
            Gtk.Application.Invoke(delegate {
                Gtk.Widget page = notebookViewer.GetNthPage((int)args.PageNum);
                Type objType    = page.GetType();
                if (objType != typeof(FolderViewer))
                {
                    // NetworkViewer or Custom
                    SetSensitiveGoUpMenu(false);
                    SetSensitiveGoHomeMenu(false);
                }
                else
                {
                    // Folder Viewer
                    FolderViewer folderViewer = page as FolderViewer;
                    folderViewer.Refresh();

                    bool canGoUp = folderViewer.CanGoUp();
                    SetSensitiveGoUpMenu(canGoUp);
                    SetSensitiveGoHomeMenu(true);
                }

                // Set Sensitive Refresh Menu
                SetSensitiveRefreshMenu(objType.IsSubclassOf(typeof(RefreshableViewer)));
            });
        }
Exemple #2
0
 private void OnFolderRefresh(object obj, string path)
 {
     Gtk.Application.Invoke(delegate {
         FolderViewer folderViewer = obj as FolderViewer;
         PeerSocket peer           = P2PManager.KnownPeers[folderViewer.UserInfo] as PeerSocket;
         Cmd.RequestFolder(peer, path);
     });
 }
Exemple #3
0
 private void FolderViewerGoHome()
 {
     Gtk.Widget page = notebookViewer.CurrentPageWidget;
     if (page.GetType() == typeof(FolderViewer))
     {
         // Go Home if is Folder Viewer
         FolderViewer folderViewer = page as FolderViewer;
         folderViewer.GoHome();
     }
 }
        public void FolderViewerGoHome()
        {
            // Skif Network Viewer
            if (this.notebookViewer.CurrentPage == 0)
            {
                return;
            }

            // Go Up
            FolderViewer folderViewer = notebookViewer.CurrentPageWidget as FolderViewer;

            folderViewer.GoHome();
        }
 public void FolderViewerRefresh()
 {
     // Skif Network Viewer
     if (this.notebookViewer.CurrentPage == 0)
     {
         NetworkViewer nv = notebookViewer.CurrentPageWidget as NetworkViewer;
         nv.Refresh();
     }
     else
     {
         // Go Up
         FolderViewer fv = notebookViewer.CurrentPageWidget as FolderViewer;
         fv.Refresh();
     }
 }
        protected void OnFileAdded(object sender, object storeIter)
        {
            FolderViewer folderViewer = sender as FolderViewer;

            Gtk.TreeIter iter  = (Gtk.TreeIter)storeIter;
            FolderStore  store = folderViewer.Store;

            // Request Image Thumb if it's Image
            string filePath = store.GetFilePath(iter);

            if (ImageUtils.IsImage(Path.GetExtension(filePath)) == true)
            {
                RequestImage(folderViewer.UserInfo, filePath);
            }
        }
Exemple #7
0
        /// <snd what='file' id='10' part='13'>...</snd>
        private void OnSndEvent(PeerSocket peer, XmlRequest xml)
        {
            Gtk.Application.Invoke(delegate {
                string what = (string)xml.Attributes["what"];

                switch (what)
                {
                case "file":
                    ulong id = ulong.Parse((string)xml.Attributes["id"]);
                    DownloadManager.GetFilePart(peer, id, xml);
                    break;

                case "file-list":
                    UserInfo userInfo         = peer.Info as UserInfo;
                    FolderViewer folderViewer = notebookViewer.LookupPage(userInfo);
                    folderViewer.Fill((string)xml.Attributes["path"], xml.BodyText);
                    break;
                }
            });
        }
        public void OnSndEvent(PeerSocket peer, XmlRequest xml)
        {
            Gtk.Application.Invoke(delegate {
                string what = (string)xml.Attributes["what"];

                if (what == "folder-list")
                {
                    UserInfo userInfo         = peer.Info as UserInfo;
                    FolderViewer folderViewer = notebookViewer.LookupPage(userInfo);
                    folderViewer.Fill((string)xml.Attributes["path"], xml.BodyText);
                }
                else if (what == "file")
                {
                    try {
                        DownloadManager.GetFilePart(peer, xml);
                    } catch (Exception e) {
                        Glue.Dialogs.MessageError("Download File Part", e.Message);
                    }
                }
            });
        }
Exemple #9
0
        private void LoadImage(UserInfo userInfo, string path, Gdk.Pixbuf pixbuf)
        {
            // Lookup File Iter
            FolderViewer folderViewer = notebookViewer.LookupPage(userInfo);

            if (folderViewer == null)
            {
                return;
            }

            // Get File Tree Iter
            Gtk.TreeIter iter = folderViewer.Store.GetIter(path);
            if (iter.Equals(Gtk.TreeIter.Zero))
            {
                return;
            }

            // Build & Set Thumb Image
            Gtk.Application.Invoke(delegate {
                folderViewer.Store.SetPixbuf(iter, pixbuf);
                folderViewer.ShowAll();
            });
        }