コード例 #1
0
        public DisassemblyView()
        {
            DocumentTitle = GettextCatalog.GetString("Disassembly");

            sw                = new Gtk.ScrolledWindow();
            editor            = TextEditorFactory.CreateNewEditor();
            editor.IsReadOnly = true;
            asmMarker         = TextMarkerFactory.CreateAsmLineMarker(editor);

            editor.Options = DefaultSourceEditorOptions.PlainEditor;

            sw.AddWithViewport(editor);
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.ShowAll();
            sw.Vadjustment.ValueChanged      += OnScrollEditor;
            sw.VScrollbar.ButtonPressEvent   += OnPress;
            sw.VScrollbar.ButtonReleaseEvent += OnRelease;
            sw.VScrollbar.Events             |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask;
            sw.ShadowType = Gtk.ShadowType.In;

            sw.Sensitive = false;

            DebuggingService.StoppedEvent += OnStop;
        }
コード例 #2
0
        public AddNodeDialog(SimulatorInterface simulatorInterface)
        {
            this.Build ();
            this.simulatorInterface = simulatorInterface;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            sw.HeightRequest = 250;

            VBox.PackStart (sw, true, true, 0);
            Table table = new Table ((uint)(BasicNode.NodeLabels.Length), 2, true);
            sw.AddWithViewport (table);
            for (int i = 0; i < BasicNode.NodeLabels.Length; i++)
            {
                labels.Add (new Label (BasicNode.NodeLabels[i]));
                table.Attach (labels[i], 0, 1, (uint)(i), (uint)(i) + 1);
                entries.Add (new SpinButton (0, 80, 1));
                entries[i].ClimbRate = 1;
                entries[i].Numeric = true;
                table.Attach (entries[i], 1, 2, (uint)(i), (uint)(i) + 1);
            }
            buttonOk.Clicked += new EventHandler (AddNode);
            buttonCancel.Clicked += new EventHandler (Cancel);
            this.SetDefaultSize (340, 300);
            this.Modal = true;
            this.ShowAll ();
        }
コード例 #3
0
ファイル: ImageBrowserGtk.cs プロジェクト: retahc/old-code
    static void Main(string [] args)
    {
        Application.Init();

        if (args.Length <= 0)
        {
            Console.WriteLine("\nUSAGE: ImageBrowser.exe <directory>\n");
            return;
        }

        string dir = args [0];

        Gtk.Window         window = new Gtk.Window("Image Browser");
        Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow(new Adjustment(IntPtr.Zero), new Adjustment(IntPtr.Zero));

        ArrayList images = GetItemsFromDirectory(dir);

        Gtk.Table table = PopulateTable(images);

        window.Title = String.Format("{0}: {1} ({2} images)", window.Title, dir, images.Count);
        window.SetDefaultSize(300, 200);
        window.DeleteEvent += Window_Delete;
        scroll.AddWithViewport(table);
        scroll.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
        window.Add(scroll);
        window.ShowAll();
        Application.Run();
    }
コード例 #4
0
        public static void Load(PreferenceService service)
        {
            Page music = ServiceManager.SourceManager.MusicLibrary.PreferencesPage;

            foreach (LibrarySource source in ServiceManager.SourceManager.FindSources <LibrarySource> ())
            {
                new LibraryLocationButton(source);
            }

            PreferenceBase folder_pattern = music["file-system"]["folder_pattern"];

            folder_pattern.DisplayWidget = new PatternComboBox(folder_pattern, FileNamePattern.SuggestedFolders);

            PreferenceBase file_pattern = music["file-system"]["file_pattern"];

            file_pattern.DisplayWidget = new PatternComboBox(file_pattern, FileNamePattern.SuggestedFiles);

            PreferenceBase pattern_display = music["file-system"].FindOrAdd(new VoidPreference("file_folder_pattern"));

            pattern_display.DisplayWidget = new PatternDisplay(folder_pattern.DisplayWidget, file_pattern.DisplayWidget);

            // Set up the extensions tab UI
            Banshee.Addins.Gui.AddinView view = new Banshee.Addins.Gui.AddinView();
            view.Show();

            Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow();
            scroll.HscrollbarPolicy = PolicyType.Never;
            scroll.AddWithViewport(view);
            scroll.Show();

            service["extensions"].DisplayWidget = scroll;
        }
コード例 #5
0
ファイル: Library.cs プロジェクト: gsterjov/fusemc
        // creates the library user interface
        public Library()
        {
            // create widgets
            ScrolledWindow library_scroll = new ScrolledWindow ();
            VBox library_box = new VBox (false, 0);

            // pack widgets
            library_box.PackStart (dynamic_tree, false, false, 0);
            library_box.PackStart (new HSeparator (), false, false, 0);
            library_box.PackStart (folder_tree, false, false, 0);
            library_box.PackStart (new HSeparator (), false, false, 0);
            library_box.PackStart (playlist_tree, true, true, 0);

            library_scroll.AddWithViewport (library_box);
            library_scroll.ShadowType = ShadowType.In;

            media_scroll.Add (media_tree);
            media_scroll.ShadowType = ShadowType.In;
            media_box.PackStart (media_scroll, true, true, 0);

            // cover art box
            VBox image_box = new VBox (false, 0);
            image_box.PackStart (library_scroll, true, true, 0);
            image_box.PackStart (cover_art, false, false, 0);

            info_box.PackStart (media_box, true, true, 0);
            info_box.PackStart (info_bar, false, false, 0);

            info_splitter.Pack1 (info_box, true, true);

            main_splitter.Add1 (image_box);
            main_splitter.Add2 (info_splitter);
        }
コード例 #6
0
 private void initGui()
 {
     //create the layout
     VBox layout = new VBox();
     //add the treeview
     ScrolledWindow swTree = new ScrolledWindow();
     swTree.AddWithViewport( tree );
     layout.PackStart( swTree );
     //add the add/edit/remove buttons
     HBox hbox = new HBox();
     hbox.PackStart  ( BtnAddNode    );
     hbox.PackStart  ( BtnEditNode   );
     hbox.PackStart  ( BtnRemoveNode );
     layout.PackStart( hbox, false, true, 0 );
     //add the checkboxes
     hbox      = new HBox();
     hbox.PackStart  ( ChkNodeIconVisible );
     hbox.PackStart  ( ChkCheckBoxTree    );
     hbox.PackStart  ( ChkEditableTree    );
     hbox.PackStart  ( ChkOwnerDrawn      );
     hbox.PackStart  ( ChkDragAndDrop     );
     layout.PackStart( hbox, false, true, 0 );
     //add layout
     this.Add( layout );
 }
コード例 #7
0
        private void initGui()
        {
            //create the layout
            VBox layout       = new VBox();
            //add the list
            ScrolledWindow sw = new ScrolledWindow();
            sw.AddWithViewport( list );
            layout.PackStart  ( sw   );
            //add the add/edit/remove buttons
            HBox hbox = new HBox();
            hbox.PackStart  ( BtnAdd    );
            hbox.PackStart  ( BtnEdit   );
            hbox.PackStart  ( BtnRemove );
            hbox.PackStart  ( BtnSort   );
            layout.PackStart( hbox, false, true, 0 );
            //add the checkboxes
            hbox = new HBox();
            hbox.PackStart( ChkOwnerDrawned  , true, true, 0 );
            hbox.PackStart( ChkIsCheckBoxList, true, true, 0 );
            hbox.PackStart( ChkIsEditable    , true, true, 0 );
            hbox.PackStart( ChkDragAndDrop   , true, true, 0 );
            //

            layout.PackStart( hbox, false, true, 0 );
            //add layout
            this.Add( layout );
        }
