コード例 #1
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 ();
        }
コード例 #2
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();
    }
コード例 #3
0
		public DemoTextView () : base ("TextView")
		{
			SetDefaultSize (450,450);
			BorderWidth = 0;

			VPaned vpaned = new VPaned ();
			vpaned.BorderWidth = 5;
			Add (vpaned);

			// For convenience, we just use the autocreated buffer from
			// the first text view; you could also create the buffer
			// by itself, then later create a view widget.
			view1 = new TextView ();
			TextBuffer buffer = view1.Buffer;
			view2 = new TextView (buffer);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add1 (sw);
			sw.Add (view1);

			sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add2 (sw);
			sw.Add (view2);

			CreateTags (buffer);
			InsertText (buffer);

			AttachWidgets (view1);
			AttachWidgets (view2);

			ShowAll ();
		}
コード例 #4
0
ファイル: DemoMain.cs プロジェクト: head-thrash/gtk-sharp
        private ScrolledWindow CreateText(TextBuffer buffer, bool IsSource)
        {
            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            scrolledWindow.ShadowType = ShadowType.In;

            TextView textView = new TextView (buffer);
            textView.Editable = false;
            textView.CursorVisible = false;

            scrolledWindow.Add (textView);

            if (IsSource) {
                FontDescription fontDescription = FontDescription.FromString ("monospace");
                textView.OverrideFont (fontDescription);
                textView.WrapMode = Gtk.WrapMode.None;
            } else {
                // Make it a bit nicer for text
                textView.WrapMode = Gtk.WrapMode.Word;
                textView.PixelsAboveLines = 2;
                textView.PixelsBelowLines = 2;
            }

            return scrolledWindow;
        }
コード例 #5
0
ファイル: DemoTreeStore.cs プロジェクト: arkydon/gtk-sharp
		public DemoTreeStore () : base ("Card planning sheet")
		{
			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			Add (vbox);

			vbox.PackStart (new Label ("Jonathan's Holiday Card Planning Sheet"),
					false, false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.ShadowType = ShadowType.EtchedIn;
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart (sw, true, true, 0);

			// create model
			CreateModel ();

			// create tree view
			TreeView treeView = new TreeView (store);
			treeView.RulesHint = true;
			treeView.Selection.Mode = SelectionMode.Multiple;
			AddColumns (treeView);

			sw.Add (treeView);

			// expand all rows after the treeview widget has been realized
			treeView.Realized += new EventHandler (ExpandRows);

			SetDefaultSize (650, 400);
			ShowAll ();
		}
コード例 #6
0
        private void AppendChat(IChat chat)
        {
            Gtk.HBox  container = new Gtk.HBox();
            Gtk.Label label     = new Gtk.Label(chat.Name);
            container.PackStart(label);
            Gtk.Button button = new Gtk.Button(new Gtk.Image(Gtk.IconTheme.Default.LookupIcon("gtk-close", 16, Gtk.IconLookupFlags.NoSvg).LoadIcon()));
            button.Clicked += OnClicked;
            button.Relief   = Gtk.ReliefStyle.None;
            button.SetSizeRequest(20, 20);
            container.PackEnd(button);

            Gtk.TextView   view      = new Logopathy.Gui.ChatView(chat);
            ScrolledWindow view_swin = new Gtk.ScrolledWindow(new Gtk.Adjustment(0, 0, 0, 0, 0, 0), new Gtk.Adjustment(0, 0, 0, 0, 0, 0));

            view_swin.Add(view);
            view_swin.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);

            hash.Add(container, view);

            int pos = AppendPage(view_swin, container);

            container.ShowAll();

            ShowAll();

            AddedChats.Add(chat);
            ChatToPage.Add(chat, pos);
        }
コード例 #7
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 ();
	}
コード例 #8
0
		public DemoListStore () : base ("ListStore Demo")
		{
			BorderWidth = 8;

			VBox vbox = new VBox (false, 8);
			Add (vbox);

			Label label = new Label ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
			vbox.PackStart (label, false, false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.ShadowType = ShadowType.EtchedIn;
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart (sw, true, true, 0);

                        // create model
			store = CreateModel ();

			// create tree view
			TreeView treeView = new TreeView (store);
			treeView.RulesHint = true;
			treeView.SearchColumn = (int) Column.Description;
			sw.Add (treeView);

			AddColumns (treeView);

			// finish & show
			SetDefaultSize (280, 250);
			ShowAll ();
		}
コード例 #9
0
		public DemoApplicationWindow () : base ("Application Window")
		{
			SetDefaultSize (200, 200);

			vbox = new VBox (false, 0);
			Add (vbox);

			AddActions ();

			statusbar = new Statusbar ();
			UpdateStatus ();
			vbox.PackEnd (statusbar, false, false, 0);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			sw.ShadowType = ShadowType.In;
			vbox.PackEnd (sw, true, true, 0);

			TextView textview = new TextView ();
			textview.Buffer.MarkSet += new MarkSetHandler (MarkSet);
			sw.Add (textview);

			textview.GrabFocus ();

			ShowAll ();
		}
コード例 #10
0
		public DemoStockBrowser () : base ("Stock Icons and Items")
		{
			SetDefaultSize (-1, 500);
			BorderWidth = 8;

			HBox hbox = new HBox (false, 8);
			Add (hbox);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Never, PolicyType.Automatic);
			hbox.PackStart (sw, false, false, 0);

			ListStore model = CreateModel ();

			TreeView treeview = new TreeView (model);
			sw.Add (treeview);

			TreeViewColumn column = new TreeViewColumn ();
			column.Title = "Name";
			CellRenderer renderer = new CellRendererPixbuf ();
			column.PackStart (renderer, false);
			column.SetAttributes (renderer, "stock_id", Column.Id);
			renderer = new CellRendererText ();
			column.PackStart (renderer, true);
			column.SetAttributes (renderer, "text", Column.Name);

			treeview.AppendColumn (column);
			treeview.AppendColumn ("Label", new CellRendererText (), "text", Column.Label);
			treeview.AppendColumn ("Accel", new CellRendererText (), "text", Column.Accel);
			treeview.AppendColumn ("ID", new CellRendererText (), "text", Column.Id);

			Alignment align = new Alignment (0.5f, 0.0f, 0.0f, 0.0f);
			hbox.PackEnd (align, false, false, 0);

			Frame frame = new Frame ("Selected Item");
			align.Add (frame);

			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			frame.Add (vbox);

			typeLabel = new Label ();
			vbox.PackStart (typeLabel, false, false, 0);
			iconImage = new Gtk.Image ();
			vbox.PackStart (iconImage, false, false, 0);
			accelLabel = new Label ();
			vbox.PackStart (accelLabel, false, false, 0);
			nameLabel = new Label ();
			vbox.PackStart (nameLabel, false, false, 0);
			idLabel = new Label ();
			vbox.PackStart (idLabel, false, false, 0);

			treeview.Selection.Mode = Gtk.SelectionMode.Single;
			treeview.Selection.Changed += new EventHandler (SelectionChanged);

			ShowAll ();
		}
