Exemplo n.º 1
0
Arquivo: Window.cs Projeto: MrJoe/lat
        void OnNotebookViewChanged(object o, SwitchPageArgs args)
        {
            WriteStatusMessage("");

            if (args.PageNum == 0)
            {
                ldapTreeView.removeToolbarHandlers();
                ToggleButtons(false);
                ToggleInfoNotebook(false);
                viewsView.Active = true;

                if (serverInfoView != null)
                {
                    serverInfoView.Destroy();
                    serverInfoView = null;
                }

                if (attributeEditor != null)
                {
                    attributeEditor.Destroy();
                    attributeEditor = null;
                }

                templateToolButton.Hide();
            }
            else if (args.PageNum == 1)
            {
                CleanupView();

                ToggleButtons(true);
                ToggleInfoNotebook(false);
                browserView.Active = true;

                newMenuItem.Submenu    = null;
                newMenuToolButton.Menu = null;

                templateToolButton.Show();
                propertiesToolButton.Hide();
                refreshToolButton.Hide();

                if (serverInfoView != null)
                {
                    serverInfoView.Destroy();
                    serverInfoView = null;
                }

                if (viewDataTreeView != null)
                {
                    viewDataTreeView.Destroy();
                    viewDataTreeView = null;
                }

                if (attributeEditor == null)
                {
                    attributeEditor = new AttributeEditorWidget();
                    valuesScrolledWindow.AddWithViewport(attributeEditor);
                    valuesScrolledWindow.Show();
                }

                ldapTreeView.setToolbarHandlers(newMenuToolButton, deleteToolButton);
                SetBrowserTooltips();
            }
            else if (args.PageNum == 2)
            {
                CleanupView();

                ldapTreeView.removeToolbarHandlers();
                searchView.Active = true;

                newMenuItem.Submenu    = null;
                newMenuToolButton.Menu = null;

                if (serverInfoView != null)
                {
                    serverInfoView.Destroy();
                    serverInfoView = null;
                }

                if (viewDataTreeView != null)
                {
                    viewDataTreeView.Destroy();
                    viewDataTreeView = null;
                }

                if (attributeEditor == null)
                {
                    attributeEditor = new AttributeEditorWidget();
                    valuesScrolledWindow.AddWithViewport(attributeEditor);
                    valuesScrolledWindow.Show();
                }

                ToggleButtons(false);
                ToggleInfoNotebook(false);

                templateToolButton.Hide();

                if (serverComboBox != null)
                {
                    serverComboBox.Destroy();
                    serverComboBox = null;
                }

                CreateServerCombo();
            }
            else if (args.PageNum == 3)
            {
                CleanupView();

                ToggleButtons(false);
                schemaView.Active = true;

                newMenuItem.Submenu    = null;
                newMenuToolButton.Menu = null;

                ToggleInfoNotebook(true);

                SetInfoNotePage(-1);

                templateToolButton.Hide();
            }
        }