コード例 #8
0
		private Widget GetWidget (CustomAttributeCollection cac)
		{
			FontDescription fd = FontDescription.FromString ("Courier 10 Pitch 10");

			VBox vbox = new VBox (false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.AddWithViewport (vbox);
			
			if ((cac != null) && (cac.Count > 0)) {
				foreach (CustomAttribute ca in cac) {
 					TextView textview = new TextView ();
					textview.Editable = false;
					textview.Buffer.Text = Format (ca);
					textview.ModifyFont (fd);
					
					Expander expander = new Expander (ca.Constructor.DeclaringType.FullName);
					expander.Add (textview);
					
					vbox.Add (expander);
				}
			}
			
			sw.ShowAll ();
			return sw;
 		}
コード例 #9
0
ファイル: ImageBrowserGtk.cs プロジェクト: emtees/old-code
	static void Main (string [] args)
	{
		Application.Init ();

		if (args.Length <= 0) {
			Console.WriteLine ("\nUSAGE: ImageBrowser.exe <directory>\n");
			return;
		}
	
		string dir = args [0];

		Gtk.Window window = new Gtk.Window ("Image Browser");
		Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow (new Adjustment (IntPtr.Zero), new Adjustment (IntPtr.Zero));

		ArrayList images = GetItemsFromDirectory (dir);
		
		Gtk.Table table = PopulateTable (images);
		
		window.Title = String.Format ("{0}: {1} ({2} images)", window.Title, dir, images.Count);
		window.SetDefaultSize (300, 200);
		window.DeleteEvent += Window_Delete;
		scroll.AddWithViewport (table);
		scroll.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
		window.Add (scroll);
		window.ShowAll ();
		Application.Run ();
	}
コード例 #10
0
ファイル: News.cs プロジェクト: gsterjov/fusemc
        // create the main news widget
        public News(MainPage parent)
        {
            this.parent = parent;
            news_viewer = new NewsViewer (parent);

            // setting up the news feed tree
            news_tree.Model = news_store;

            news_tree.AppendColumn (null, new CellRendererText (), new TreeCellDataFunc (renderNews));
            news_tree.HeadersVisible = false;
            news_tree.RowSeparatorFunc = new TreeViewRowSeparatorFunc (row_separator);

            // box packing
            ScrolledWindow news_scroll = new ScrolledWindow ();
            ScrolledWindow html_scroll = new ScrolledWindow ();

            news_scroll.Add (news_tree);
            html_scroll.AddWithViewport (news_viewer.HTML);

            news_scroll.ShadowType = ShadowType.In;
            html_scroll.ShadowType = ShadowType.In;

            main_splitter.Add1 (news_scroll);
            main_splitter.Add2 (html_scroll);

            // events
            news_tree.Selection.Changed += news_selected;
            news_tree.ButtonReleaseEvent += feed_tree_button_release;
        }
コード例 #11
0
ファイル: FolderView.cs プロジェクト: hol353/ApsimX
 public FolderView(ViewBase owner)
     : base(owner)
 {
     scroller = new ScrolledWindow();
     scroller.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
     table = new Table(1, 1, false);
     scroller.AddWithViewport(table);
     _mainWidget = scroller;
 }
コード例 #12
0
		public Widget GetWidget (MethodDefinition method)
		{
			Digraph digraph = GetIlSourceAsDot (method);

			Image image = new Image (DotHelper.BuildDotImage (digraph));

			ScrolledWindow sw = new ScrolledWindow ();
			sw.AddWithViewport (image);
			sw.ShowAll ();
			return sw;
		}
コード例 #13
0
 protected override Widget CreateWidget(WindowContext context)
 {
     if(Child == null)
         throw new Exception("Scrolled musí obsahovat widget");
     ScrolledWindow sw = new ScrolledWindow();
     Widget child = Child.Build(context);
     if(IsNativelyScrolled(child.GetType()))
         sw.Add(child);
     else
         sw.AddWithViewport(child);
     return sw;
 }
コード例 #14
0
        public EditIconFactoryDialog(Gtk.Window parent, Stetic.IProject project, ProjectIconFactory iconFactory)
        {
            this.iconFactory = iconFactory;
            this.parent      = parent;
            this.project     = project;

            Glade.XML xml = new Glade.XML(null, "stetic.glade", "EditIconFactoryDialog", null);
            xml.Autoconnect(this);

            customIconList = new ProjectIconList(project, iconFactory);
            iconListScrolledwindow.AddWithViewport(customIconList);
        }
コード例 #15
0
		public WelcomePageView () : base ()
		{
			this.ContentName = GettextCatalog.GetString ("Welcome");
			this.IsViewOnly = true;
			
			scroller = new ScrolledWindow ();
			widget = new WelcomePageWidget ();
			scroller.AddWithViewport (widget);
			scroller.ShadowType = ShadowType.None;
			scroller.FocusChain = new Widget[] { widget };
			scroller.Show ();
		}
コード例 #16
0
		public Widget GetWidget (MethodDefinition method)
		{
			BackwardAnalysis (">", null, method);
			Digraph digraph = BuildDotFile (method);

			Image image = new Image (DotHelper.BuildDotImage (digraph));

			ScrolledWindow sw = new ScrolledWindow ();
			sw.AddWithViewport (image);
			sw.ShowAll ();
			Clear ();
			return sw;
		}
コード例 #17
0
		public TextVisualizerView ()
		{
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			TextTagTable tagTable = new TextTagTable ();
			TextBuffer buffer = new TextBuffer (tagTable);
			textView = new TextView (buffer);

			scrolledWindow = new ScrolledWindow ();
			scrolledWindow.AddWithViewport (textView);
			
			vbox.PackStart (scrolledWindow, true, true, 0);
			
			vbox.ShowAll ();
		}
コード例 #18
0
ファイル: WarningWindow.cs プロジェクト: gsterjov/fusemc
        // creates the exception window
        public WarningWindow(Window transient, StatusBar status)
            : base(transient, "Error Log")
        {
            this.status = status;

            tree.Model = status.ErrorLog;
            tree.HeadersVisible = false;
            tree.AppendColumn (null, new CellRendererText (), new TreeCellDataFunc (render_error));

            message.Selectable = true;
            message.Xalign = 0;
            message.Yalign = 0;
            message.WidthChars = -1;

            Label tree_title = new Label ();
            Label message_title = new Label ();
            tree_title.Xalign = 0;
            tree_title.Markup = "<b>Error Log:</b>";
            message_title.Xalign = 0;
            message_title.Markup = "<b>Error Message:</b>";

            VBox box = new VBox (false, 0);
            Button remove_button = new Button (Stock.Remove);

            ScrolledWindow tree_scroll = new ScrolledWindow ();
            ScrolledWindow message_scroll = new ScrolledWindow ();
            tree_scroll.Add (tree);
            message_scroll.AddWithViewport (message);

            tree_scroll.ShadowType = ShadowType.In;
            message_scroll.ShadowType = ShadowType.In;

            tree.Selection.Changed += tree_selected;
            remove_button.Clicked += remove_clicked;

            box.PackStart (tree_title, false, false, 5);
            box.PackStart (tree_scroll, false, false, 0);
            box.PackStart (message_title, false, false, 5);
            box.PackStart (message_scroll, true, true, 0);
            box.PackStart (remove_button, false, true, 5);

            box.BorderWidth = 5;

            this.Resize (600, 400);
            this.Add (box);
        }
コード例 #19
0
ファイル: Browser.cs プロジェクト: mono/monodoc-widgets
 public Browser(string catalog_dir)
     : base("Documentation Browser Sample")
 {
     DefaultSize = new Size (600, 400);
     Gtk.Paned paned = new Gtk.HPaned ();
     Gtk.ScrolledWindow sw = new ScrolledWindow ();
     DocTree tree = new DocTree (catalog_dir);
     sw.Add (tree);
     paned.Add1 (sw);
     sw = new ScrolledWindow ();
     DocView view = new DocView (tree);
     sw.AddWithViewport (view);
     paned.Add2 (sw);
     paned.Position = 250;
     paned.ShowAll ();
     Add (paned);
 }
コード例 #20
0
        public MainWindow(InvoiceDirectory idir_)
            : base(WindowType.Toplevel)
        {
            idir = idir_;

            SetSizeRequest(500, 500);
            Title = "Fakturering 2.6";

            maingroup = new HBox(false, 0);
            buttons = new VButtonBox();
            scrolledhd = new ScrolledWindow();
            create   = Button.NewWithLabel("Skapa ny faktura");
            edit     = Button.NewWithLabel("Redigera faktura");
            delete   = Button.NewWithLabel("Radera faktura");
            showbut  = Button.NewWithLabel("Visa faktura");
            printbut = Button.NewWithLabel("Skriv ut faktura");

            CreateListView();

            Add(maingroup);
            maingroup.PackStart(scrolledhd, true, true, 0);
            maingroup.PackStart(buttons, false, false, 0);
            buttons.Layout = ButtonBoxStyle.Start;
            buttons.PackStart(create,   false, false, 0);
            buttons.PackStart(edit,     false, false, 0);
            buttons.PackStart(showbut,  false, false, 0);
            buttons.PackStart(printbut, false, false, 0);
            buttons.PackStart(delete,   false, false, 0);
            scrolledhd.AddWithViewport(listview);
            scrolledhd.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            UpdateHDList();

            create.Clicked   += new EventHandler(Create);
            edit.Clicked     += new EventHandler(Edit);
            delete.Clicked   += new EventHandler(DeleteInvoice);
            showbut.Clicked  += new EventHandler(ShowInvoice);
            printbut.Clicked += new EventHandler(PrintInvoice);

            maingroup.ShowAll();

            //Den här måste vara här då storleken inte är känd innan
            ScrollToEnd(scrolledhd);

            DeleteEvent += new Gtk.DeleteEventHandler(DeleteWindow);
        }
コード例 #21
0
ファイル: AttributeEditorWidget.cs プロジェクト: MrJoe/lat
        public AttributeEditorWidget()
            : base()
        {
            sw = new ScrolledWindow ();
            sw.HscrollbarPolicy = PolicyType.Automatic;
            sw.VscrollbarPolicy = PolicyType.Automatic;

            store = new ListStore (typeof (string), typeof(string));
            store.SetSortColumnId (0, SortType.Ascending);

            tv = new TreeView ();
            tv.Model = store;

            TreeViewColumn col;
            col = tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
            col.SortColumnId = 0;

            CellRendererText cell = new CellRendererText ();
            cell.Editable = true;
            cell.Edited += new EditedHandler (OnAttributeEdit);

            tv.AppendColumn ("Value", cell, "text", 1);

            tv.KeyPressEvent += new KeyPressEventHandler (OnKeyPress);
            tv.ButtonPressEvent += new ButtonPressEventHandler (OnRightClick);
            tv.RowActivated += new RowActivatedHandler (OnRowActivated);

            sw.AddWithViewport (tv);

            HButtonBox hb = new HButtonBox ();
            hb.Layout = ButtonBoxStyle.End;

            applyButton = new Button ();
            applyButton.Label = "Apply";
            applyButton.Image = new Gtk.Image (Stock.Apply, IconSize.Button);
            applyButton.Clicked += new EventHandler (OnApplyClicked);
            applyButton.Sensitive = false;

            hb.Add (applyButton);

            this.PackStart (sw, true, true, 0);
            this.PackStart (hb, false, false, 5);

            this.ShowAll ();
        }
コード例 #22
0
ファイル: scrolledwindow_gtk.cs プロジェクト: emtees/old-code
	static void SetUpGui ()
	{
		Window w = new Window ("Sign Up");
		
		VBox vbox = new VBox ();
		
		Button b = new Button ("Testing");
		vbox.PackStart (b, false, false, 0);
		
		b = new Button ("Testing II");
		vbox.PackStart (b, false, false, 0);
				
		ScrolledWindow sw = new ScrolledWindow ();
		
		sw.AddWithViewport (vbox);
		
		w.Add (sw);
//		w.SetDefaultSize (12, 12);
		w.ShowAll ();
	}
コード例 #23
0
ファイル: MultiResultsGrid.cs プロジェクト: emtees/old-code
		public MultiResultsGrid (ArrayList grids) : base (false, 4) 
		{
			if (grids == null)
				throw new Exception("grids is null");
			if (grids.Count == 0)
				throw new Exception("no grids to add");

			results = grids;

			ScrolledWindow sw = new ScrolledWindow ();
			this.PackStart (sw, true, true, 0);

			gridbox = new VBox (false, 4);

			IEnumerator ienum = results.GetEnumerator ();
			while (ienum.MoveNext ()) {
				DataGrid grid = (DataGrid) ienum.Current;
				gridbox.PackStart (grid, true, true, 0);
			}

			sw.AddWithViewport (gridbox);			
		}
コード例 #24
0
ファイル: DisassemblyView.cs プロジェクト: kdubau/monodevelop
		public DisassemblyView ()
		{
			ContentName = GettextCatalog.GetString ("Disassembly");
			sw = new Gtk.ScrolledWindow ();
			editor = TextEditorFactory.CreateNewEditor ();
			editor.IsReadOnly = true;
			asmMarker = TextMarkerFactory.CreateAsmLineMarker (editor);

			editor.Options = DefaultSourceEditorOptions.PlainEditor;
			
			sw.AddWithViewport (editor);
			sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			sw.ShowAll ();
			sw.Vadjustment.ValueChanged += OnScrollEditor;
			sw.VScrollbar.ButtonPressEvent += OnPress;
			sw.VScrollbar.ButtonReleaseEvent += OnRelease;
			sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask;
			sw.ShadowType = Gtk.ShadowType.In;
			
			sw.Sensitive = false;

			DebuggingService.StoppedEvent += OnStop;
		}
コード例 #25
0
ファイル: ExceptionWindow.cs プロジェクト: gsterjov/fusemc
        // creates the exception window
        public ExceptionWindow(Window transient, string exception)
            : base(transient, "An error has occured..")
        {
            VBox box = new VBox (false, 0);
            Label title = new Label ();
            title.Markup = "A critical error has occured within the application\n\n<b>Error Details:</b>";
            title.Xalign = 0;

            Button quit = new Button (Stock.Quit);
            TextView message = new TextView ();

            ScrolledWindow scroll = new ScrolledWindow ();
            scroll.AddWithViewport (message);

            quit.Clicked += quit_clicked;
            message.Buffer.Text = exception;

            box.PackStart (title, false, false, 0);
            box.PackStart (scroll, true, true, 0);
            box.PackStart (quit, false, false, 0);

            box.BorderWidth = 10;
            this.Add (box);
        }
コード例 #26
0
        public SelectIconDialog(Gtk.Window parent, Stetic.IProject project)
        {
            this.parent  = parent;
            this.project = project;

            Glade.XML xml = new Glade.XML(null, "stetic.glade", "SelectIconDialog", null);
            xml.Autoconnect(this);

            // Stock icon list

            iconList = new StockIconList();
            iconList.SelectionChanged += new EventHandler(OnIconSelectionChanged);
            iconScrolledwindow.AddWithViewport(iconList);

            // Custom icon list

            customIconList = new ProjectIconList(project, project.IconFactory);
            customIconList.SelectionChanged += new EventHandler(OnCustomIconSelectionChanged);
            customIconScrolledwindow.AddWithViewport(customIconList);
            dialog.ShowAll();

            UpdateIconSelection();
            UpdateButtons();
        }
コード例 #27
0
ファイル: Window.cs プロジェクト: MrJoe/lat
        void OnLdapDNSelected(object o, dnSelectedEventArgs args)
        {
            if (args.Server == null)
            {
                return;
            }

            Connection conn = Global.Connections [args.Server];

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

                serverInfoView = new ServerInfoView(conn);
                valuesScrolledWindow.AddWithViewport(serverInfoView);
                valuesScrolledWindow.ShowAll();

                return;
            }

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

                attributeEditor = new AttributeEditorWidget();
                valuesScrolledWindow.AddWithViewport(attributeEditor);
                valuesScrolledWindow.ShowAll();
            }

            LdapEntry entry = conn.Data.GetEntry(args.DN);

            if (entry != null)
            {
                attributeEditor.Show(conn, entry, showAllAttributes.Active);
            }
        }