コード例 #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 RecommendationPane(ContextPage contextPage) : base()
        {
            this.context_page    = contextPage;
            main_box             = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList(Catalog.GetString("Recommended Artists"));
            artist_box.ShowAll();
            similar_artists_view    = new TileView(2);
            similar_artists_view_sw = new Gtk.ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            artist_box.PackStart(similar_artists_view_sw, true, true, 0);

            album_box = new TitledList(null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated  += OnSideSizeAllocated;
            album_list = new VBox();
            album_box.PackStart(album_list, false, false, 0);

            track_box = new TitledList(null);
            track_box.SizeAllocated  += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox();
            track_box.PackStart(track_list, true, true, 0);

            no_artists_pane           = new MessagePane();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible   = false;
            string no_results_message;

            if (!ApplicationContext.Debugging)
            {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message         = Catalog.GetString("No similar artists found");
            }
            else
            {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message         = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(no_results_message));
            artist_box.PackEnd(no_artists_pane, true, true, 0);

            main_box.PackStart(artist_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(album_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(track_box, false, false, 5);

            no_artists_pane.Hide();
        }
コード例 #13
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);
     Viewport vport = new Viewport();
     vport.Add(table);
     vport.ShadowType = ShadowType.None;
     scroller.Add(vport);
     _mainWidget = scroller;
 }
コード例 #14
0
        public void ZoomFit(bool upscale)
        {
            Gtk.ScrolledWindow scrolled = Parent as Gtk.ScrolledWindow;
            if (scrolled != null)
            {
                scrolled.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
            }

            min_zoom = ComputeMinZoom(upscale);

            this.upscale = upscale;

            Fit = true;
            DoZoom(MIN_ZOOM, Allocation.Width / 2, Allocation.Height / 2);

            if (scrolled != null)
            {
                ThreadAssist.ProxyToMain(() => {
                    scrolled.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
                });
            }
        }
コード例 #15
0
		public DemoIconView () : base ("Gtk.IconView demo")
		{
			SetDefaultSize (650, 400);
			DeleteEvent += new DeleteEventHandler (OnWinDelete);

			VBox vbox = new VBox (false, 0);
			Add (vbox);

			Toolbar toolbar = new Toolbar ();
			vbox.PackStart (toolbar, false, false, 0);

			upButton = new ToolButton (Stock.GoUp);
			upButton.IsImportant = true;
			upButton.Sensitive = false;
			toolbar.Insert (upButton, -1);

			ToolButton homeButton = new ToolButton (Stock.Home);
			homeButton.IsImportant = true;
			toolbar.Insert (homeButton, -1);

			fileIcon = GetIcon (Stock.File);
			dirIcon = GetIcon (Stock.Open);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.ShadowType = ShadowType.EtchedIn;
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart (sw, true, true, 0);

			// Create the store and fill it with the contents of '/'
			store = CreateStore ();
			FillStore ();

			IconView iconView = new IconView (store);
			iconView.SelectionMode = SelectionMode.Multiple;

			upButton.Clicked += new EventHandler (OnUpClicked);
			homeButton.Clicked += new EventHandler (OnHomeClicked);

			iconView.TextColumn = COL_DISPLAY_NAME;
			iconView.PixbufColumn = COL_PIXBUF;

			iconView.ItemActivated += new ItemActivatedHandler (OnItemActivated);
			sw.Add (iconView);
			iconView.GrabFocus ();

			ShowAll ();
		}
コード例 #16
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);
        }
コード例 #17
0
ファイル: ConsoleLog.cs プロジェクト: dlbeer/olishell
        public ConsoleLog(Settings set)
        {
            settings = set;

            textView = new TextView();
            textView.Editable = false;
            textView.CursorVisible = false;

            scroller = new ScrolledWindow();
            scroller.SetPolicy(PolicyType.Automatic, PolicyType.Always);
            scroller.Add(textView);

            InitTags();

            settings.RefreshFont += OnRefreshFont;
            OnRefreshFont(this, null);
        }
コード例 #18
0
		public DemoEditableCells () : base ("Shopping list")
		{
			SetDefaultSize (320, 200);
			BorderWidth = 5;

			VBox vbox = new VBox (false, 5);
			Add (vbox);

			vbox.PackStart (new Label ("Shopping list (you can edit the cells!)"), false, false, 0);

			ScrolledWindow scrolledWindow = new ScrolledWindow ();
			scrolledWindow.ShadowType = ShadowType.EtchedIn;
			scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vbox.PackStart (scrolledWindow, true, true, 0);

			// create model
			store = CreateModel ();

			// create tree view
			treeView = new TreeView (store);
			treeView.RulesHint = true;
			treeView.Selection.Mode = SelectionMode.Single;

			AddColumns ();
			scrolledWindow.Add (treeView);

			// some buttons
			HBox hbox = new HBox (true, 4);
			vbox.PackStart (hbox, false, false, 0);

			Button button = new Button ("Add item");
			button.Clicked += new EventHandler (AddItem);
			hbox.PackStart (button, true, true, 0);

			button = new Button ("Remove item");
			button.Clicked += new EventHandler (RemoveItem);
			hbox.PackStart (button, true, true, 0);

			ShowAll ();
		}