Exemplo n.º 2
0
        public MessageView(String messagebox)
        {
            this.messagebox = messagebox;

            messagesWindow = new ScrolledWindow();
            messagesWindow.ShadowType = ShadowType.EtchedIn;
            messagesWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            treeviewMessages = new TreeView();
            treeviewMessages.BorderWidth = 0;
            treeviewMessages.AppendColumn ("Site", new CellRendererText(), "text", 2).Resizable = true;;
            treeviewMessages.AppendColumn ("User", new CellRendererText(), "text", 3).Resizable = true;;
            treeviewMessages.AppendColumn ("Subject", new CellRendererText(), "text", 4).Resizable = true;;
            treeviewMessages.AppendColumn ("Date", new CellRendererText(), "text", 5).Resizable = true;;
            treeviewMessages.RowActivated += treeviewMessages_RowActivated;
            messagesWindow.Add(treeviewMessages);
            this.Add1 (messagesWindow);

            contentBox = new VBox(false, 0);
            Toolbar toolbar = new Toolbar();
            toolbar.HeightRequest = 38;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.BorderWidth = 0;
            Image tmpimage = new Image();
            tmpimage.Pixbuf = new Gdk.Pixbuf(".images/icon_up.png");
            upbtn = new ToolButton(tmpimage, "");
            upbtn.TooltipText = "Expand view to top";
            upbtn.Clicked += upbtn_Clicked;
            Image tmpimage2 = new Image();
            tmpimage2.Pixbuf = new Gdk.Pixbuf(".images/icon_down.png");
            downbtn = new ToolButton(tmpimage2, "");
            downbtn.TooltipText = "Split view";
            downbtn.Clicked += downbtn_Clicked;
            Image tmpimage3 = new Image();
            tmpimage3.Pixbuf = new Gdk.Pixbuf(".images/reply.png");
            replybtn = new ToolButton(tmpimage3, "");
            replybtn.TooltipText = "Reply to sender";
            SeparatorToolItem sepSpacer = new SeparatorToolItem();
            sepSpacer.Expand = true;
            sepSpacer.Draw = false;

            messageWindow = new ScrolledWindow();
            messagebrowser = new WebView();
            messagebrowser.Editable = false;
            messageWindow.Add(messagebrowser);
            contentBox.PackStart(toolbar, false, false, 0);
            contentBox.PackStart(messageWindow);
            toolbar.Add(replybtn);
            toolbar.Add(sepSpacer);
            toolbar.Add(upbtn);
            toolbar.Add(downbtn);
            this.Add2(contentBox);
            this.ShowAll();
            downbtn.Hide ();
            replybtn.Sensitive = false;

            treestoreMessages = new TreeStore (typeof(string),typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            forums = new List<Forum> ();
            getBoxMessages(messagebox);
            treestoreMessages.AppendValues("000", "000", "SharpTalk", "Admin", "Welcome to SharpTalk", "");
            treestoreMessages.SetSortColumnId(5, SortType.Descending);
            treeviewMessages.Model = treestoreMessages;
        }
Exemplo n.º 3
0
Arquivo: Window.cs Projeto: MrJoe/lat
        public MainWindow(Gnome.Program mainProgram)
        {
            program = mainProgram;

            ui = new Glade.XML(null, "lat.glade", "mainWindow", null);
            ui.Autoconnect(this);

            // set window icon
            Global.latIcon = Gdk.Pixbuf.LoadFromResource("lat.png");
            Gdk.Pixbuf dirIcon = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server.png");
            mainWindow.Icon = dirIcon;

            // Restore window positions
            LoadPreference(Preferences.MAIN_WINDOW_WIDTH);
            LoadPreference(Preferences.MAIN_WINDOW_X);
            LoadPreference(Preferences.MAIN_WINDOW_MAXIMIZED);
            LoadPreference(Preferences.MAIN_WINDOW_HPANED);

            // Watch for any changes
            Preferences.SettingChanged += OnPreferencesChanged;

            // Setup views
            viewsTreeView = new ViewsTreeView();
            viewsTreeView.ViewSelected += new ViewSelectedHandler(OnViewSelected);
            viewScrolledWindow.AddWithViewport(viewsTreeView);
            viewScrolledWindow.Show();

            // Setup browser
            ldapTreeView             = new LdapTreeView(mainWindow);
            ldapTreeView.dnSelected += new dnSelectedHandler(OnLdapDNSelected);
            browserScrolledWindow.AddWithViewport(ldapTreeView);
            browserScrolledWindow.Show();

            LoadPreference(Preferences.BROWSER_SELECTION);

            // Setup schema browser
            schemaTreeview = new SchemaTreeView(mainWindow);
            schemaTreeview.schemaSelected += new schemaSelectedHandler(OnSchemaDNSelected);
            schemaScrolledWindow.AddWithViewport(schemaTreeview);
            schemaScrolledWindow.Show();

            // Setup search
            searchTreeView = new SearchResultsTreeView();
            searchTreeView.SearchResultSelected += new SearchResultSelectedHandler(OnSearchSelected);
            searchTreeView.Export += OnSearchExport;

            resultsScrolledWindow.AddWithViewport(searchTreeView);
            resultsScrolledWindow.Show();

            // setup schema
            objRequiredStore          = new ListStore(typeof(string));
            objRequiredTreeview.Model = objRequiredStore;

            objOptionalStore          = new ListStore(typeof(string));
            objOptionalTreeview.Model = objOptionalStore;

            objRequiredTreeview.AppendColumn("Required Attributes", new CellRendererText(), "text", 0);
            objOptionalTreeview.AppendColumn("Optional Attributes", new CellRendererText(), "text", 0);

            infoVpaned1.Position = 150;

            ToggleButtons(false);
            ToggleInfoNotebook(false);

            templateToolButton.Hide();

            // setup menu
            newAccelGroup = new AccelGroup();
            mainWindow.AddAccelGroup(newAccelGroup);

            // status bar
            UpdateStatusBar();

#if ENABLE_NETWORKMANAGER
            Global.Network = NetworkDetect.Instance;
            Global.Network.StateChanged += OnNetworkStateChanged;
#endif

#if ENABLE_AVAHI
            // FIXME: causes delay/crashes on exit for some reason
            finder          = new ServiceFinder();
            finder.Found   += new FoundServiceEventHandler(OnServerFound);
            finder.Removed += new RemovedServiceEventHandler(OnServerRemoved);
            finder.Start();
#endif

            viewNotebook.SwitchPage += new SwitchPageHandler(OnNotebookViewChanged);

            if (Global.Connections.ConnectionNames.Length == 0)
            {
                new ConnectDialog();

                viewsTreeView.Refresh();
                ldapTreeView.Refresh();
                schemaTreeview.Refresh();
            }
        }
Exemplo n.º 4
0
        public ForumView(Forum site, String forum)
        {
            this.site = site;
            this.forum = forum;
            this.Destroyed += delegate(object sender, EventArgs e) {
                if (iconThread != null)
                if (iconThread.IsAlive)
                    iconThread.Abort ();
            };
            topicWindow = new ScrolledWindow ();
            topicWindow.ShadowType = ShadowType.EtchedIn;
            topicWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);

            treeviewTopics = new TreeView ();
            treeviewTopics.BorderWidth = 0;

            treeviewTopics.AppendColumn ("", new CellRendererPixbuf (), "pixbuf", 5);
            CellRendererText cellTopic = new CellRendererText ();
            TreeViewColumn topicCol = treeviewTopics.AppendColumn ("Topic", cellTopic, "text", 1);
            topicCol.SetCellDataFunc (cellTopic, new Gtk.TreeCellDataFunc (renderTopic));
            topicCol.Resizable = true;
            treeviewTopics.AppendColumn ("Author", new CellRendererText (), "text", 2).Resizable = true;
            ;
            treeviewTopics.AppendColumn ("Replies", new CellRendererText (), "text", 3).Resizable = true;
            ;
            treeviewTopics.AppendColumn ("Last Reply", new CellRendererText (), "text", 4).Resizable = true;
            ;
            // Use treeView.Selection.Changed?
            treeviewTopics.RowActivated += treeviewTopics_RowActivated;
            treeviewTopics.ButtonPressEvent += treeviewTopics_ButtonPress;

            topicWindow.Add (treeviewTopics);
            this.Add1 (topicWindow);

            contentBox = new VBox (false, 0);
            Toolbar toolbar = new Toolbar ();
            toolbar.HeightRequest = 38;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.BorderWidth = 0;
            firstbtn = new ToolButton (Stock.GotoFirst);
            firstbtn.TooltipText = "First page";
            firstbtn.Sensitive = false;
            firstbtn.Clicked += firstbtn_Clicked;
            prevbtn = new ToolButton (Stock.GoBack);
            prevbtn.TooltipText = "Previous page";
            prevbtn.Sensitive = false;
            prevbtn.Clicked += prevbtn_Clicked;
            nextbtn = new ToolButton (Stock.GoForward);
            nextbtn.TooltipText = "Next page";
            nextbtn.Sensitive = false;
            nextbtn.Clicked += nextbtn_Clicked;
            lastbtn = new ToolButton (Stock.GotoLast);
            lastbtn.TooltipText = "Last page";
            lastbtn.Sensitive = false;
            lastbtn.Clicked += lastbtn_Clicked;

            Image tmpimage = new Image ();
            tmpimage.Pixbuf = new Gdk.Pixbuf (".images/icon_up.png");
            upbtn = new ToolButton (tmpimage, "");
            upbtn.TooltipText = "Expand view to top";
            upbtn.Clicked += upbtn_Clicked;
            Image tmpimage2 = new Image ();
            tmpimage2.Pixbuf = new Gdk.Pixbuf (".images/icon_down.png");
            downbtn = new ToolButton (tmpimage2, "");
            downbtn.TooltipText = "Split view";
            downbtn.Clicked += downbtn_Clicked;
            closebtn = new ToolButton (Stock.Close);
            closebtn.TooltipText = "Close image view";
            closebtn.Clicked += closebtn_Clicked;
            Image tmpimage3 = new Image ();
            tmpimage3.Pixbuf = new Gdk.Pixbuf (".images/rotate_16.png");
            rotatebtn = new ToolButton (tmpimage3, "");
            rotatebtn.TooltipText = "Rotate image clockwise";
            rotatebtn.Clicked += rotatebtn_Clicked;
            Image tmpimage4 = new Image ();
            tmpimage4.Pixbuf = new Gdk.Pixbuf (".images/icon_save.png");
            savebtn = new ToolButton (tmpimage4, "");
            savebtn.TooltipText = "Download image";
            savebtn.Clicked += savebtn_Clicked;
            pageLabel = new Label ("");
            ToolItem textItem = new ToolItem ();
            textItem.Expand = false;
            textItem.Add (pageLabel);
            imageviewbtn = new ToggleToolButton (Stock.ZoomFit);
            imageviewbtn.TooltipText = "Image view";
            imageviewbtn.Toggled += imageviewbtn_Toggled;
            textviewbtn = new ToggleToolButton (Stock.Properties);
            textviewbtn.TooltipText = "Thread view";
            textviewbtn.Active = true;
            textviewbtn.Toggled += textviewbtn_Toggled;
            SeparatorToolItem sepSpacer = new SeparatorToolItem ();
            sepSpacer.Expand = true;
            sepSpacer.Draw = false;
            sepFullsize = new SeparatorToolItem ();
            imageSortAscending = new ToggleToolButton (Stock.SortAscending);
            imageSortAscending.TooltipText = "Show earliest images first";
            imageSortAscending.Active = true;
            imageSortAscending.Toggled += imageSortAscending_Toggled;
            imageSortDescending = new ToggleToolButton (Stock.SortDescending);
            imageSortDescending.TooltipText = "Show latest images first";
            imageSortDescending.Toggled += imageSortDescending_Toggled;
            imageLoadingProgress = new ProgressBar ();
            ToolItem progressItem = new ToolItem ();
            progressItem.Expand = false;
            progressItem.Add (imageLoadingProgress);
            imageLoadingProgress.Fraction = 0;
            toolbar.Add (imageSortAscending);
            toolbar.Add (imageSortDescending);
            toolbar.Add (progressItem);
            toolbar.Add (firstbtn);
            toolbar.Add (prevbtn);
            toolbar.Add (textItem);
            toolbar.Add (nextbtn);
            toolbar.Add (lastbtn);
            toolbar.Add (sepFullsize);
            toolbar.Add (savebtn);
            toolbar.Add (rotatebtn);
            toolbar.Add (sepSpacer);
            toolbar.Add (imageviewbtn);
            toolbar.Add (textviewbtn);
            toolbar.Add (closebtn);
            toolbar.Add (upbtn);
            toolbar.Add (downbtn);
            threadwindow = new ScrolledWindow ();
            threadbrowser = new WebView ();
            threadbrowser.Editable = false;
            threadbrowser.NavigationRequested += threadbrowser_NavigationRequested;
            threadwindow.Add (threadbrowser);

            iconStore = new ListStore (typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(int), typeof(int));
            iconview = new IconView (iconStore);
            iconview.Margin = 1;
            iconview.Spacing = 1;
            iconview.BorderWidth = 0;
            iconview.ColumnSpacing = 1;
            iconview.RowSpacing = 1;
            iconview.PixbufColumn = 1;
            iconview.TooltipColumn = 2;
            iconview.SelectionMode = SelectionMode.Multiple;
            iconview.ItemActivated += iconview_ItemActivated;
            iconview.ButtonPressEvent += iconView_ButtonPress;
            iconview.Model = iconStore;
            iconview.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
            iconwindow = new ScrolledWindow ();
            iconwindow.ShadowType = ShadowType.EtchedIn;
            iconwindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            iconwindow.Add (iconview);

            imagewindow = new EventBox ();
            fullSizeImage = new Image ();
            // JICE TEST
            fullsizeLayout = new Layout (null, null);
            fullsizeLayout.Add (fullSizeImage);
            fullsizeLayout.SizeRequested += fullsizeLayout_SizeRequested;
            imagewindow.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66));
            imagewindow.Add (fullsizeLayout);
            imagewindow.CanFocus = true;
            imagewindow.KeyPressEvent += imagewindow_keyPressEvent;
            imagewindow.SizeRequested += imagewindow_sizeAllocated;

            //			imagewindow.Add(fullSizeImage);

            contentBox.PackStart (toolbar, false, false, 0);
            contentBox.PackStart (iconwindow);
            contentBox.PackStart (imagewindow);
            contentBox.PackStart (threadwindow);
            this.Add2 (contentBox);
            this.ShowAll ();
            imageSortAscending.Hide ();
            imageSortDescending.Hide ();
            iconwindow.Hide ();
            imagewindow.Hide ();
            closebtn.Hide ();
            rotatebtn.Hide ();
            savebtn.Hide ();
            sepFullsize.Hide ();
            downbtn.Hide ();
            imageLoadingProgress.Hide ();

            String favouriteThreads = UserSettings.getValue ("Site" + site.forumName + ".Forum" + forum + ".Favourites");
            favThreads = favouriteThreads.Split (';');

            treestoreTopics = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Gdk.Pixbuf));

            topicsLoaded = 0;
            loadTopics ();
            treeviewTopics.Model = treestoreTopics;
        }