コード例 #28
0
ファイル: SparkleSetup.cs プロジェクト: knocte/SparkleShare
        public void ShowPage(PageType type, string [] warnings)
        {
            if (type == PageType.Setup) {
                Header      = "Welcome to SparkleShare!";
                Description = "First off, what's your name and email?\nThis information is only visible to team members.";

                Table table = new Table (2, 3, true) {
                    RowSpacing    = 6,
                    ColumnSpacing = 6
                };

                Label name_label = new Label ("<b>" + "Full Name:" + "</b>") {
                    UseMarkup = true,
                    Xalign    = 1
                };

                Entry name_entry = new Entry () {
                    Xalign = 0,
                    ActivatesDefault = true
                };

                UnixUserInfo user_info = UnixUserInfo.GetRealUser ();

                if (user_info != null && user_info.RealName != null)
                    name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ());

                Entry email_entry = new Entry () {
                    Xalign = 0,
                    ActivatesDefault = true
                };

                Label email_label = new Label ("<b>" + "Email:" + "</b>") {
                    UseMarkup = true,
                    Xalign    = 1
                };

                table.Attach (name_label, 0, 1, 0, 1);
                table.Attach (name_entry, 1, 2, 0, 1);
                table.Attach (email_label, 0, 1, 1, 2);
                table.Attach (email_entry, 1, 2, 1, 2);

                VBox wrapper = new VBox (false, 9);
                wrapper.PackStart (table, true, false, 0);

                Button cancel_button = new Button ("Cancel");
                Button continue_button = new Button ("Continue") { Sensitive = false };

                Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) {
                    Application.Invoke (delegate { continue_button.Sensitive = button_enabled; });
                };

                name_entry.Changed    += delegate { Controller.CheckSetupPage (name_entry.Text, email_entry.Text); };
                email_entry.Changed   += delegate { Controller.CheckSetupPage (name_entry.Text, email_entry.Text); };
                cancel_button.Clicked += delegate { Controller.SetupPageCancelled (); };

                continue_button.Clicked += delegate {
                    Controller.SetupPageCompleted (name_entry.Text, email_entry.Text);
                };

                AddButton (cancel_button);
                AddButton (continue_button);
                Add (wrapper);

                Controller.CheckSetupPage (name_entry.Text, email_entry.Text);
            }

            if (type == PageType.Add) {
                Header = "Where's your project hosted?";

                VBox layout_vertical = new VBox (false, 12);
                HBox layout_fields   = new HBox (true, 12);
                VBox layout_address  = new VBox (true, 0);
                VBox layout_path     = new VBox (true, 0);

                ListStore store = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin));

                SparkleTreeView tree = new SparkleTreeView (store) { HeadersVisible = false };
                ScrolledWindow scrolled_window = new ScrolledWindow ();
                scrolled_window.AddWithViewport (tree);

                // Icon column
                tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
                tree.Columns [0].Cells [0].Xpad = 6;

                // Service column
                TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" };
                CellRendererText service_cell = new CellRendererText () { Ypad = 4 };
                service_column.PackStart (service_cell, true);
                service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));

                foreach (SparklePlugin plugin in Controller.Plugins) {
                    store.AppendValues (new Gdk.Pixbuf (plugin.ImagePath),
                        "<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
                          "<span fgcolor=\"" + SecondaryTextColorSelected + "\">" +
                          plugin.Description + "</span>" +
                        "</span>", plugin);
                }

                tree.AppendColumn (service_column);

                Entry address_entry = new Entry () {
                    Text = Controller.PreviousAddress,
                    Sensitive = (Controller.SelectedPlugin.Address == null),
                    ActivatesDefault = true
                };

                Entry path_entry = new Entry () {
                    Text = Controller.PreviousPath,
                    Sensitive = (Controller.SelectedPlugin.Path == null),
                    ActivatesDefault = true
                };

                Label address_example = new Label () {
                    Xalign = 0,
                    UseMarkup = true,
                    Markup = "<span size=\"small\" fgcolor=\"" +
                        SecondaryTextColor + "\">" + Controller.SelectedPlugin.AddressExample + "</span>"
                };

                Label path_example = new Label () {
                    Xalign = 0,
                    UseMarkup = true,
                    Markup = "<span size=\"small\" fgcolor=\"" +
                        SecondaryTextColor + "\">" + Controller.SelectedPlugin.PathExample + "</span>"
                };

                // Select the first plugin by default
                TreeSelection default_selection = tree.Selection;
                TreePath default_path = new TreePath ("0");
                default_selection.SelectPath (default_path);
                Controller.SelectedPluginChanged (0);

                Controller.ChangeAddressFieldEvent += delegate (string text,
                    string example_text, FieldState state) {

                    Application.Invoke (delegate {
                        address_entry.Text      = text;
                        address_entry.Sensitive = (state == FieldState.Enabled);
                        address_example.Markup  =  "<span size=\"small\" fgcolor=\"" +
                            SecondaryTextColor + "\">" + example_text + "</span>";
                    });
                };

                Controller.ChangePathFieldEvent += delegate (string text,
                    string example_text, FieldState state) {

                    Application.Invoke (delegate {
                        path_entry.Text      = text;
                        path_entry.Sensitive = (state == FieldState.Enabled);
                        path_example.Markup  =  "<span size=\"small\" fgcolor=\""
                            + SecondaryTextColor + "\">" + example_text + "</span>";
                    });
                };

                Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);

                // Update the address field text when the selection changes
                tree.CursorChanged += delegate (object sender, EventArgs e) {
                    Controller.SelectedPluginChanged (tree.SelectedRow);
                    // TODO: Scroll to selected row when using arrow keys
                };

                tree.Model.Foreach (new TreeModelForeachFunc (delegate (TreeModel model,
                    TreePath path, TreeIter iter) {

                    string address;

                    try {
                        address = (model.GetValue (iter, 2) as SparklePlugin).Address;

                    } catch (NullReferenceException) {
                        address = "";
                    }

                    if (!string.IsNullOrEmpty (address) &&
                        address.Equals (Controller.PreviousAddress)) {

                        tree.SetCursor (path, service_column, false);
                        SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2);

                        if (plugin.Address != null) {
                            address_entry.Sensitive = false;}

                        if (plugin.Path != null)
                            path_entry.Sensitive = false;

                        // TODO: Scroll to the selection
                        return true;

                    } else {
                        return false;
                    }
                }));

                address_entry.Changed += delegate {
                    Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
                };

                layout_address.PackStart (new Label () {
                        Markup = "<b>" + "Address:" + "</b>",
                        Xalign = 0
                    }, true, true, 0);

                layout_address.PackStart (address_entry, false, false, 0);
                layout_address.PackStart (address_example, false, false, 0);

                path_entry.Changed += delegate {
                    Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
                };

                layout_path.PackStart (new Label () {
                    Markup = "<b>" + "Remote Path:" + "</b>",
                    Xalign = 0
                }, true, true, 0);

                layout_path.PackStart (path_entry, false, false, 0);
                layout_path.PackStart (path_example, false, false, 0);

                layout_fields.PackStart (layout_address);
                layout_fields.PackStart (layout_path);

                layout_vertical.PackStart (new Label (""), false, false, 0);
                layout_vertical.PackStart (scrolled_window, true, true, 0);
                layout_vertical.PackStart (layout_fields, false, false, 0);

                Add (layout_vertical);

                Button cancel_button = new Button ("Cancel");
                Button add_button = new Button ("Add") { Sensitive = false };

                cancel_button.Clicked += delegate { Controller.PageCancelled (); };

                add_button.Clicked += delegate {
                    Controller.AddPageCompleted (address_entry.Text, path_entry.Text);
                };

                Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                    Application.Invoke (delegate {
                        add_button.Sensitive = button_enabled;
                    });
                };

                CheckButton check_button = new CheckButton ("Fetch prior history") { Active = false };
                check_button.Toggled += delegate { Controller.HistoryItemChanged (check_button.Active); };

                AddOption (check_button);
                AddButton (cancel_button);
                AddButton (add_button);

                Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
            }

            if (type == PageType.Invite) {
                Header      = "You've received an invite!";
                Description = "Do you want to add this project to SparkleShare?";

                Table table = new Table (2, 3, true) {
                    RowSpacing    = 6,
                    ColumnSpacing = 6
                };

                Label address_label = new Label ("Address:") { Xalign = 1 };
                Label path_label = new Label ("Remote Path:") { Xalign = 1 };

                Label address_value = new Label ("<b>" + Controller.PendingInvite.Address + "</b>") {
                    UseMarkup = true,
                    Xalign    = 0
                };

                Label path_value = new Label ("<b>" + Controller.PendingInvite.RemotePath + "</b>") {
                    UseMarkup = true,
                    Xalign    = 0
                };

                table.Attach (address_label, 0, 1, 0, 1);
                table.Attach (address_value, 1, 2, 0, 1);
                table.Attach (path_label, 0, 1, 1, 2);
                table.Attach (path_value, 1, 2, 1, 2);

                VBox wrapper = new VBox (false, 9);
                wrapper.PackStart (table, true, false, 0);

                Button cancel_button = new Button ("Cancel");
                Button add_button    = new Button ("Add");

                cancel_button.Clicked += delegate { Controller.PageCancelled (); };
                add_button.Clicked += delegate { Controller.InvitePageCompleted (); };

                AddButton (cancel_button);
                AddButton (add_button);
                Add (wrapper);
            }

            if (type == PageType.Syncing) {
                Header      = String.Format ("Adding project ‘{0}’…", Controller.SyncingFolder);
                Description = "This may take a while for large projects.\nIsn't it coffee-o'clock?";

                ProgressBar progress_bar = new ProgressBar ();
                progress_bar.Fraction    = Controller.ProgressBarPercentage / 100;

                Button cancel_button = new Button () { Label = "Cancel" };
                Button finish_button = new Button ("Finish") { Sensitive = false };

                Controller.UpdateProgressBarEvent += delegate (double percentage) {
                    Application.Invoke (delegate { progress_bar.Fraction = percentage / 100; });
                };

                cancel_button.Clicked += delegate { Controller.SyncingCancelled (); };

                VBox bar_wrapper = new VBox (false, 0);
                bar_wrapper.PackStart (progress_bar, false, false, 21);

                Add (bar_wrapper);
                AddButton (cancel_button);
                AddButton (finish_button);
            }

            if (type == PageType.Error) {
                Header = "Oops! Something went wrong" + "…";

                VBox points = new VBox (false, 0);
                Image list_point_one   = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
                Image list_point_two   = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
                Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));

                Label label_one = new Label () {
                    Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " +
                    "Does this look alright?",
                    Wrap   = true,
                    Xalign = 0
                };

                Label label_two = new Label () {
                    Text   = "Is this computer's Client ID known by the host?",
                    Wrap   = true,
                    Xalign = 0
                };

                points.PackStart (new Label ("Please check the following:") { Xalign = 0 }, false, false, 6);

                HBox point_one = new HBox (false, 0);
                point_one.PackStart (list_point_one, false, false, 0);
                point_one.PackStart (label_one, true, true, 12);
                points.PackStart (point_one, false, false, 12);

                HBox point_two = new HBox (false, 0);
                point_two.PackStart (list_point_two, false, false, 0);
                point_two.PackStart (label_two, true, true, 12);
                points.PackStart (point_two, false, false, 12);

                if (warnings.Length > 0) {
                    string warnings_markup = "";

                    foreach (string warning in warnings)
                        warnings_markup += "\n<b>" + warning + "</b>";

                    Label label_three = new Label () {
                        Markup = "Here's the raw error message:" + warnings_markup,
                        Wrap   = true,
                        Xalign = 0
                    };

                    HBox point_three = new HBox (false, 0);
                    point_three.PackStart (list_point_three, false, false, 0);
                    point_three.PackStart (label_three, true, true, 12);
                    points.PackStart (point_three, false, false, 12);
                }

                points.PackStart (new Label (""), true, true, 0);

                Button cancel_button = new Button ("Cancel");
                Button try_again_button = new Button ("Try Again…") { Sensitive = true };

                cancel_button.Clicked += delegate { Controller.PageCancelled (); };
                try_again_button.Clicked += delegate { Controller.ErrorPageCompleted (); };

                AddButton (cancel_button);
                AddButton (try_again_button);
                Add (points);
            }

            if (type == PageType.CryptoSetup || type == PageType.CryptoPassword) {
                if (type == PageType.CryptoSetup) {
                    Header      = "Set up file encryption";
                    Description = "Please a provide a strong password that you don't use elsewhere below:";

                } else {
                    Header      = "This project contains encrypted files";
                    Description = "Please enter the password to see their contents.";
                }

                Label password_label = new Label ("<b>" + "Password:"******"</b>") {
                    UseMarkup = true,
                    Xalign    = 1
                };

                Entry password_entry = new Entry () {
                    Xalign = 0,
                    Visibility = false,
                    ActivatesDefault = true
                };

                CheckButton show_password_check_button = new CheckButton ("Show password") {
                    Active = false,
                    Xalign = 0,
                };

                Table table = new Table (2, 3, true) {
                    RowSpacing    = 6,
                    ColumnSpacing = 6
                };

                table.Attach (password_label, 0, 1, 0, 1);
                table.Attach (password_entry, 1, 2, 0, 1);

                table.Attach (show_password_check_button, 1, 2, 1, 2);

                VBox wrapper = new VBox (false, 9);
                wrapper.PackStart (table, true, false, 0);

                Image warning_image = new Image (
                    SparkleUIHelpers.GetIcon ("dialog-information", 24));

                Label warning_label = new Label () {
                    Xalign = 0,
                    Wrap   = true,
                    Text   = "This password can't be changed later, and your files can't be recovered if it's forgotten."
                };

                HBox warning_layout = new HBox (false, 0);
                warning_layout.PackStart (warning_image, false, false, 15);
                warning_layout.PackStart (warning_label, true, true, 0);

                VBox warning_wrapper = new VBox (false, 0);
                warning_wrapper.PackStart (warning_layout, false, false, 15);

                if (type == PageType.CryptoSetup)
                    wrapper.PackStart (warning_wrapper, false, false, 0);

                Button cancel_button = new Button ("Cancel");
                Button continue_button = new Button ("Continue") { Sensitive = false };

                Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) {
                    Application.Invoke (delegate { continue_button.Sensitive = button_enabled; });
                };

                Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) {
                    Application.Invoke (delegate { continue_button.Sensitive = button_enabled; });
                };

                show_password_check_button.Toggled += delegate {
                    password_entry.Visibility = !password_entry.Visibility;
                };

                password_entry.Changed += delegate {
                    if (type == PageType.CryptoSetup)
                        Controller.CheckCryptoSetupPage (password_entry.Text);
                    else
                        Controller.CheckCryptoPasswordPage (password_entry.Text);
                };

                cancel_button.Clicked += delegate { Controller.CryptoPageCancelled (); };

                continue_button.Clicked += delegate {
                    if (type == PageType.CryptoSetup)
                        Controller.CryptoSetupPageCompleted (password_entry.Text);
                    else
                        Controller.CryptoPasswordPageCompleted (password_entry.Text);
                };

                Add (wrapper);

                AddButton (cancel_button);
                AddButton (continue_button);
            }

            if (type == PageType.Finished) {
                Header      = "Your shared project is ready!";
                Description = "You can find it in your SparkleShare folder";

                UrgencyHint = true;

                Button show_files_button = new Button ("Show Files…");
                Button finish_button     = new Button ("Finish");

                show_files_button.Clicked += delegate { Controller.ShowFilesClicked (); };
                finish_button.Clicked += delegate { Controller.FinishPageCompleted (); };

                if (warnings.Length > 0) {
                    Image warning_image = new Image (SparkleUIHelpers.GetIcon ("dialog-information", 24));

                    Label warning_label = new Label (warnings [0]) {
                        Xalign = 0,
                        Wrap   = true
                    };

                    HBox warning_layout = new HBox (false, 0);
                    warning_layout.PackStart (warning_image, false, false, 15);
                    warning_layout.PackStart (warning_label, true, true, 0);

                    VBox warning_wrapper = new VBox (false, 0);
                    warning_wrapper.PackStart (warning_layout, false, false, 0);

                    Add (warning_wrapper);

                } else {
                    Add (null);
                }

                AddButton (show_files_button);
                AddButton (finish_button);
            }

            if (type == PageType.Tutorial) {
                switch (Controller.TutorialPageNumber) {
                case 1: {
                    Header      = "What's happening next?";
                    Description = "SparkleShare creates a special folder on your computer " +
                        "that will keep track of your projects.";

                    Button skip_tutorial_button = new Button ("Skip Tutorial");
                    Button continue_button = new Button ("Continue");

                    skip_tutorial_button.Clicked += delegate { Controller.TutorialSkipped (); };
                    continue_button.Clicked += delegate { Controller.TutorialPageCompleted (); };

                    AddButton (skip_tutorial_button);
                    AddButton (continue_button);

                    break;
                }

                case 2: {
                    Header      = "Sharing files with others";
                    Description = "All files added to your project folders are synced automatically with " +
                        "the host and your team members.";

                    Button continue_button = new Button ("Continue");
                    continue_button.Clicked += delegate { Controller.TutorialPageCompleted (); };
                    AddButton (continue_button);

                    break;
                }

                case 3: {
                    Header      = "The status icon helps you";
                    Description = "It shows the syncing progress, provides easy access to " +
                        "your projects and let's you view recent changes.";

                    Button continue_button = new Button ("Continue");
                    continue_button.Clicked += delegate { Controller.TutorialPageCompleted (); };
                    AddButton (continue_button);

                    break;
                }

                case 4: {
                    Header      = "Here's your unique client ID";
                    Description = "You'll need it whenever you want to link this computer to a host. " +
                        "You can also find it in the status icon menu.";

                    Button finish_button = new Button ("Finish");
                    VBox layout_vertical = new VBox (false, 0) { BorderWidth = 48 };
                    HBox layout_horizontal = new HBox (false, 6);

                    Entry link_code_entry = new Entry () {
                        Text      = Program.Controller.CurrentUser.PublicKey,
                        Sensitive = false
                    };

                    Button copy_button = new Button (" Copy ");

                    CheckButton check_button = new CheckButton ("Add SparkleShare to startup items");
                    check_button.Active = true;

                    copy_button.Clicked += delegate { Controller.CopyToClipboardClicked (); };
                    check_button.Toggled  += delegate { Controller.StartupItemChanged (check_button.Active); };
                    finish_button.Clicked += delegate { Controller.TutorialPageCompleted (); };

                    layout_horizontal.PackStart (link_code_entry, true, true, 0);
                    layout_horizontal.PackStart (copy_button, false, false, 0);

                    layout_vertical.PackStart (new Label (""), true, true, 0);
                    layout_vertical.PackStart (layout_horizontal, false, false, 0);
                    layout_vertical.PackStart (new Label (""), true, true, 18);

                    Add (layout_vertical);

                    AddOption (check_button);
                    AddButton (finish_button);

                    break;
                }
                }

                if (Controller.TutorialPageNumber < 4) {
                    Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-" + Controller.TutorialPageNumber + ".png");
                    Add (slide);
                }
            }
        }