コード例 #19
0
		public DemoHyperText () : base ("HyperText")
		{
			handCursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
			regularCursor = new Gdk.Cursor (Gdk.CursorType.Xterm);

			SetDefaultSize (450, 450);

			TextView view = new TextView ();
			view.WrapMode = WrapMode.Word;
			view.KeyPressEvent += new KeyPressEventHandler (KeyPress);
			view.WidgetEventAfter += new WidgetEventAfterHandler (EventAfter);
			view.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotify);
			view.VisibilityNotifyEvent += new VisibilityNotifyEventHandler (VisibilityNotify);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			Add (sw);
			sw.Add (view);

			ShowPage (view.Buffer, 1);
			ShowAll ();
		}
コード例 #20
0
        public ThemedIconBrowser(Gtk.Window parent) :
            base("Select a Themed Icon", parent, Gtk.DialogFlags.Modal,
                 Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                 Gtk.Stock.Ok, Gtk.ResponseType.Ok)
        {
            HasSeparator     = false;
            BorderWidth      = 12;
            VBox.Spacing     = 18;
            VBox.BorderWidth = 0;

            DefaultResponse = Gtk.ResponseType.Ok;

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            VBox.PackStart(hbox, false, false, 0);

            entry            = new Gtk.Entry();
            entry.Activated += DoFind;
            hbox.PackStart(entry);

            Gtk.Button button = new Gtk.Button(Gtk.Stock.Find);
            button.Clicked += DoFind;
            hbox.PackStart(button, false, false, 0);

            ScrolledWindow scwin = new Gtk.ScrolledWindow();

            scwin.SizeRequested += ScrolledWindowSizeRequested;
            VBox.PackStart(scwin, true, true, 0);
            scwin.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
            scwin.ShadowType = Gtk.ShadowType.In;

            list = new ThemedIconList();
            scwin.Add(list);
            list.SelectionChanged += ListSelectionChanged;
            list.Activated        += ListActivated;
            SetResponseSensitive(Gtk.ResponseType.Ok, false);

            VBox.ShowAll();
        }
コード例 #21
0
ファイル: MainWindow_Pango.cs プロジェクト: oraora81/NOCmono
        public MainWindow_Pango()
            : base("pango + unicode + font")
        {
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate
            {
                    Application.Quit();
            };

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

            Context context = this.CreatePangoContext();
            _fonts = context.Families;

            _store = CreateModel();

            TreeView view = new TreeView();
            view.RulesHint = true;
            sw.Add(view);

            CreateColumn(view);

            string text = @"하늘과 바람과 별과 시 - 윤동주\n1821 года в Москве.Был вторым из 7 детей. Отец, Михаил Андреевич";

            _label = new Label(text);

            Pango.FontDescription fontDesc = Pango.FontDescription.FromString("SignPainter 20");
            _label.ModifyFont(fontDesc);

            Fixed fix = new Fixed();

            fix.Put(_label, 5, 5);
            Add(fix);
            //Add(sw);
            ShowAll();
        }
コード例 #22
0
        public Panes()
        {
            Gtk.Viewport vp;

            mainSW = new Gtk.ScrolledWindow();
            mainSW.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Always);
            mainSW.ShadowType     = Gtk.ShadowType.In;
            mainSW.SizeAllocated += MainResized;
            Pack1(mainSW, true, false);

            vp            = new Gtk.Viewport(null, null);
            vp.ResizeMode = Gtk.ResizeMode.Parent;
            vp.ShadowType = ShadowType.None;
            mainSW.Add(vp);
            vp.Show();

            main = new WhiteBox();
            vp.Add(main);
            main.Show();

            detailsSW = new Gtk.ScrolledWindow();
            detailsSW.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
            detailsSW.WidthRequest = 0;
            detailsSW.NoShowAll    = true;
            detailsSW.ShadowType   = Gtk.ShadowType.In;
            Pack2(detailsSW, false, false);

            vp            = new Gtk.Viewport(null, null);
            vp.ShadowType = ShadowType.None;
            detailsSW.Add(vp);
            vp.Show();

            details = new WhiteBox();
            vp.Add(details);
            details.Show();
        }
コード例 #23
0
ファイル: Panes.cs プロジェクト: ArsenShnurkov/beagle-1
		public Panes ()
		{
			Gtk.Viewport vp;

			mainSW = new Gtk.ScrolledWindow ();
			mainSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Always);
			mainSW.ShadowType = Gtk.ShadowType.In;
			mainSW.SizeAllocated += MainResized;
			Pack1 (mainSW, true, false);

			vp = new Gtk.Viewport (null, null);
			vp.ResizeMode = Gtk.ResizeMode.Parent;
			vp.ShadowType = ShadowType.None;
			mainSW.Add (vp);
			vp.Show ();

			main = new WhiteBox ();
			vp.Add (main);
			main.Show ();

			detailsSW = new Gtk.ScrolledWindow ();
			detailsSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Never);
			detailsSW.WidthRequest = 0;
			detailsSW.NoShowAll = true;
			detailsSW.ShadowType = Gtk.ShadowType.In;
			Pack2 (detailsSW, false, false);

			vp = new Gtk.Viewport (null, null);
			vp.ShadowType = ShadowType.None;
			detailsSW.Add (vp);
			vp.Show ();

			details = new WhiteBox ();
			vp.Add (details);
			details.Show ();
		}
コード例 #24
0
ファイル: BranchDialog.cs プロジェクト: bratsche/wit
        public BranchDialog(string[] branches)
        {
            this.Title = "git branches";
            this.AddButton("Close", ResponseType.Close);

            branch_store = new ListStore(typeof(string));

            ScrolledWindow sw = new ScrolledWindow();
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            sw.ShadowType = ShadowType.In;

            TreeView tv = new TreeView();
            tv.Model = branch_store;
            TreeViewColumn column = tv.AppendColumn("Branch", new CellRendererText(), new TreeCellDataFunc(BranchRenderer));

            sw.Add(tv);

            base.VBox.PackStart(sw, true, true, 0);

            foreach (string s in branches)
            {
                branch_store.AppendValues(s);
            }
        }
コード例 #25
0
ファイル: DataDatabaseView.cs プロジェクト: moscrif/ide
        public DataDatabaseView(string fileName)
        {
            hbox = new HBox();
            sqlLiteDal = new SqlLiteDal(fileName);

            lblTable = new Label(MainClass.Languages.Translate("tables"));
            hbox.PackStart(lblTable,false,false,10);

            cbTable = new ComboBox();
            cbTable.Changed += new EventHandler(OnComboProjectChanged);
            CellRendererText textRenderer = new CellRendererText();
            cbTable.PackStart(textRenderer, true);
            cbTable.AddAttribute(textRenderer, "text", 0);
            cbTable.Model = tablesComboModel;
            cbTable.WidthRequest = 200;

            hbox.PackStart(cbTable,false,false,2);
            hbox.PackEnd(new Label(""),true,true,2);

            this.PackStart(hbox,false,false,5);

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

            treeView = new TreeView (tableModel);
            treeView.RulesHint = true;
            //treeView.SearchColumn = (int) Column.Description;
            sw.Add (treeView);

            this.PackStart(sw,true,true,5);

            this.ShowAll();

            GetTables();
        }
コード例 #26
0
        public TestReportDialog(int passedNumber, int failedNumber, 
			    List<string> resultsAL)
            : base("UnitTest", "UnitTest", IntPtr.Zero, 0, null, "UnitTest", 
	   Stock.Ok, ResponseType.Ok)
        {
            string testReport;

              SetSizeRequest(700,400);

              var passedLabel = new Label("Passed : " + passedNumber);
              var failedLabel = new Label("Failed : " + failedNumber);
              var table = new GimpTable(2, 10, false) {
            BorderWidth = 12, ColumnSpacing = 6, RowSpacing = 6};

              var frame = new Frame("Tests results:");

              _filterEntry = new Entry();
              _filterEntry.Changed += delegate
            {
              filter.Refilter();
            };

              var filterLabel = new Label("Assembly Search:");
              var filterBox = new HBox();
              filterBox.PackStart(filterLabel, false, false, 20);
              filterBox.PackEnd(_filterEntry, true, true, 20);

              var tree = new TreeView();
              var assemblyColumn = new TreeViewColumn() {Title = "Assembly"};

              var assemblyNameCell = new CellRendererText();
              assemblyColumn.PackStart(assemblyNameCell, true);
              var resultColumn = new TreeViewColumn() {Title = "Result"};

              var resultReportCell = new CellRendererText() {Editable = false};

              resultColumn.PackStart(resultReportCell, true);
              tree.AppendColumn(assemblyColumn);
              tree.AppendColumn(resultColumn);

              var resultListStore = new ListStore(typeof(string), typeof(string));
              foreach (string tmp in resultsAL)
            {
              int pos = tmp.IndexOf(":");
              string assembly = tmp.Substring(0, pos);
              // +2 because of the ': '
              testReport = tmp.Substring(pos + 2, tmp.Length - (pos + 2));
              resultListStore.AppendValues(assembly, testReport);
            }

              assemblyColumn.SetCellDataFunc(assemblyNameCell,
                     new TreeCellDataFunc(RenderAssembly));
              resultColumn.SetCellDataFunc(resultReportCell,
                   new TreeCellDataFunc(RenderResult));

              filter = new TreeModelFilter(resultListStore, null);
              filter.VisibleFunc = new TreeModelFilterVisibleFunc(FilterTree);
              tree.Model = filter;

              var sw = new ScrolledWindow() {ShadowType = ShadowType.EtchedIn};
              sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
              sw.Add(tree);

              var swBox = new HBox();

              swBox.PackStart(sw, true, true, 20);

              table.AttachAligned(0, 0, "", 0.0, 0.5, passedLabel, 1, true);
              table.AttachAligned(0, 1, "", 0.0, 0.5, failedLabel, 1, true);
              frame.Add(table);
              var dummyFrameBox = new HBox();
              dummyFrameBox.PackStart(frame, true, true, 20);
              VBox.PackStart(dummyFrameBox, false, false, 0);

              VBox.PackStart(swBox, true, true, 0);
              VBox.PackStart(filterBox, false, false , 0);
        }
コード例 #27
0
ファイル: StructureDatabaseView.cs プロジェクト: moscrif/ide
        public StructureDatabaseView(string fileName)
        {
            this.filename = fileName;

            hbox = new HBox();

            sqlLiteDal = new SqlLiteDal(fileName);

            lblTable = new Label( MainClass.Languages.Translate("tables"));
            hbox.PackStart(lblTable, false, false, 10);

            cbTable = new ComboBox();
            cbTable.Changed += new EventHandler(OnComboProjectChanged);

            CellRendererText textRenderer = new CellRendererText();
            cbTable.PackStart(textRenderer, true);
            cbTable.AddAttribute(textRenderer, "text", 0);
            cbTable.Model = tablesComboModel;
            cbTable.WidthRequest = 200;

            hbox.PackStart(cbTable, false, false, 2);
            hbox.PackEnd(new Label(""), true, true, 2);

            HButtonBox hbbAction = new HButtonBox();
            hbbAction.LayoutStyle = Gtk.ButtonBoxStyle.Start;
            hbbAction.Spacing =6;

            Button btnAddTable = new Button(MainClass.Languages.Translate("add_table"));
            btnAddTable.Clicked+= delegate(object sender, EventArgs e) {

                SqlLiteAddTable addtable = new SqlLiteAddTable( filename );
                int result = addtable.Run();
                if (result == (int)ResponseType.Ok) {
                    GetTables();
                }
                addtable.Destroy();
            };

            Button btnDeleteTable = new Button(MainClass.Languages.Translate("delete_table"));
            btnDeleteTable.Clicked+= delegate(object sender, EventArgs e) {

                if(!CheckSelectTable())  return;

                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo,MainClass.Languages.Translate("permanently_delete_table", curentTable), "", Gtk.MessageType.Question);
                int result = md.ShowDialog();
                if (result != (int)Gtk.ResponseType.Yes)
                    return;

                DropTable();
                GetTables();
            };

            Button btnEditTable = new Button(MainClass.Languages.Translate("edit_table"));
            btnEditTable.Clicked+= delegate(object sender, EventArgs e) {

                if(!CheckSelectTable())  return;

                SqlLiteEditTable editTable = new SqlLiteEditTable(filename,curentTable);
                int result = editTable.Run();
                if (result == (int)ResponseType.Ok) {
                    GetTables();
                }
                editTable.Destroy();
            };

            hbbAction.Add(btnAddTable);
            hbbAction.Add(btnDeleteTable);
            hbbAction.Add(btnEditTable);
            hbox.PackEnd(hbbAction, false, false, 10);

            this.PackStart(hbox, false, false, 5);

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

            treeView = new TreeView(tableModel);
            GenerateColumns();
            treeView.RulesHint = true;
            //treeView.SearchColumn = (int) Column.Description;
            sw.Add(treeView);

            this.PackStart(sw, true, true, 5);

            ScrolledWindow sw2 = new ScrolledWindow ();
            sw2.ShadowType = ShadowType.EtchedIn;
            sw2.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            sw2.HeightRequest = 50;

            textControl = new TextView();
            textControl.Editable = false;
            textControl.HeightRequest = 50;
            sw2.Add (textControl);
            this.PackEnd(sw2, false, false, 5);

            this.ShowAll();
            GetTables();
            //cbTable.Active = 0;
        }