コード例 #29
0
		void ChangeState (DialogState newState)
		{
			bool hasConfig = comboModel.Active == 0;

			switch (newState) {
			case DialogState.Create:
				btnBack.Visible = false;
				btnConfig.Visible = true;
				btnConfig.Sensitive = isWebService && hasConfig;
				btnOK.Visible = true;
				btnOK.Sensitive = isWebService;
				tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
				tbxReferenceName.Sensitive = isWebService;
				comboModel.Sensitive = true;
				break;

			case DialogState.CreateConfig:
				btnBack.Visible = true;
				btnBack.Sensitive = true;
				btnConfig.Visible = false;
				btnOK.Visible = true;
				btnOK.Sensitive = true;
				tlbNavigate.Visible = false;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;

			case DialogState.Modify:
				btnBack.Visible = false;
				btnConfig.Visible = true;
				btnConfig.Sensitive = isWebService && hasConfig;
				btnOK.Visible = true;
				btnOK.Sensitive = isWebService;
				tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;

			case DialogState.ModifyConfig:
				btnBack.Visible = false;
				btnConfig.Visible = false;
				btnOK.Visible = true;
				btnOK.Sensitive = true;
				tlbNavigate.Visible = false;
				tbxReferenceName.Sensitive = false;
				comboModel.Sensitive = false;
				break;
				
			default:
				throw new InvalidOperationException ();
			}

			if (wcfConfig != null)
				wcfConfig.Update ();

			if (state == newState)
				return;

			if (state != DialogState.Uninitialized)
				frmBrowser.Forall (c => frmBrowser.Remove (c));

			browser = null;
			browserWidget = null;
			docLabel = null;
			wcfConfig = null;

			state = newState;
			
			ScrolledWindow sw;

			switch (state) {
			case DialogState.Create:
			case DialogState.Modify:
				if (WebBrowserService.CanGetWebBrowser) {
					browser = WebBrowserService.GetWebBrowser ();
					browserWidget = (Widget) browser;
					browser.LocationChanged += Browser_LocationChanged;
					browser.NetStart += Browser_StartLoading;
					browser.NetStop += Browser_StopLoading;
					frmBrowser.Add (browserWidget);
					browser.LoadUrl (tbxReferenceURL.Text);
					browserWidget.Show ();
				} else {
					docLabel = new Label ();
					docLabel.Xpad = 6;
					docLabel.Ypad = 6;
					docLabel.Xalign = 0;
					docLabel.Yalign = 0;

					sw = new ScrolledWindow ();
					sw.ShadowType = ShadowType.In;
					sw.AddWithViewport (docLabel);
					sw.ShowAll ();
					frmBrowser.Add (sw);
					UpdateLocation ();
				}
				break;

			case DialogState.ModifyConfig:
			case DialogState.CreateConfig:
				if (!hasConfig)
					return;

				sw = new ScrolledWindow ();
				sw.ShadowType = ShadowType.In;

				wcfConfig = new WCFConfigWidget (wcfOptions);
				sw.AddWithViewport (wcfConfig);
				sw.ShowAll ();
				frmBrowser.Add (sw);
				break;

			default:
				throw new InvalidOperationException ();
			}
		}
コード例 #30
0
ファイル: browser.cs プロジェクト: remobjects/mono-tools
	// Initianlizes the search index
	void CreateSearchPanel ()
	{
		//get the search index
		if (search_index == null) {
			search_index = help_tree.GetSearchIndex();
			//restore widgets
			search_vbox.Remove (ppanel);
		}
		//
		// Create the search panel
		//
		VBox vbox1 = new VBox (false, 0);
		search_vbox.PackStart (vbox1);
		
		// title
		HBox hbox1 = new HBox (false, 3);
		hbox1.BorderWidth = 3;
		Image icon = new Image (Stock.Find, IconSize.Menu);
		Label look_for_label = new Label ("Search for:");
		look_for_label.Justify = Justification.Left;
		look_for_label.Xalign = 0;
		hbox1.PackEnd (look_for_label, true, true, 0);
		hbox1.PackEnd (icon, false, true, 0);
		hbox1.ShowAll ();
		vbox1.PackStart (hbox1, false, true, 0);

		// entry
		search_term = new Entry ();
		search_term.Activated += OnSearchActivated;
		vbox1.PackStart (search_term, false, true, 0);
		
		// treeview
		ScrolledWindow scrolledwindow_search = new ScrolledWindow ();
		scrolledwindow_search.HscrollbarPolicy = PolicyType.Automatic;
		scrolledwindow_search.VscrollbarPolicy = PolicyType.Always;
		vbox1.PackStart (scrolledwindow_search, true, true, 0);
		search_tree = new TreeView ();
		search_tree.HeadersVisible = false;
		scrolledwindow_search.AddWithViewport (search_tree);
		
		//prepare the treeview
		search_store = new TreeStore (typeof (string));
		search_tree.Model = search_store;
		search_tree.AppendColumn ("Searches", new CellRendererText(), "text", 0);
		search_tree.Selection.Changed += new EventHandler (ShowSearchResult);
		search_tree.FocusOutEvent += new FocusOutEventHandler(LostFocus);

		vbox1.ShowAll ();
		search_vbox.ShowAll ();
	}	