コード例 #28
0
ファイル: RecommendationPane.cs プロジェクト: dufoli/banshee
        public RecommendationPane(ContextPage contextPage)
            : base()
        {
            this.context_page = contextPage;
            main_box = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList (Catalog.GetString ("Recommended Artists"));
            artist_box.ShowAll ();
            similar_artists_view = new TileView (2);
            similar_artists_view_sw = new Gtk.ScrolledWindow ();
            similar_artists_view_sw.SetPolicy (PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add (similar_artists_view);
            similar_artists_view_sw.ShowAll ();
            artist_box.PackStart (similar_artists_view_sw, true, true, 0);

            album_box  = new TitledList (null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated += OnSideSizeAllocated;
            album_list = new VBox ();
            album_box.PackStart (album_list, false, false, 0);

            track_box  = new TitledList (null);
            track_box.SizeAllocated += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox ();
            track_box.PackStart (track_list, true, true, 0);

            no_artists_pane = new MessagePane ();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible = false;
            string no_results_message;

            if (!ApplicationContext.Debugging) {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon (48, "face-sad", Stock.DialogError);
                no_results_message = Catalog.GetString("No similar artists found");
            } else {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource ("no-results.png");
                no_results_message = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (no_results_message));
            artist_box.PackEnd (no_artists_pane, true, true, 0);

            main_box.PackStart (artist_box, true, true, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (album_box, false, false, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (track_box, false, false, 5);

            no_artists_pane.Hide ();
        }
コード例 #29
0
ファイル: PhotoView.cs プロジェクト: Yetangitu/f-spot
        public PhotoView(IBrowsableCollection query)
        {
            Query = query;

            commit_delay = new DelayedOperation (1000, new GLib.IdleHandler (CommitPendingChanges));
            Destroyed += HandleDestroy;

            Name = "ImageContainer";
            Box vbox = new VBox (false, 6);
            Add (vbox);

            background = new EventBox ();
            Frame frame = new Frame ();
            background.Add (frame);

            frame.ShadowType = ShadowType.In;
            vbox.PackStart (background, true, true, 0);

            inner_vbox = new VBox (false , 2);
            inner_hbox = new HBox (false , 2);

            frame.Add (inner_hbox);

            BrowsablePointer bp = new BrowsablePointer (query, -1);
            View = new PhotoImageView (bp);

            filmstrip = new Filmstrip (bp);
            filmstrip.ThumbOffset = 1;
            filmstrip.Spacing = 4;
            filmstrip.ThumbSize = 75;
            PlaceFilmstrip ((Orientation) Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);

            View.PhotoChanged += HandlePhotoChanged;

            photo_view_scrolled = new ScrolledWindow (null, null);

            photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            photo_view_scrolled.ShadowType = ShadowType.None;
            photo_view_scrolled.Add (View);
            photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
            View.AddEvents ((int) EventMask.KeyPressMask);
            inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
            inner_hbox.PackStart (inner_vbox, true, true, 0);

            HBox lower_hbox = new HBox (false, 2);
            //inner_hbox.BorderWidth = 6;

            tag_view = new TagView ();
            lower_hbox.PackStart (tag_view, false, true, 0);

            Label comment = new Label (Catalog.GetString ("Description:"));
            lower_hbox.PackStart (comment, false, false, 0);
            description_entry = new Entry ();
            lower_hbox.PackStart (description_entry, true, true, 0);
            description_entry.Changed += HandleDescriptionChanged;

            rating = new RatingEntry {
                HasFrame = false,
                AlwaysShowEmptyStars = true
            };
            lower_hbox.PackStart (rating, false, false, 0);
            rating.Changed += HandleRatingChanged;

            SetColors ();

            inner_vbox.PackStart (lower_hbox, false, true, 0);

            vbox.ShowAll ();

            Realized += (o, e) => SetColors();
            Preferences.SettingChanged += OnPreferencesChanged;
        }
コード例 #30
0
		private Test ()
		{
			const string path = "/tmp/TagSelectionTest.db";

			try {
				File.Delete (path);
			} catch {}

			Db db = new Db (path, true);

			Category people_category = db.Tags.CreateCategory (null, "People");
			db.Tags.CreateTag (people_category, "Anna");
			db.Tags.CreateTag (people_category, "Ettore");
			db.Tags.CreateTag (people_category, "Miggy");
			db.Tags.CreateTag (people_category, "Nat");

			Category places_category = db.Tags.CreateCategory (null, "Places");
			db.Tags.CreateTag (places_category, "Milan");
			db.Tags.CreateTag (places_category, "Boston");

			Category exotic_category = db.Tags.CreateCategory (places_category, "Exotic");
			db.Tags.CreateTag (exotic_category, "Bengalore");
			db.Tags.CreateTag (exotic_category, "Manila");
			db.Tags.CreateTag (exotic_category, "Tokyo");

			selection_widget = new TagSelectionWidget (db.Tags);
			selection_widget.SelectionChanged += new SelectionChangedHandler (OnSelectionChanged);

			Window window = new Window (WindowType.Toplevel);
			window.SetDefaultSize (400, 200);
			ScrolledWindow scrolled = new ScrolledWindow (null, null);
			scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			scrolled.Add (selection_widget);
			window.Add (scrolled);

			window.ShowAll ();
		}
コード例 #31
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();
    }
コード例 #32
0
    private void initialize(string title, Constants.MessageTypes type, string message, bool showScroledWinBar)
    {
        LogB.Information("Dialog message: " + message);

        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "dialog_message.glade", "dialog_message", "chronojump");
        gladeXML.Autoconnect(this);

        button_go.Visible = false;
        button_go_link    = "";

        Visible = true;

        //put an icon to window
        UtilGtk.IconWindow(dialog_message);

        //with this, user doesn't see a moving/changing creation window
        //if uncommented, then does weird bug in windows not showing dialog as its correct size until window is moves
        //dialog_message.Hide();

        if (title != "")
        {
            dialog_message.Title = title;
        }

        label_message.Text      = message;
        label_message.UseMarkup = true;

        image_warning.Hide();
        image_info.Hide();
        image_help.Hide();
        image_inspect.Hide();

        switch (type)
        {
        case Constants.MessageTypes.WARNING:
            image_warning.Show();
            break;

        case Constants.MessageTypes.INFO:
            image_info.Show();
            break;

        case Constants.MessageTypes.HELP:
            image_help.Show();
            break;

        case Constants.MessageTypes.INSPECT:
            Pixbuf pixbuf = new Pixbuf(null, Util.GetImagePath(false) + "image_test_inspect.png");
            image_inspect.Pixbuf = pixbuf;
            image_inspect.Show();
            break;
        }

        if (showScroledWinBar)
        {
            dialog_message.HeightRequest = 450;
            scrolledwindow.SetPolicy(PolicyType.Never, PolicyType.Automatic);
        }
        else
        {
            scrolledwindow.SetPolicy(PolicyType.Never, PolicyType.Never);
        }

        label_message.Show();
        dialog_message.Show();
    }
コード例 #33
0
        private void AddTagsTab()
        {
            Table tags_table = new Table(1, 2, false);
            tags_table.BorderWidth = 5;
            tags_table.ColumnSpacing = 10;
            tags_table.RowSpacing = 10;

            ScrolledWindow tags_swin = new ScrolledWindow();
            tags_swin.ShadowType = ShadowType.In;
            tags_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            tags_table.Attach(tags_swin, 0, 1, 0, 1);

            cr_toggle = new CellRendererToggle();
            cr_toggle.Activatable = true;
            cr_toggle.Toggled += new ToggledHandler(OnCrToggleToggled);
            tv_tags = new TreeView();
            tags_swin.Add(tv_tags);

            store_tags = new ListStore(typeof(bool), typeof(string));
            tv_tags.Model = store_tags;

            // set up the columns for the view
            TreeViewColumn column_Read = new TreeViewColumn("Use", cr_toggle, "active", 0);
            tv_tags.AppendColumn(column_Read);

            TreeViewColumn column_Name = new TreeViewColumn("Title", new CellRendererText(), "text", 1);
            tv_tags.AppendColumn(column_Name);

            foreach ( string tag in Feeds.GetTags() ) {
                TreeIter iter = store_tags.Append();
                if ( feed.Tags.Contains(tag) ) {
                    store_tags.SetValue(iter, 0, true);
                } else {
                    store_tags.SetValue(iter, 0, false);
                }
                store_tags.SetValue(iter, 1, tag);
            }

            ButtonBox tags_bbox = new HButtonBox();
            tags_bbox.Layout = ButtonBoxStyle.End;
            tags_table.Attach(tags_bbox, 0, 1, 1, 2);

            Button add_button = new Button(Stock.Add);
            add_button.Clicked += new EventHandler(OnAddButtonClicked);
            tags_bbox.PackStart(add_button);

            notebook.AppendPage(tags_table, new Label("Tags"));
        }
コード例 #34
0
ファイル: Setup.cs プロジェクト: emrul/CmisSync
		public void ShowSettingsPage()
		{
			SetSizeRequest (680, 470);
			Header = CmisSync.Properties_Resources.Settings;
			string localfoldername = Controller.saved_address.ToString();
			string username = Controller.saved_user;

			Label url_label = new Label() {
				Xalign = 0,
				UseMarkup = true,
				Markup = "<b>"+CmisSync.Properties_Resources.WebAddress+"</b>"
			};

			Entry url_entry = new Entry() {
				Text = localfoldername,
				IsEditable = false,
				Sensitive=false
			};

			Label user_label = new Label() {
				Xalign = 0,
				UseMarkup = true,
				Markup = "<b>"+CmisSync.Properties_Resources.User+"</b>"
			};

			Entry user_entry = new Entry() {
				Text = username,
				IsEditable = false,
				Sensitive=false
			};

			Label password_label = new Label() {
				Xalign = 0,
				UseMarkup = true,
				Markup = "<b>"+CmisSync.Properties_Resources.Password+"</b>",
			};

			Label authentification_error_label = new Label() {
				Xalign = 0,
				UseMarkup = true,
				Visible = false
			};

			Entry password_entry = new Entry() {
				Text = "",
				ActivatesDefault = false
			};
			String password = "";
			password_entry.TextInserted+=delegate {
				password+=password_entry.Text[password_entry.Text.Length-1];
				password_entry.Text=password_entry.Text.Replace(password_entry.Text[password_entry.Text.Length-1],'*');
			};

			CheckButton launcAtStartup = new CheckButton (CmisSync.Properties_Resources.SyncAtStartup);
			if (Controller.saved_syncatstartup)
				launcAtStartup.Active = true;

			Label syncInterval_label = new Label() {
				Xalign = 0,
				UseMarkup = true,
				Markup = "<b>"+CmisSync.Properties_Resources.SyncInterval+"(Secondes)"+"</b>"
			};

			//sync interval is between 5s and 1day
			HScale syncInterval_hscale = new HScale(new Adjustment(0,5,86401,5,5,1));
			syncInterval_hscale.DrawValue = true;
			// syncinterval is converted in secondes
			syncInterval_hscale.Value=Controller.saved_sync_interval/1000;
			syncInterval_hscale.Digits = 0;
			syncInterval_hscale.ValueChanged += delegate {
				Application.Invoke (delegate {
					syncInterval_hscale.TooltipText=syncInterval_hscale.Value+" s";
				});
			};


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


			Button save_button = new Button(
				CmisSync.Properties_Resources.Save
				);

			VBox layout_vertical   = new VBox (false, 10);

			layout_vertical.PackStart (new Label(""), false, false, 0);
			layout_vertical.PackStart (url_label, false, false, 0);
			layout_vertical.PackStart (url_entry, false, false, 0);
			layout_vertical.PackStart (user_label, false, false, 0);
			layout_vertical.PackStart (user_entry, false, false, 0);
			layout_vertical.PackStart (password_label, false, false, 0);
			layout_vertical.PackStart (password_entry, false, false, 0);
			layout_vertical.PackStart (authentification_error_label, false, false, 0);
			layout_vertical.PackStart (launcAtStartup, false, false, 0);
			layout_vertical.PackStart (syncInterval_label, false, false, 0);
			layout_vertical.PackStart (syncInterval_hscale, false, false, 0);
			//layout_vertical.PackStart (scale2, false, false, 0);

			ScrolledWindow scrolledWindow = new ScrolledWindow();
			scrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Automatic);

			scrolledWindow.AddWithViewport(layout_vertical);
			scrolledWindow.ShadowType=ShadowType.None;

			Add(scrolledWindow);
			AddButton(save_button);
			AddButton(cancel_button);

			save_button.Clicked += delegate {
				//save password not masked
				String verypassword="";

				for (int i=0;i<password.Length;i++){
					if (!password[i].Equals('*'))
						verypassword+=password[i];
				}
				//reset 
				password="";

				if (!String.IsNullOrEmpty(verypassword))
				{
					// Show wait cursor
					this.GdkWindow.Cursor = wait_cursor;

					// Try to find the CMIS server (asynchronous using a delegate)
					GetRepositoriesFuzzyDelegate dlgt =
						new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
					ServerCredentials credentials = new ServerCredentials() {
						UserName = user_entry.Text,
						Password = verypassword,
						Address = new Uri(url_entry.Text)
					};
					IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
					while (!ar.AsyncWaitHandle.WaitOne(100)) {
						while (Application.EventsPending()) {
							Application.RunIteration();
						}
					}
					Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar);
					CmisServer cmisServer = result.Item1;
					if(cmisServer != null)
					{
						Controller.repositories = cmisServer.Repositories;
						url_entry.Text = cmisServer.Url.ToString();
					}
					else
					{
						Controller.repositories = null;
					}
					// Hide wait cursor
					this.GdkWindow.Cursor = default_cursor;

					if (Controller.repositories == null)
					{
						// Show warning
						string warning = "";
						string message = result.Item2.Message;
						Exception e = result.Item2;
						if (e is CmisPermissionDeniedException)
						{
							warning = Properties_Resources.LoginFailedForbidden;
						}

						else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https"))
						{
							warning = Properties_Resources.SendFailureHttps;
						}
						else if (e.Message == "TrustFailure")
						{
							warning = Properties_Resources.TrustFailure;
						}
						else
						{
							warning = message + Environment.NewLine + Properties_Resources.Sorry;
						}
						authentification_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
						authentification_error_label.Show();
					}
					else
					{
						// update settings
						// syncinterval is converted in millisecondes
						Controller.SettingsPageCompleted(verypassword,(int)(syncInterval_hscale.Value*1000),launcAtStartup.Active);
					}
				}
				else
				{
					Controller.SettingsPageCompleted(null, (int)syncInterval_hscale.Value*1000, launcAtStartup.Active);
				}
			};

		}
コード例 #35
0
ファイル: SparkleSetup.cs プロジェクト: rchicoli/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?\n(visible only 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
                };

		try {
                    UnixUserInfo user_info = UnixUserInfo.GetRealUser ();
                
                    if (user_info != null && user_info.RealName != null)
                        // Some systems append a series of "," for some reason
                        name_entry.Text = user_info.RealName.TrimEnd (",".ToCharArray ());

                } catch (ArgumentException) {
                    // No username, not a big deal
                }

                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 (name_entry.Text.Equals (""))
                    name_entry.GrabFocus ();
                else
                    email_entry.GrabFocus ();
            }

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

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

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

                SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
                ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
                scrolled_window.SetPolicy (PolicyType.Never, PolicyType.Automatic);

                // Padding column
                tree_view.AppendColumn ("Padding", new Gtk.CellRendererText (), "text", 0);
                tree_view.Columns [0].Cells [0].Xpad = 4;

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

                // Service column
                TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" };
                CellRendererText service_cell = new CellRendererText () { Ypad = 8 };
                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=\"" + Program.UI.SecondaryTextColor + "\">" + plugin.Description + "</span>" +
                        "</span>", plugin);
                }

                tree_view.AppendColumn (service_column);
                scrolled_window.Add (tree_view);

                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=\"" +
                        Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPlugin.AddressExample + "</span>"
                };

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


                TreeSelection default_selection = tree_view.Selection;
                TreePath default_path = new TreePath ("" + Controller.SelectedPluginIndex);
                default_selection.SelectPath (default_path);

                tree_view.Model.Foreach (new TreeModelForeachFunc (
                    delegate (ITreeModel 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_view.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;

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

                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_view.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, true, true, 0);
                layout_fields.PackStart (layout_path, true, true, 0);

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

                tree_view.ScrollToCell (new TreePath ("" + Controller.SelectedPluginIndex), null, true, 0, 0);

                Add (layout_vertical);


                if (string.IsNullOrEmpty (path_entry.Text)) {
                    address_entry.GrabFocus ();
                    address_entry.Position = -1;
                } else {
                    path_entry.GrabFocus ();
                    path_entry.Position = -1;
                }

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


                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=\"" +
                            Program.UI.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=\""
                            + Program.UI.SecondaryTextColor + "\">" + example_text + "</span>";
                    });
                };

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


                tree_view.CursorChanged += delegate (object sender, EventArgs e) {
                    Controller.SelectedPluginChanged (tree_view.SelectedRow);
                };

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

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


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

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

                Controller.HistoryItemChanged (check_button.Active);
                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 };
                
                Label progress_label = new Label ("Preparing to fetch files…") {
                    Justify = Justification.Right,
                    Xalign  = 1
                };
                

                Controller.UpdateProgressBarEvent += delegate (double percentage, string speed) {
                    Application.Invoke (delegate {
                        progress_bar.Fraction = percentage / 100;
                        progress_label.Text   = speed;
                    });
                };
                
                cancel_button.Clicked += delegate { Controller.SyncingCancelled (); };


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

                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.";
                
                } 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);

                password_entry.GrabFocus ();
            }
                
            if (type == PageType.Finished) {
                Header      = "Your shared project is ready!";
                Description = "You can find the files 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 lets 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);
                }
            }
        }