コード例 #31
0
ファイル: DetailsView.cs プロジェクト: thoja21/banshee-1
        private void BuildInfoBox()
        {
            var frame = new Hyena.Widgets.RoundedFrame();
            var vbox  = new VBox();

            vbox.Spacing     = 6;
            vbox.BorderWidth = 2;

            // Description
            var desc = new Hyena.Widgets.WrapLabel()
            {
                Markup = String.Format("{0}", GLib.Markup.EscapeText(Hyena.StringUtil.RemoveHtml(details.Description)))
            };

            var desc_expander = CreateSection(Catalog.GetString("Description"), desc);

            // Details
            var table = new Banshee.Gui.TrackEditor.StatisticsPage()
            {
                ShadowType  = ShadowType.None,
                BorderWidth = 0
            };

            table.NameRenderer.Scale  = Pango.Scale.Medium;
            table.ValueRenderer.Scale = Pango.Scale.Medium;

            // Keep the table from needing to vertically scroll

            /*table.Child.SizeRequested += (o, a) => {
             *  table.SetSizeRequest (a.Requisition.Width, a.Requisition.Height);
             * };*/

            AddToTable(table, Catalog.GetString("Creator:"), details.Creator);
            AddToTable(table, Catalog.GetString("Venue:"), details.Venue);
            AddToTable(table, Catalog.GetString("Location:"), details.Coverage);
            if (details.DateCreated != DateTime.MinValue)
            {
                AddToTable(table, Catalog.GetString("Date:"), details.DateCreated);
            }
            else
            {
                AddToTable(table, Catalog.GetString("Year:"), details.Year);
            }
            AddToTable(table, Catalog.GetString("Publisher:"), details.Publisher);
            AddToTable(table, Catalog.GetString("Keywords:"), details.Subject);
            AddToTable(table, Catalog.GetString("License URL:"), details.LicenseUrl);
            AddToTable(table, Catalog.GetString("Language:"), details.Language);

            table.AddSeparator();

            AddToTable(table, Catalog.GetString("Downloads, overall:"), details.DownloadsAllTime);
            AddToTable(table, Catalog.GetString("Downloads, past month:"), details.DownloadsLastMonth);
            AddToTable(table, Catalog.GetString("Downloads, past week:"), details.DownloadsLastWeek);

            table.AddSeparator();

            AddToTable(table, Catalog.GetString("Added:"), details.DateAdded);
            AddToTable(table, Catalog.GetString("Added by:"), details.AddedBy);
            AddToTable(table, Catalog.GetString("Collections:"), details.Collections);
            AddToTable(table, Catalog.GetString("Source:"), details.Source);
            AddToTable(table, Catalog.GetString("Contributor:"), details.Contributor);
            AddToTable(table, Catalog.GetString("Recorded by:"), details.Taper);
            AddToTable(table, Catalog.GetString("Lineage:"), details.Lineage);
            AddToTable(table, Catalog.GetString("Transferred by:"), details.Transferer);

            var details_expander = CreateSection(Catalog.GetString("Details"), table);

            // Reviews
            Section reviews = null;

            if (details.NumReviews > 0)
            {
                string [] stars =
                {
                    "\u2606\u2606\u2606\u2606\u2606",
                    "\u2605\u2606\u2606\u2606\u2606",
                    "\u2605\u2605\u2606\u2606\u2606",
                    "\u2605\u2605\u2605\u2606\u2606",
                    "\u2605\u2605\u2605\u2605\u2606",
                    "\u2605\u2605\u2605\u2605\u2605"
                };

                var reviews_box = new VBox()
                {
                    Spacing = 12, BorderWidth = 0
                };
                reviews = CreateSection(Catalog.GetString("Reviews"), reviews_box);

                var avg_label = new Label(String.Format(Catalog.GetPluralString(
                                                            // Translators: {0} is the number of reviewers, {1} is the average rating (not really relevant if there's only 1)
                                                            "{0} reviewer", "{0} reviewers, avg {1}", details.NumReviews),
                                                        details.NumReviews, stars[Math.Max(0, Math.Min(5, (int)Math.Round(details.AvgRating)))]
                                                        ));
                avg_label.TooltipText = String.Format("{0:N2}", details.AvgRating);
                avg_label.Xalign      = 1.0f;
                reviews.Header.Box.PackEnd(avg_label, false, false, 0);

                var sb = new System.Text.StringBuilder();
                foreach (var review in details.Reviews)
                {
                    //sb.Append ("<small>");

                    var review_txt = new Hyena.Widgets.WrapLabel();

                    var title = review.Title;
                    if (title != null)
                    {
                        sb.AppendFormat("<b>{0}</b>\n", GLib.Markup.EscapeText(title));
                    }

                    // Translators: {0} is the unicode-stars-rating, {1} is the name of a person who reviewed this item, and {1} is a date/time string
                    sb.AppendFormat(Catalog.GetString("{0} by {1} on {2}"),
                                    stars[Math.Max(0, Math.Min(5, review.Stars))],
                                    GLib.Markup.EscapeText(review.Reviewer),
                                    GLib.Markup.EscapeText(review.DateReviewed.ToLocalTime().ToShortDateString())
                                    );

                    var body = review.Body;
                    if (body != null)
                    {
                        body = body.Replace("\r\n", "\n");
                        body = body.Replace("\n\n", "\n");
                        sb.Append("\n");
                        sb.Append(GLib.Markup.EscapeText(body));
                    }

                    //sb.Append ("</small>");
                    review_txt.Markup = sb.ToString();
                    sb.Length         = 0;

                    reviews_box.PackStart(review_txt, false, false, 0);
                }
            }

            // Packing
            vbox.PackStart(desc_expander, true, true, 0);
            vbox.PackStart(details_expander, true, true, 0);
            if (reviews != null)
            {
                vbox.PackStart(reviews, true, true, 0);
            }

            string write_review_url    = String.Format("http://www.archive.org/write-review.php?identifier={0}", item.Id);
            var    write_review_button = new LinkButton(write_review_url, Catalog.GetString("Write your own review"));

            write_review_button.Clicked += (o, a) => Banshee.Web.Browser.Open(write_review_url);
            write_review_button.Xalign   = 0f;
            vbox.PackStart(write_review_button, false, false, 0);

            var vbox2 = new VBox();

            vbox2.PackStart(vbox, false, false, 0);

            var sw = new Gtk.ScrolledWindow()
            {
                ShadowType = ShadowType.None
            };

            sw.AddWithViewport(vbox2);
            (sw.Child as Viewport).ShadowType = ShadowType.None;
            frame.Child = sw;
            frame.ShowAll();

            sw.Child.OverrideBackgroundColor(StateFlags.Normal, StyleContext.GetBackgroundColor(StateFlags.Normal));
            sw.Child.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal));
            StyleUpdated += delegate {
                sw.Child.OverrideBackgroundColor(StateFlags.Normal, StyleContext.GetBackgroundColor(StateFlags.Normal));
                sw.Child.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal));
            };

            PackStart(frame, true, true, 0);
        }
コード例 #32
0
        public SelectImageDialog(Gtk.Window parent, Stetic.IProject project)
        {
            this.parent  = parent;
            this.project = project;
            Glade.XML xml = new Glade.XML(null, "stetic.glade", "SelectImageDialog", null);
            xml.Autoconnect(this);

            // Stock icon list

            iconList = new ThemedIconList();
            iconList.SelectionChanged += new EventHandler(OnIconSelectionChanged);
            iconScrolledwindow.AddWithViewport(iconList);

            // Icon Sizes

            foreach (IconSize s in Enum.GetValues(typeof(Gtk.IconSize)))
            {
                if (s != IconSize.Invalid)
                {
                    iconSizeCombo.AppendText(s.ToString());
                }
            }
            iconSizeCombo.Active = 0;

            // Resource list

            resourceListStore  = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string));
            resourceList.Model = resourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf();
            pr.Xpad = 3;
            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText();
            col.PackStart(crt, true);
            col.AddAttribute(crt, "markup", 1);

            resourceList.AppendColumn(col);
            resourceProvider = project.ResourceProvider;
            if (resourceProvider == null)
            {
                buttonAdd.Sensitive    = false;
                buttonRemove.Sensitive = false;
            }
            FillResources();
            resourceList.Selection.Changed += OnResourceSelectionChanged;

            if (project.FolderName != null)
            {
                fileChooser.SetCurrentFolder(project.ImagesRootPath);
            }

            fileChooser.SelectionChanged += delegate(object s, EventArgs a) {
                UpdateButtons();
            };

            fileChooser.FileActivated += delegate(object s, EventArgs a) {
                if (Icon != null)
                {
                    if (Validate())
                    {
                        dialog.Respond(Gtk.ResponseType.Ok);
                    }
                }
            };

            okButton.Clicked += OnOkClicked;

            UpdateButtons();
        }
コード例 #33
0
ファイル: NoNoiseHelpDialog.cs プロジェクト: h0rm/No.Noise
 private void AddHelpPage (Notebook notebook, string title, string text)
 {
     VBox box = new VBox ();
     TextView tv = new TextView ();
     tv.Editable = false;
     tv.CursorVisible = false;
     TextBuffer tb = new TextBuffer (new TextTagTable ());
     tb.Text = AddinManager.CurrentLocalizer.GetString (text);
     tv.Buffer = tb;
     tv.WrapMode = WrapMode.Word;
     ScrolledWindow sw = new ScrolledWindow ();
     sw.AddWithViewport (tv);
     sw.SetSizeRequest (520, 380);
     box.PackStart (sw, true, true, 5);
     notebook.AppendPage (box, new Label (AddinManager.CurrentLocalizer.GetString (title)));
 }
コード例 #34
0
ファイル: BookmarkView.cs プロジェクト: alvinc-git/pdfmod
        // Widget construction utility methods

        void BuildTreeView()
        {
            // outline, expanded/opened, title, page # destination, tooltip
            model = new TreeStore(typeof(PdfSharp.Pdf.PdfOutline), typeof(bool), typeof(string), typeof(int), typeof(string));

            tree_view = new BookmarkTreeView()
            {
                App             = app,
                Model           = model,
                SearchColumn    = (int)ModelColumns.Title,
                TooltipColumn   = (int)ModelColumns.Tooltip,
                EnableSearch    = true,
                EnableTreeLines = true,
                HeadersVisible  = false,
                Reorderable     = false,
                ShowExpanders   = true
            };
            tree_view.Selection.Mode = SelectionMode.Multiple;

            var title = new CellRendererText()
            {
                Editable  = true,
                Ellipsize = Pango.EllipsizeMode.End
            };

            title.Edited += delegate(object o, EditedArgs args) {
                TreeIter iter;
                if (model.GetIterFromString(out iter, args.Path))
                {
                    if (!String.IsNullOrEmpty(args.NewText))
                    {
                        var    bookmark = GetOutline(iter);
                        string new_name = args.NewText;
                        string old_name = bookmark.Title;
                        var    action   = new DelegateAction(document)
                        {
                            Description = Catalog.GetString("Rename Bookmark"),
                            UndoAction  = delegate {
                                var i = IterForBookmark(bookmark);
                                bookmark.Title = old_name;
                                model.SetValue(i, (int)ModelColumns.Title, bookmark.Title);
                                RemoveModifiedMark();
                            },
                            RedoAction = delegate {
                                var i = IterForBookmark(bookmark);
                                bookmark.Title = new_name;
                                model.SetValue(i, (int)ModelColumns.Title, bookmark.Title);
                                MarkModified();
                            }
                        };
                        action.Do();
                        app.Actions.UndoManager.AddUndoAction(action);
                    }
                    else
                    {
                        args.RetVal = false;
                    }
                }
            };
            var title_col = tree_view.AppendColumn("", title, "text", ModelColumns.Title);

            title_col.Expand = true;

            var page = new CellRendererText()
            {
                Editable = true,
                Style    = Pango.Style.Italic
            };

            page.Edited += delegate(object o, EditedArgs args) {
                TreeIter iter;
                if (model.GetIterFromString(out iter, args.Path))
                {
                    var bookmark = GetOutline(iter);
                    int i        = -1;
                    if (Int32.TryParse(args.NewText, out i) && i >= 1 && i <= document.Count && i != (GetDestIndex(bookmark) + 1))
                    {
                        int old_dest = GetDestIndex(bookmark);
                        int new_dest = i - 1;

                        var action = new DelegateAction(document)
                        {
                            Description = Catalog.GetString("Rename Bookmark"),
                            UndoAction  = delegate {
                                SetDestIndex(bookmark, old_dest);
                                model.SetValue(iter, (int)ModelColumns.PageNumber, old_dest + 1);
                                RemoveModifiedMark();
                            },
                            RedoAction = delegate {
                                SetDestIndex(bookmark, new_dest);
                                model.SetValue(iter, (int)ModelColumns.PageNumber, new_dest + 1);
                                MarkModified();
                            }
                        };
                        action.Do();
                        app.Actions.UndoManager.AddUndoAction(action);
                    }
                    else
                    {
                        args.RetVal = false;
                    }
                }
            };
            var num_col = tree_view.AppendColumn("", page, "text", ModelColumns.PageNumber);

            num_col.Alignment = 1.0f;
            num_col.Expand    = false;

            var label = new Label(Catalog.GetString("_Bookmarks"))
            {
                Xalign = 0f, MnemonicWidget = tree_view
            };

            PackStart(label, false, false, 0);

            var sw = new Gtk.ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never,
                VscrollbarPolicy = PolicyType.Automatic
            };

            sw.AddWithViewport(tree_view);
            PackStart(sw, true, true, 0);
        }