コード例 #36
0
		private void EasterEggCB (object o, EventArgs args)
		{
			TextIter insertIter;

			TextBuffer buffer = new TextBuffer (null);
			insertIter = buffer.StartIter;
			buffer.Insert (ref insertIter, "This buffer is shared by a set of nested text views.\n Nested view:\n");
			TextChildAnchor anchor = buffer.CreateChildAnchor (ref insertIter);
			buffer.Insert (ref insertIter, "\nDon't do this in real applications, please.\n");
			TextView view = new TextView (buffer);

			RecursiveAttach (0, view, anchor);

			Gtk.Window window = new Gtk.Window (Gtk.WindowType.Toplevel);
			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);

			window.Add (sw);
			sw.Add (view);

			window.SetDefaultSize (300, 400);
			window.ShowAll ();
		}
コード例 #37
0
		public PhotoView (IBrowsableCollection query)
			: base ()
		{
			this.query = query;
	
			commit_delay = new FSpot.Delay (1000, new GLib.IdleHandler (CommitPendingChanges));
			this.Destroyed += HandleDestroy;
	
			Name = "ImageContainer";
			Box vbox = new VBox (false, 6);
			Add (vbox);
	
		        background = new EventBox ();
			Frame frame = new Frame ();
			background.Add (frame);
	
			frame.ShadowType = ShadowType.In;
			vbox.PackStart (background, true, true, 0);
			
			Box inner_vbox = new VBox (false , 2);
	
			frame.Add (inner_vbox);
			
			BrowsablePointer bp = new BrowsablePointer (query, -1);
			photo_view = new FSpot.PhotoImageView (bp);
	
			filmstrip = new Filmstrip (bp);
			Gdk.Pixbuf bg = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 69);
			bg.Fill (0x00000000);
			filmstrip.BackgroundTile = bg;
			filmstrip.ThumbOffset = 1;
			filmstrip.Spacing = 4;
			inner_vbox.PackStart (filmstrip, false, false, 0);
	
			photo_view.PhotoChanged += HandlePhotoChanged;
	
			photo_view_scrolled = new ScrolledWindow (null, null);

			photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			photo_view_scrolled.ShadowType = ShadowType.None;
			photo_view_scrolled.Add (photo_view);
			photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
			photo_view.AddEvents ((int) EventMask.KeyPressMask);
			inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
			
			HBox inner_hbox = new HBox (false, 2);
			//inner_hbox.BorderWidth = 6;
	
			tag_view = new Widgets.TagView (MainWindow.ToolTips);
			inner_hbox.PackStart (tag_view, false, true, 0);
	
			Label comment = new Label (Catalog.GetString ("Comment:"));
			inner_hbox.PackStart (comment, false, false, 0);
			description_entry = new Entry ();
			inner_hbox.PackStart (description_entry, true, true, 0);
			description_entry.Changed += HandleDescriptionChanged;
	
			rating = new Widgets.Rating();
			inner_hbox.PackStart (rating, false, false, 0);
			rating.Changed += HandleRatingChanged;
	
			SetColors ();
			
			inner_vbox.PackStart (inner_hbox, false, true, 0);
	
			vbox.ShowAll ();
	
			Realized += delegate (object o, EventArgs e) {SetColors ();};
		}
コード例 #38
0
ファイル: SqlDatabaseView.cs プロジェクト: moscrif/ide
        public SqlDatabaseView(string fileName)
            : base(7,1,false)
        {
            this.filename = fileName;
            this.RowSpacing = 5;

            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            sw.HeightRequest = 75;

            comandControl = new TextView();
            comandControl.HeightRequest = 75;

            comandControl.KeyPressEvent += new KeyPressEventHandler(ComandKeyPress);

            sw.Add(comandControl);

            Label lblSql = new Label(MainClass.Languages.Translate("sql_script"));
            lblSql.Xalign=0;
            lblSql.Yalign=0.5f;
            this.Attach(lblSql,0,1,0,1,AttachOptions.Fill,AttachOptions.Shrink,3,3);
            this.Attach(sw,0,1,1,2,AttachOptions.Fill,AttachOptions.Fill,3,3);

            btnExecute = new Button();
            btnExecute.Label = MainClass.Languages.Translate("execute_query");
            btnExecute.WidthRequest = 175;
            btnExecute.HeightRequest = 25;
            btnExecute.Clicked += delegate(object sender, EventArgs e) {
                string sql = comandControl.Buffer.Text;
                if (!String.IsNullOrEmpty(sql))
                    RunSql(sql);
            };

            this.Attach(btnExecute,0,1,2,3,AttachOptions.Shrink,AttachOptions.Shrink,0,0);

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

            treeView = new TreeView(tableModel);
            treeView.RulesHint = true;
            treeView.EnableSearch = false;

            swTv.Add(treeView);

            Label lblResult = new Label(MainClass.Languages.Translate("sql_result"));
            lblResult.Xalign=0;
            lblResult.Yalign=0.5f;

            this.Attach(lblResult,0,1,3,4,AttachOptions.Fill,AttachOptions.Shrink,3,3);
            this.Attach(swTv,0,1,4,5,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Expand|AttachOptions.Fill,3,3);

            ScrolledWindow swOc = new ScrolledWindow ();
            swOc.ShadowType = ShadowType.EtchedIn;
            swOc.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            swOc.HeightRequest = 50;

            outputControl = new TextView();
            outputControl.Editable = false;
            outputControl.HeightRequest = 150;
            swOc.Add (outputControl);

            Label lblOutput = new Label(MainClass.Languages.Translate("sql_output"));
            lblOutput.Xalign=0;
            lblOutput.Yalign=0.5f;

            this.Attach(lblOutput,0,1,5,6,AttachOptions.Fill,AttachOptions.Shrink,3,3);
            this.Attach(swOc,0,1,6,7,AttachOptions.Fill,AttachOptions.Fill,3,3);

            this.ShowAll();
        }