コード例 #35
0
ファイル: Window.cs プロジェクト: 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();
            }
        }
コード例 #36
0
    public static void Main(string [] args)
    {
        if (args.Length <= 0)
        {
            Console.WriteLine("\nUSAGE: ImageViewer.exe <filename>\n");
            return;
        }

        string filename = args [0];

        Application.Init();
        window = new Gtk.Window("Image Viewer");
        window.SetDefaultSize(200, 200);

        window.DeleteEvent += new EventHandler(Window_Delete);

        Gtk.ScrolledWindow scrolled_window = new Gtk.ScrolledWindow(new Adjustment(IntPtr.Zero), new Adjustment(IntPtr.Zero));

        Gtk.VBox vbox    = new VBox(false, 2);
        Gtk.VBox menubox = new VBox(false, 0);

        // Pack menubar
        MenuBar mb = new MenuBar();

        Menu     file_menu = new Menu();
        MenuItem exit_item = new ImageMenuItem("gtk-close", new Gtk.AccelGroup(IntPtr.Zero));
        MenuItem open_item = new ImageMenuItem("gtk-open", new Gtk.AccelGroup(IntPtr.Zero));

        exit_item.Activated += new EventHandler(Window_Delete);
        open_item.Activated += new EventHandler(Window_Open);

        file_menu.Append(open_item);
        file_menu.Append(new Gtk.SeparatorMenuItem());
        file_menu.Append(exit_item);
        MenuItem file_item = new MenuItem("_File");

        file_item.Submenu = file_menu;

        mb.Append(file_item);
        menubox.PackStart(mb, false, false, 0);

        // Pack toolbar
        Gtk.Toolbar toolbar = new Gtk.Toolbar();
        toolbar.InsertStock("gtk-open", "Open", String.Empty, new Gtk.SignalFunc(Window_Open), IntPtr.Zero, 0);
        toolbar.InsertStock("gtk-close", "Close", String.Empty, new Gtk.SignalFunc(Window_Delete), IntPtr.Zero, 1);
        menubox.PackStart(toolbar, false, false, 0);
        vbox.PackStart(menubox, false, false, 0);

        Pixbuf pix = GetPixbufFromFile(filename);

        image = new Image(pix);

        Refresh(filename, pix);

        scrolled_window.AddWithViewport(image);
        vbox.PackStart(scrolled_window, true, true, 0);

        scrolled_window.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
        window.Add(vbox);
        window.ShowAll();

        Application.Run();
    }
コード例 #37
0
        public SparkleSetup()
            : base()
        {
            Controller.HideWindowEvent += delegate {
                Application.Invoke (delegate {
                    HideAll ();
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke (delegate {
                    ShowAll ();
                    Present ();
                });
            };

            Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
                Application.Invoke (delegate {
                    Reset ();

                    switch (type) {
                    case PageType.Setup: {

                        Header = _("Welcome to SparkleShare!");
                        Description  = "First off, what's your name and email?\nThis information is only visible to team members.";

                        Table table = new Table (2, 3, true) {
                            RowSpacing    = 6,
                            ColumnSpacing = 6
                        };

                            Label name_label = new Label ("<b>" + _("Full Name:") + "</b>") {
                                UseMarkup = true,
                                Xalign    = 1
                            };

                            Entry name_entry = new Entry (Controller.GuessedUserName) {
                                Xalign = 0,
                                ActivatesDefault = true
                            };

                            Entry email_entry = new Entry (Controller.GuessedUserEmail) {
                                Xalign = 0,
                                ActivatesDefault = true
                            };

                            name_entry.Changed += delegate {
                                Controller.CheckSetupPage (name_entry.Text, email_entry.Text);
                            };

                            email_entry.Changed += delegate {
                                Controller.CheckSetupPage (name_entry.Text, email_entry.Text);
                            };

                            Label email_label = new Label ("<b>" + _("Email:") + "</b>") {
                                UseMarkup = true,
                                Xalign    = 1
                            };

                        table.Attach (name_label, 0, 1, 0, 1);
                        table.Attach (name_entry, 1, 2, 0, 1);
                        table.Attach (email_label, 0, 1, 1, 2);
                        table.Attach (email_entry, 1, 2, 1, 2);

                        VBox wrapper = new VBox (false, 9);
                        wrapper.PackStart (table, true, false, 0);

                            Button cancel_button = new Button (_("Cancel"));

                            cancel_button.Clicked += delegate {
                                Controller.SetupPageCancelled ();
                            };

                            Button continue_button = new Button (_("Continue")) {
                                Sensitive = false
                            };

                            continue_button.Clicked += delegate (object o, EventArgs args) {
                                string full_name = name_entry.Text;
                                string email     = email_entry.Text;

                                Controller.SetupPageCompleted (full_name, email);
                            };

                        AddButton (cancel_button);
                        AddButton (continue_button);
                        Add (wrapper);

                        Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) {
                            Application.Invoke (delegate {
                                continue_button.Sensitive = button_enabled;
                            });
                        };

                        Controller.CheckSetupPage (name_entry.Text, email_entry.Text);

                        break;
                    }

                    case PageType.Add: {

                        Header = _("Where's your project hosted?");

                        VBox layout_vertical = new VBox (false, 12);
                        HBox layout_fields   = new HBox (true, 12);
                        VBox layout_address  = new VBox (true, 0);
                        VBox layout_path     = new VBox (true, 0);

                        ListStore store = new ListStore (typeof (Gdk.Pixbuf),
                            typeof (string), typeof (SparklePlugin));

                        SparkleTreeView tree = new SparkleTreeView (store) { HeadersVisible = false };
                        ScrolledWindow scrolled_window = new ScrolledWindow ();
                        scrolled_window.AddWithViewport (tree);

                        // Icon column
                        tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
                        tree.Columns [0].Cells [0].Xpad = 6;

                        // Service column
                        TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" };
                        CellRendererText service_cell = new CellRendererText () { Ypad = 4 };
                        service_column.PackStart (service_cell, true);
                        service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));

                        foreach (SparklePlugin plugin in Controller.Plugins) {
                            store.AppendValues (
                                new Gdk.Pixbuf (plugin.ImagePath),
                                "<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
                                  "<span fgcolor=\"" + SecondaryTextColorSelected + "\">" +
                                  plugin.Description + "</span>" +
                                "</span>",
                                plugin);
                        }

                        tree.AppendColumn (service_column);

                        Entry address_entry = new Entry () {
                            Text = Controller.PreviousAddress,
                            Sensitive = (Controller.SelectedPlugin.Address == null),
                            ActivatesDefault = true
                        };

                        Entry path_entry = new Entry () {
                            Text = Controller.PreviousPath,
                            Sensitive = (Controller.SelectedPlugin.Path == null),
                            ActivatesDefault = true
                        };

                        Label address_example = new Label () {
                            Xalign = 0,
                            UseMarkup = true,
                            Markup = "<span size=\"small\" fgcolor=\"" +
                                SecondaryTextColor + "\">" + Controller.SelectedPlugin.AddressExample + "</span>"
                        };

                        Label path_example = new Label () {
                            Xalign = 0,
                            UseMarkup = true,
                            Markup = "<span size=\"small\" fgcolor=\"" +
                                SecondaryTextColor + "\">" + Controller.SelectedPlugin.PathExample + "</span>"
                        };

                        // Select the first plugin by default
                        TreeSelection default_selection = tree.Selection;
                        TreePath default_path = new TreePath ("0");
                        default_selection.SelectPath (default_path);
                        Controller.SelectedPluginChanged (0);

                        Controller.ChangeAddressFieldEvent += delegate (string text,
                            string example_text, FieldState state) {

                            Application.Invoke (delegate {
                                address_entry.Text      = text;
                                address_entry.Sensitive = (state == FieldState.Enabled);
                                address_example.Markup  =  "<span size=\"small\" fgcolor=\"" +
                                    SecondaryTextColor + "\">" + example_text + "</span>";
                            });
                        };

                        Controller.ChangePathFieldEvent += delegate (string text,
                            string example_text, FieldState state) {

                            Application.Invoke (delegate {
                                path_entry.Text      = text;
                                path_entry.Sensitive = (state == FieldState.Enabled);
                                path_example.Markup  =  "<span size=\"small\" fgcolor=\""
                                    + SecondaryTextColor + "\">" + example_text + "</span>";
                            });
                        };

                        Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);

                        // Update the address field text when the selection changes
                        tree.CursorChanged += delegate (object sender, EventArgs e) {
                            Controller.SelectedPluginChanged (tree.SelectedRow);
                            // TODO: Scroll to selected row when using arrow keys
                        };

                        tree.Model.Foreach (new TreeModelForeachFunc (delegate (TreeModel model,
                            TreePath path, TreeIter iter) {

                            string address;

                            try {
                                address = (model.GetValue (iter, 2) as SparklePlugin).Address;

                            } catch (NullReferenceException) {
                                address = "";
                            }

                            if (!string.IsNullOrEmpty (address) &&
                                address.Equals (Controller.PreviousAddress)) {

                                tree.SetCursor (path, service_column, false);
                                SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2);

                                if (plugin.Address != null) {
                                    address_entry.Sensitive = false;}

                                if (plugin.Path != null)
                                    path_entry.Sensitive = false;

                                // TODO: Scroll to the selection

                                return true;
                            } else {
                                return false;
                            }
                        }));

                        address_entry.Changed += delegate {
                            Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
                        };

                                layout_address.PackStart (new Label () {
                                        Markup = "<b>" + _("Address:") + "</b>",
                                        Xalign = 0
                                    }, true, true, 0);

                                layout_address.PackStart (address_entry, false, false, 0);
                                layout_address.PackStart (address_example, false, false, 0);

                                    path_entry.Changed += delegate {
                                        Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
                                    };

                                layout_path.PackStart (new Label () {
                                        Markup = "<b>" + _("Remote Path:") + "</b>",
                                        Xalign = 0
                                    }, true, true, 0);

                                layout_path.PackStart (path_entry, false, false, 0);
                                layout_path.PackStart (path_example, false, false, 0);

                            layout_fields.PackStart (layout_address);
                            layout_fields.PackStart (layout_path);

                        layout_vertical.PackStart (new Label (""), false, false, 0);
                        layout_vertical.PackStart (scrolled_window, true, true, 0);
                        layout_vertical.PackStart (layout_fields, false, false, 0);

                        Add (layout_vertical);

                            // Cancel button
                            Button cancel_button = new Button (_("Cancel"));

                            cancel_button.Clicked += delegate {
                                Controller.PageCancelled ();
                            };

                            Button add_button = new Button (_("Add")) {
                                Sensitive = false
                            };

                            add_button.Clicked += delegate {
                                string server         = address_entry.Text;
                                string folder_name    = path_entry.Text;

                                Controller.AddPageCompleted (server, folder_name);
                            };

                        Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                            Application.Invoke (delegate {
                                add_button.Sensitive = button_enabled;
                            });
                        };

                        CheckButton check_button = new CheckButton ("Fetch prior history") {
                            Active = false
                        };

                        check_button.Toggled += delegate {
                            Controller.HistoryItemChanged (check_button.Active);
                        };

                        AddOption (check_button);
                        AddButton (cancel_button);
                        AddButton (add_button);

                        Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);

                        break;
                    }

                    case PageType.Invite: {

                        Header      = _("You've received an invite!");
                        Description = _("Do you want to add this project to SparkleShare?");

                        Table table = new Table (2, 3, true) {
                            RowSpacing    = 6,
                            ColumnSpacing = 6
                        };

                            Label address_label = new Label (_("Address:")) {
                                Xalign    = 1
                            };

                            Label path_label = new Label (_("Remote Path:")) {
                                Xalign    = 1
                            };

                            Label address_value = new Label ("<b>" + Controller.PendingInvite.Address + "</b>") {
                                UseMarkup = true,
                                Xalign    = 0
                            };

                            Label path_value = new Label ("<b>" + Controller.PendingInvite.RemotePath + "</b>") {
                                UseMarkup = true,
                                Xalign    = 0
                            };

                        table.Attach (address_label, 0, 1, 0, 1);
                        table.Attach (address_value, 1, 2, 0, 1);
                        table.Attach (path_label, 0, 1, 1, 2);
                        table.Attach (path_value, 1, 2, 1, 2);

                        VBox wrapper = new VBox (false, 9);
                        wrapper.PackStart (table, true, false, 0);

                            Button cancel_button = new Button (_("Cancel"));

                            cancel_button.Clicked += delegate {
                                Controller.PageCancelled ();
                            };

                            Button add_button = new Button (_("Add"));

                            add_button.Clicked += delegate {
                                Controller.InvitePageCompleted ();
                            };

                        AddButton (cancel_button);
                        AddButton (add_button);
                        Add (wrapper);

                        break;
                    }

                    case PageType.Syncing: {

                        Header      = String.Format (_("Adding project ‘{0}’…"), Controller.SyncingFolder);
                        Description = _("This may either take a short or a long time depending on the project's size.");

                        this.progress_bar.Fraction = Controller.ProgressBarPercentage / 100;

                        Button finish_button = new Button () {
                            Sensitive = false,
                            Label = _("Finish")
                        };

                        Button cancel_button = new Button () {
                            Label = _("Cancel")
                        };

                        cancel_button.Clicked += delegate {
                            Controller.SyncingCancelled ();
                        };

                        AddButton (cancel_button);
                        AddButton (finish_button);

                        Controller.UpdateProgressBarEvent += delegate (double percentage) {
                            Application.Invoke (delegate {
                                this.progress_bar.Fraction = percentage / 100;
                            });
                        };

                        if (this.progress_bar.Parent != null)
                           (this.progress_bar.Parent as Container).Remove (this.progress_bar);

                        VBox bar_wrapper = new VBox (false, 0);
                        bar_wrapper.PackStart (this.progress_bar, false, false, 15);

                        Add (bar_wrapper);

                        break;
                    }

                    case PageType.Error: {

                        Header = _("Oops! Something went wrong") + "…";

                        VBox points = new VBox (false, 0);
                        Image list_point_one   = new Image (SparkleUIHelpers.GetIcon ("go-next", 16));
                        Image list_point_two   = new Image (SparkleUIHelpers.GetIcon ("go-next", 16));
                        Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("go-next", 16));

                        Label label_one = new Label () {
                            Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " +
                            "Does this look alright?",
                            Wrap   = true,
                            Xalign = 0
                        };

                        Label label_two = new Label () {
                            Text   = "Do you have access rights to this remote project?",
                            Wrap   = true,
                            Xalign = 0
                        };

                        points.PackStart (new Label ("Please check the following:") { Xalign = 0 }, false, false, 6);

                        HBox point_one = new HBox (false, 0);
                        point_one.PackStart (list_point_one, false, false, 0);
                        point_one.PackStart (label_one, true, true, 12);
                        points.PackStart (point_one, false, false, 12);

                        HBox point_two = new HBox (false, 0);
                        point_two.PackStart (list_point_two, false, false, 0);
                        point_two.PackStart (label_two, true, true, 12);
                        points.PackStart (point_two, false, false, 12);

                        if (warnings.Length > 0) {
                            string warnings_markup = "";

                            foreach (string warning in warnings)
                                warnings_markup += "\n<b>" + warning + "</b>";

                            Label label_three = new Label () {
                                Markup = "Here's the raw error message:" + warnings_markup,
                                Wrap   = true,
                                Xalign = 0
                            };

                            HBox point_three = new HBox (false, 0);
                            point_three.PackStart (list_point_three, false, false, 0);
                            point_three.PackStart (label_three, true, true, 12);
                            points.PackStart (point_three, false, false, 12);
                        }

                        points.PackStart (new Label (""), true, true, 0);

                        Button cancel_button = new Button (_("Cancel"));

                            cancel_button.Clicked += delegate {
                                Controller.PageCancelled ();
                            };

                        Button try_again_button = new Button (_("Try Again…")) {
                            Sensitive = true
                        };

                        try_again_button.Clicked += delegate {
                            Controller.ErrorPageCompleted ();
                        };

                        AddButton (cancel_button);
                        AddButton (try_again_button);
                        Add (points);

                        break;
                    }

                    case PageType.CryptoSetup: {

                        Header       = "Set up file encryption";
                        Description  = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide one below.";

                        Label password_label = new Label ("<b>" + _("Password:"******"</b>") {
                            UseMarkup = true,
                            Xalign    = 1
                        };

                        Entry password_entry = new Entry () {
                            Xalign = 0,
                            Visibility = false,
                            ActivatesDefault = true
                        };

                        CheckButton show_password_check_button = new CheckButton ("Show password") {
                            Active = false,
                            Xalign = 0,
                        };

                        show_password_check_button.Toggled += delegate {
                            password_entry.Visibility = !password_entry.Visibility;
                        };

                        password_entry.Changed += delegate {
                            Controller.CheckCryptoSetupPage (password_entry.Text);
                        };

                        Button continue_button = new Button ("Continue") {
                            Sensitive = false
                        };

                        continue_button.Clicked += delegate {
                           Controller.CryptoSetupPageCompleted (password_entry.Text);
                        };

                        Button cancel_button = new Button ("Cancel");

                        cancel_button.Clicked += delegate {
                            Controller.CryptoPageCancelled ();
                        };

                        Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) {
                            Application.Invoke (delegate {
                                continue_button.Sensitive = button_enabled;
                            });
                        };

                        Table table = new Table (2, 3, true) {
                            RowSpacing    = 6,
                            ColumnSpacing = 6
                        };

                        table.Attach (password_label, 0, 1, 0, 1);
                        table.Attach (password_entry, 1, 2, 0, 1);

                        table.Attach (show_password_check_button, 1, 2, 1, 2);

                        VBox wrapper = new VBox (false, 9);
                        wrapper.PackStart (table, true, false, 0);

                        Image warning_image = new Image (
                            SparkleUIHelpers.GetIcon ("dialog-information", 24)
                        );

                        Label warning_label = new Label () {
                            Xalign = 0,
                            Wrap   = true,
                            Text   = "This password can't be changed later, and your files can't be recovered if it's forgotten."
                        };

                        HBox warning_layout = new HBox (false, 0);
                        warning_layout.PackStart (warning_image, false, false, 15);
                        warning_layout.PackStart (warning_label, true, true, 0);

                        VBox warning_wrapper = new VBox (false, 0);
                        warning_wrapper.PackStart (warning_layout, false, false, 15);

                        wrapper.PackStart (warning_wrapper, false, false, 0);

                        Add (wrapper);

                        AddButton (cancel_button);
                        AddButton (continue_button);

                        break;
                    }

                    case PageType.CryptoPassword: {

                        Header       = "This project contains encrypted files";
                        Description  = "Please enter the password to see their contents.";

                        Label password_label = new Label ("<b>" + _("Password:"******"</b>") {
                            UseMarkup = true,
                            Xalign    = 1
                        };

                        Entry password_entry = new Entry () {
                            Xalign = 0,
                            Visibility = false,
                            ActivatesDefault = true
                        };

                        CheckButton show_password_check_button = new CheckButton ("Show password") {
                            Active = false,
                            Xalign = 0
                        };

                        show_password_check_button.Toggled += delegate {
                            password_entry.Visibility = !password_entry.Visibility;
                        };

                        password_entry.Changed += delegate {
                            Controller.CheckCryptoPasswordPage (password_entry.Text);
                        };

                        Button continue_button = new Button ("Continue") {
                            Sensitive = false
                        };

                        continue_button.Clicked += delegate {
                           Controller.CryptoPasswordPageCompleted (password_entry.Text);
                        };

                        Button cancel_button = new Button ("Cancel");

                        cancel_button.Clicked += delegate {
                            Controller.CryptoPageCancelled ();
                        };

                        Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) {
                            Application.Invoke (delegate {
                                continue_button.Sensitive = button_enabled;
                            });
                        };

                        Table table = new Table (2, 3, true) {
                            RowSpacing    = 6,
                            ColumnSpacing = 6
                        };

                        table.Attach (password_label, 0, 1, 0, 1);
                        table.Attach (password_entry, 1, 2, 0, 1);

                        table.Attach (show_password_check_button, 1, 2, 1, 2);

                        VBox wrapper = new VBox (false, 9);
                        wrapper.PackStart (table, true, false, 0);

                        Add (wrapper);

                        AddButton (cancel_button);
                        AddButton (continue_button);

                        break;
                    }

                    case PageType.Finished: {

                        UrgencyHint = true;

                        if (!HasToplevelFocus) {
                            string title   = _("Your shared project is ready!");
                            string subtext = _("You can find the files in your SparkleShare folder.");

                            SparkleUI.Bubbles.Controller.ShowBubble (title, subtext, null);
                        }

                        Header      = _("Your shared project is ready!");
                        Description = _("You can find it in your SparkleShare folder");

                        // A button that opens the synced folder
                        Button open_folder_button = new Button (string.Format ("Open {0}", System.IO.Path.GetFileName (Controller.PreviousPath)));

                        open_folder_button.Clicked += delegate {
                            Controller.OpenFolderClicked ();
                        };

                        Button finish_button = new Button (_("Finish"));

                        finish_button.Clicked += delegate {
                            Controller.FinishPageCompleted ();
                        };

                        if (warnings.Length > 0) {
                            Image warning_image = new Image (
                                SparkleUIHelpers.GetIcon ("dialog-information", 24)
                            );

                            Label warning_label = new Label (warnings [0]) {
                                Xalign = 0,
                                Wrap   = true
                            };

                            HBox warning_layout = new HBox (false, 0);
                            warning_layout.PackStart (warning_image, false, false, 15);
                            warning_layout.PackStart (warning_label, true, true, 0);

                            VBox warning_wrapper = new VBox (false, 0);
                            warning_wrapper.PackStart (warning_layout, false, false, 0);

                            Add (warning_wrapper);

                        } else {
                            Add (null);
                        }

                        AddButton (open_folder_button);
                        AddButton (finish_button);

                        break;
                    }

                    case PageType.Tutorial: {

                        switch (Controller.TutorialPageNumber) {
                        case 1: {
                            Header      = _("What's happening next?");
                            Description = "SparkleShare creates a special folder on your computer " +
                                "that will keep track of your projects.";

                            Button skip_tutorial_button = new Button (_("Skip Tutorial"));
                            skip_tutorial_button.Clicked += delegate {
                                Controller.TutorialSkipped ();
                            };

                            Button continue_button = new Button (_("Continue"));
                            continue_button.Clicked += delegate {
                                Controller.TutorialPageCompleted ();
                            };

                            Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-1.png");

                            Add (slide);

                            AddButton (skip_tutorial_button);
                            AddButton (continue_button);

                            break;
                        }

                        case 2: {
                            Header      = _("Sharing files with others");
                            Description = _("All files added to your project folders are synced automatically with " +
                                "the host and your team members.");

                            Button continue_button = new Button (_("Continue"));
                            continue_button.Clicked += delegate {
                                Controller.TutorialPageCompleted ();
                            };

                            Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-2.png");

                            Add (slide);
                            AddButton (continue_button);

                            break;
                        }

                        case 3: {
                            Header      = _("The status icon is here to help");
                            Description = _("It shows the syncing progress, provides easy access to " +
                                "your projects and let's you view recent changes.");

                            Button continue_button = new Button (_("Continue"));
                            continue_button.Clicked += delegate {
                                Controller.TutorialPageCompleted ();
                            };

                            Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-3.png");

                            Add (slide);
                            AddButton (continue_button);

                            break;
                        }

                        case 4: {
                            Header      = _("Adding projects to SparkleShare");
                            Description = _("You can do this through the status icon menu, or by clicking " +
                                "magic buttons on webpages that look like this:");

                            Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-4.png");

                            Button finish_button = new Button (_("Finish"));
                            finish_button.Clicked += delegate {
                                Controller.TutorialPageCompleted ();
                            };

                            CheckButton check_button = new CheckButton ("Add SparkleShare to startup items") {
                                Active = true
                            };

                            check_button.Toggled += delegate {
                                Controller.StartupItemChanged (check_button.Active);
                            };

                            Add (slide);
                            AddOption (check_button);
                            AddButton (finish_button);

                            break;
                        }
                        }

                        break;
                    }
                    }

                    ShowAll ();
                });
            };
        }
コード例 #38
0
ファイル: WelcomePageView.cs プロジェクト: Poiros/monodevelop
		void Build ()
		{
			scroller = new ScrolledWindow ();
			widget = new WelcomePageWidget (this);
			scroller.AddWithViewport (widget);
			scroller.ShadowType = ShadowType.None;
			scroller.FocusChain = new Widget[] { widget };
			scroller.Show ();
		}
コード例 #39
0
        internal Client(bool loadFiles)
        {
            app_count++;

            Window = new Gtk.Window(Gtk.WindowType.Toplevel)
            {
                Title = Catalog.GetString("PDF Mod")
            };
            Window.SetSizeRequest(640, 480);
            Window.DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Quit();
                args.RetVal = true;
            };

            // PDF Icon View
            IconView = new DocumentIconView(this);
            var iconview_sw = new Gtk.ScrolledWindow();

            iconview_sw.AddWithViewport(IconView);

            query_box = new QueryBox(this)
            {
                NoShowAll = true
            };
            query_box.Hide();

            // ActionManager
            ActionManager = new Hyena.Gui.ActionManager();
            Window.AddAccelGroup(ActionManager.UIManager.AccelGroup);
            Actions = new Actions(this, ActionManager);

            // Status bar
            StatusBar = new Gtk.Statusbar()
            {
                HasResizeGrip = true
            };
            status_label = new Label()
            {
                Xalign = 0.0f
            };
            StatusBar.PackStart(status_label, true, true, 6);
            StatusBar.ReorderChild(status_label, 0);

            var zoom_slider = new ZoomSlider(this);

            StatusBar.PackEnd(zoom_slider, false, false, 0);
            StatusBar.ReorderChild(zoom_slider, 1);

            // Properties editor box
            EditorBox = new MetadataEditorBox(this)
            {
                NoShowAll = true
            };
            EditorBox.Hide();

            // Menubar
            menu_bar = ActionManager.UIManager.GetWidget("/MainMenu") as MenuBar;

            // Toolbar
            HeaderToolbar              = ActionManager.UIManager.GetWidget("/HeaderToolbar") as Gtk.Toolbar;
            HeaderToolbar.ShowArrow    = false;
            HeaderToolbar.ToolbarStyle = ToolbarStyle.Icons;
            HeaderToolbar.Tooltips     = true;
            HeaderToolbar.NoShowAll    = true;
            HeaderToolbar.Visible      = Configuration.ShowToolbar;

            // BookmarksView
            BookmarkView           = new BookmarkView(this);
            BookmarkView.NoShowAll = true;
            BookmarkView.Visible   = false;

            var vbox = new VBox();

            vbox.PackStart(menu_bar, false, false, 0);
            vbox.PackStart(HeaderToolbar, false, false, 0);
            vbox.PackStart(EditorBox, false, false, 0);
            vbox.PackStart(query_box, false, false, 0);

            var hbox = new HPaned();

            hbox.Add1(BookmarkView);
            hbox.Add2(iconview_sw);
            vbox.PackStart(hbox, true, true, 0);

            vbox.PackStart(StatusBar, false, true, 0);
            Window.Add(vbox);

            Window.ShowAll();

            if (loadFiles)
            {
                RunIdle(LoadFiles);
                Application.Run();
            }
        }
コード例 #40
0
 private Widget CreateIconViewPane()
 {
     iFoldersScrolledWindow = new ScrolledWindow();
        iFoldersIconView = new iFolderIconView(iFoldersScrolledWindow);
        myiFoldersFilter = new TreeModelFilter(ifdata.iFolders, null);
        myiFoldersFilter.VisibleFunc = SynchronizedFoldersFilterFunc;
        localGroup = new iFolderViewGroup(Util.GS("iFolders on This Computer"), myiFoldersFilter, SearchEntry);
        iFoldersIconView.AddGroup(localGroup);
        VBox emptyVBox = new VBox(false, 0);
        emptyVBox.BorderWidth = 12;
        Table table = new Table(3, 2, false);
        emptyVBox.PackStart(table, true, true, 0);
        table.RowSpacing = 12;
        table.ColumnSpacing = 12;
        Label l = new Label(
     string.Format("<span size=\"large\">{0}</span>",
       Util.GS("There are no iFolders on this computer.  To set up an iFolder, do one of the following:")));
        table.Attach(l,
        0, 2,
        0, 1,
        AttachOptions.Expand | AttachOptions.Fill,
        0, 0, 0);
        l.UseMarkup = true;
        l.LineWrap = true;
        l.Xalign = 0;
        Image uploadImg = new Image(Util.ImagesPath("upload48.png"));
        table.Attach(uploadImg,
        0, 1,
        1, 2,
        AttachOptions.Shrink | AttachOptions.Fill,
        0, 0, 0);
        l = new Label(
     string.Format("<span>{0}</span>",
       Util.GS("Select an existing folder on this computer to upload to an iFolder Server")));
        table.Attach(l,
        1, 2,
        1, 2,
        AttachOptions.Expand | AttachOptions.Fill,
        0, 0, 0);
        l.UseMarkup = true;
        l.LineWrap = true;
        l.Xalign = 0;
        Image downloadImg = new Image(Util.ImagesPath("download48.png"));
        table.Attach(downloadImg,
        0, 1,
        2, 3,
        AttachOptions.Shrink | AttachOptions.Fill,
        0, 0, 0);
        l = new Label(
     string.Format("<span>{0}</span>",
       Util.GS("Select an iFolder on the server to download to this computer")));
        table.Attach(l,
        1, 2,
        2, 3,
        AttachOptions.Expand | AttachOptions.Fill,
        0, 0, 0);
        l.UseMarkup = true;
        l.LineWrap = true;
        l.Xalign = 0;
        localGroup.EmptyWidget = emptyVBox;
        VBox emptySearchVBox = new VBox(false, 0);
        emptySearchVBox.BorderWidth = 12;
        l = new Label(
     string.Format("<span size=\"large\">{0}</span>",
       Util.GS("No matches found")));
        emptySearchVBox.PackStart(l, true, true, 0);
        l.UseMarkup = true;
        l.LineWrap = true;
        localGroup.EmptySearchWidget = emptySearchVBox;
        TargetEntry[] targets =
     new TargetEntry[]
     {
          new TargetEntry ("text/uri-list", 0, (uint) DragTargetType.UriList),
          new TargetEntry ("application/x-root-window-drop", 0, (uint) DragTargetType.RootWindow),
          new TargetEntry ("text/ifolder-id", 0, (uint) DragTargetType.iFolderID)
     };
        Drag.DestSet(iFoldersIconView,
        DestDefaults.All,
        targets,
        Gdk.DragAction.Copy | Gdk.DragAction.Move);
        iFoldersIconView.DragMotion +=
     new DragMotionHandler(OnIconViewDragMotion);
        iFoldersIconView.DragDrop +=
     new DragDropHandler(OnIconViewDragDrop);
        iFoldersIconView.DragDataReceived +=
     new DragDataReceivedHandler(OnIconViewDragDataReceived);
        DomainInformation[] domains = domainController.GetDomains();
        foreach (DomainInformation domain in domains)
        {
     AddServerGroup(domain.ID);
        }
        iFoldersIconView.SelectionChanged +=
     new EventHandler(OniFolderIconViewSelectionChanged);
        iFoldersIconView.BackgroundClicked +=
     new iFolderClickedHandler(OniFolderIconViewBackgroundClicked);
        iFoldersIconView.iFolderClicked +=
     new iFolderClickedHandler(OniFolderClicked);
        iFoldersIconView.iFolderActivated +=
     new iFolderActivatedHandler(OniFolderActivated);
        iFoldersIconView.KeyPressEvent +=
     new KeyPressEventHandler(OniFolderIconViewKeyPress);
        iFoldersScrolledWindow.AddWithViewport(iFoldersIconView);
        return iFoldersScrolledWindow;
 }
コード例 #41
0
ファイル: DynamicCodePage.cs プロジェクト: jbowwww/JGL
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicCodeTests.DynamicCodePage"/> class.
        /// </summary>
        public DynamicCodePage(Project project, CodeWindow codeWindow)
        {
            Trace.Log(TraceEventType.Information, "project=\"{0}\", codeWindow=\"{1}\"", project.ToString(), codeWindow.ToString());

            Project = project;
            CodeWindow = codeWindow;

            DynamicCompiler = new Compiler(project);

            lockOutput.AcquireWriterLock(0);

            int mark = 0;

            ScrolledWindow w = new ScrolledWindow();
            tvInput = new TextView();
            w.AddWithViewport(tvInput);
            Pack2(w, false, true);

            w = new ScrolledWindow();
            tvOutput = new TextView();
            tvOutput.Editable = false;
            w.AddWithViewport(tvOutput);
            Pack1(w, true, true);

            Position = 234;
            PositionSet = true;

            tvInput.GrabFocus();

            List<string> codeHistory = project.CodeHistory;

            tvInput.KeyReleaseEvent += delegate(object o, KeyReleaseEventArgs args)
            {
                if (args.Event.State.HasFlag(Gdk.ModifierType.ControlMask))
                {
                    if (args.Event.Key.Equals(Gdk.Key.space))
                        ShowCompletions();
                    else if (args.Event.Key.Equals(Gdk.Key.Return))
                        ExecuteCode();
                    else if (codeHistory.Count > 0)
                    {
                        if (args.Event.Key.Equals(Gdk.Key.Up))
                            CodeHistoryUp();
                        else if (args.Event.Key.Equals(Gdk.Key.Down))
                            CodeHistoryDown();
                    }
                }
                else
                {
                    codeHistoryIndex = -1;
                }

                tvInputPreviousText = tvInput.Buffer.Text;
            };

            lockOutput.ReleaseWriterLock();

            ShowAll();
        }
コード例 #42
0
 /// <summary>
 /// Add tab to notebook object
 /// </summary>
 private void AddLabelTab(ref Gtk.Label lblObj, string title)
 {
     // Create and add tab for Thanks info
     ScrolledWindow sw = new ScrolledWindow();
     Viewport vp = new Viewport();
     sw.AddWithViewport(vp);
     lblObj = new Label();
     lblObj.SetPadding(4,4);
     lblObj.SetAlignment((float)0, (float)0);
     vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
     vp.Add(lblObj);
     tabInfo.AppendPage(sw, new Gtk.Label(title));
 }
コード例 #43
0
        static int RunApp(string[] args, int n)
        {
            Project = SteticApp.CreateProject();

            Project.WidgetAdded     += OnWidgetAdded;
            Project.WidgetRemoved   += OnWidgetRemoved;
            Project.ModifiedChanged += OnProjectModified;
            Project.ProjectReloaded += OnProjectReloaded;

            Palette      = SteticApp.PaletteWidget;
            widgetTree   = SteticApp.WidgetTreeWidget;
            Signals      = SteticApp.SignalsWidget;
            propertyTree = SteticApp.PropertiesWidget;
            ProjectView  = new WindowListWidget();

            UIManager = new Stetic.UIManager(Project);

            Glade.XML.CustomHandler = CustomWidgetHandler;
            Glade.XML glade = new Glade.XML("stetic.glade", "MainWindow");
            glade.Autoconnect(typeof(SteticMain));

            if (ProjectView.Parent is Gtk.Viewport &&
                ProjectView.Parent.Parent is Gtk.ScrolledWindow)
            {
                Gtk.Viewport       viewport = (Gtk.Viewport)ProjectView.Parent;
                Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent;
                viewport.Remove(ProjectView);
                scrolled.Remove(viewport);
                scrolled.AddWithViewport(ProjectView);
            }

            foreach (Gtk.Widget w in glade.GetWidgetPrefix(""))
            {
                Gtk.Window win = w as Gtk.Window;
                if (win != null)
                {
                    win.AddAccelGroup(UIManager.AccelGroup);
                    win.ShowAll();
                }
            }
            MainWindow                      = (Gtk.Window)Palette.Toplevel;
            WidgetNotebook                  = (Gtk.Notebook)glade ["notebook"];
            WidgetNotebook.SwitchPage      += OnPageChanged;
            ProjectView.ComponentActivated += OnWidgetActivated;
            widgetTree.SelectionChanged    += OnSelectionChanged;

#if GTK_SHARP_2_6
            // This is needed for both our own About dialog and for ones
            // the user constructs
            Gtk.AboutDialog.SetUrlHook(ActivateUrl);
#endif

            if (n < args.Length)
            {
                LoadProject(args [n]);
            }

            ReadConfiguration();

            foreach (string s in Configuration.WidgetLibraries)
            {
                SteticApp.AddWidgetLibrary(s);
            }
            SteticApp.UpdateWidgetLibraries(false);

            ProjectView.Fill(Project);

            Program.Run();
            return(0);
        }