Ejemplo n.º 1
0
        public SparkleUI()
        {
            this.application = new Gtk.Application("org.sparkleshare.sparkleshare", 0);

            this.application.Register(null);
            this.application.Activated += ApplicationActivatedDelegate;
        }
Ejemplo n.º 2
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            var zoom_section = new GLib.Menu();

            menu.AppendSection(null, zoom_section);

            app.AddAccelAction(ZoomIn, new[] { "<Primary>plus", "<Primary>equal", "equal", "<Primary>KP_Add", "KP_Add" });
            zoom_section.AppendItem(ZoomIn.CreateMenuItem());

            app.AddAccelAction(ZoomOut, new[] { "<Primary>minus", "<Primary>underscore", "minus", "<Primary>KP_Subtract", "KP_Subtract" });
            zoom_section.AppendItem(ZoomOut.CreateMenuItem());

            app.AddAccelAction(ActualSize, new[] { "<Primary>0", "<Primary><Shift>A" });
            zoom_section.AppendItem(ActualSize.CreateMenuItem());

            app.AddAccelAction(ZoomToWindow, "<Primary>B");
            zoom_section.AppendItem(ZoomToWindow.CreateMenuItem());

            app.AddAccelAction(Fullscreen, "F11");
            zoom_section.AppendItem(Fullscreen.CreateMenuItem());

            var metric_section = new GLib.Menu();

            menu.AppendSection(null, metric_section);

            var metric_menu = new GLib.Menu();

            metric_section.AppendSubmenu(Translations.GetString("Ruler Units"), metric_menu);

            app.AddAction(RulerMetric);
            metric_menu.Append(Translations.GetString("Pixels"), $"app.{RulerMetric.Name}(0)");
            metric_menu.Append(Translations.GetString("Inches"), $"app.{RulerMetric.Name}(1)");
            metric_menu.Append(Translations.GetString("Centimeters"), $"app.{RulerMetric.Name}(2)");

            var show_hide_section = new GLib.Menu();

            menu.AppendSection(null, show_hide_section);

            var show_hide_menu = new GLib.Menu();

            show_hide_section.AppendSubmenu(Translations.GetString("Show/Hide"), show_hide_menu);

            app.AddAction(PixelGrid);
            show_hide_menu.AppendItem(PixelGrid.CreateMenuItem());

            app.AddAction(Rulers);
            show_hide_menu.AppendItem(Rulers.CreateMenuItem());

            app.AddAction(ToolBar);
            show_hide_menu.AppendItem(ToolBar.CreateMenuItem());

            app.AddAction(StatusBar);
            show_hide_menu.AppendItem(StatusBar.CreateMenuItem());

            app.AddAction(ToolBox);
            show_hide_menu.AppendItem(ToolBox.CreateMenuItem());

            app.AddAction(ImageTabs);
            show_hide_menu.AppendItem(ImageTabs.CreateMenuItem());
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     win?.Dispose();
     win = null;
     app?.Dispose();
     app = null;
 }
Ejemplo n.º 4
0
        // check if user wants to save before closing window
        private void OnDeleteEvent(object sender, DeleteEventArgs args)
        {
            if (ChangesMade)
            {
                switch (ConfirmClose())
                {
                case 1:
                    args.RetVal = false;
                    SaveFile();
                    ApplicationHelper.UnlockFile();
                    Application.Quit();
                    break;

                case 2:
                    args.RetVal = false;
                    ApplicationHelper.UnlockFile();
                    Application.Quit();
                    break;

                default:
                    args.RetVal = true;
                    break;
                }
            }
            else
            {
                args.RetVal = false;
                ApplicationHelper.UnlockFile();
                Application.Quit();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Callback method executed after closing the main window.
        /// </summary>
        /// <param name="obj">Window object</param>
        /// <param name="args">Delete event arguments</param>
        static void OnWindowClose(object obj, DeleteEventArgs args)
        {
            // Stop Timer process responsible for grabbing process data periodically
            _processGrabber.Stop();

            Application.Quit();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Handles the package enumerated event from the explorer builder.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 private void OnPackageEnumerated(object sender, ReferenceEnumeratedEventArgs e)
 {
     Application.Invoke(delegate
     {
         this.FiletreeBuilder.NodeStorage.AddPackageNode(e.Reference);
     });
 }
Ejemplo n.º 7
0
        private void fileExitMenuItem_Clicked(object sender, EventArgs args)
        {
            if (ChangesMade)
            {
                switch (ConfirmClose())
                {
                case 1:
                    SaveFile();
                    ApplicationHelper.UnlockFile();
                    Application.Quit();
                    break;

                case 2:
                    ApplicationHelper.UnlockFile();
                    Application.Quit();
                    break;

                default:
                    return;
                }
            }
            else
            {
                ApplicationHelper.UnlockFile();
                Application.Quit();
            }
        }
Ejemplo n.º 8
0
        public SparkleUI()
        {
            this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);

            this.application.Register (null);
            this.application.Activated += ApplicationActivatedDelegate;
        }
Ejemplo n.º 9
0
        public MainWindow(Gtk.Application application) : base(application)
        {
            storage = GlobalDI.GetService <IDocumentsStorage>();

            // Widget initialization
            DefaultSize  = new Gdk.Size(800, 600);
            DeleteEvent += Window_DeleteEvent;

            // Init children widgets
            header   = new Header();
            Titlebar = header;

            container = new Norka.Widgets.Paned(Orientation.Horizontal, this);

            _docList = container.Sidebar.DocumentsList;
            _docList.SelectedRowsChanged += (sender, args) => DocumentSelected();
            _docList.ItemRenamed         += DocumentRename;
            _editor = container.Editor;
            Add(container);

            container.Sidebar.DocumentsList.RefreshItems();

            var content = new Box(Orientation.Vertical, 0);

            content.PackStart(container, true, true, 0);
            Add(content);

            // Finally connect actins to window
            SetupActions();
        }
Ejemplo n.º 10
0
        private static void OpenGUI()
        {
            var appstate = new Application("org.AmongUsCapture.AmongUsCaptureUtil", GLib.ApplicationFlags.None);

            appstate.Register(GLib.Cancellable.Current);
            Application.Init();
            window = new UserForm(socket);
            appstate.AddWindow(window);
            Settings.form         = window;
            Settings.conInterface = new FormConsole(window);

            window.DeleteEvent += (object o, DeleteEventArgs e) =>
            {
                // Make sure that the IPC adapter has a chance to clean up after itself.
                IPCadapter.getInstance().Cancel().Wait();
                Application.Quit();
            };

            window.ShowAll();

            Application.Run();
            IPCadapter.getInstance().Cancel().Wait();

            Environment.Exit(0);
        }
Ejemplo n.º 11
0
        public static void Play()
        {
            Application.Init();

            var provider = new CssProvider();

            provider.LoadFromPath(GetResource("playground.css"));
            StyleContext.AddProviderForScreen(Screen.Default, provider, 800);

            var buffer  = File.ReadAllText(GetResource("playground.glade"));
            var builder = new Builder();

            builder.AddFromString(buffer);

            var window    = (ApplicationWindow)builder.GetObject("window");
            var root      = (Box)builder.GetObject("root");
            var leftArea  = (Box)builder.GetObject("left-area");
            var rightArea = (Box)builder.GetObject("right-area");

            root.SizeAllocated += (o, args) =>
            {
                leftArea.Visible = args.Allocation.Width >= 700;
            };

            var app = new PlaygroundApp(window.Handle);

            builder.Autoconnect(app);

//      var scrollArea = (Box)builder.GetObject("scrolled-window");

            app.Init();
            app.Show();

            Application.Run();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Provides alternatives when the game fails to download, either through an update or through an installation.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">Contains the type of failure that occurred.</param>
        private void OnGameDownloadFailed(object sender, EventArgs e)
        {
            Application.Invoke((o, args) =>
            {
                switch (this.Mode)
                {
                case ELauncherMode.Install:
                case ELauncherMode.Update:
                case ELauncherMode.Repair:
                    {
                        // Set the mode to the same as it was, but no longer in progress.
                        // The modes which fall to this case are all capable of repairing an incomplete or
                        // broken install on their own.
                        SetLauncherMode(this.Mode, false);
                        break;
                    }

                default:
                    {
                        // Other cases (such as Launch) will go to the default mode of Repair.
                        SetLauncherMode(ELauncherMode.Repair, false);
                        break;
                    }
                }
            });
        }
Ejemplo n.º 13
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(Contents, "F1");
            menu.AppendItem(Contents.CreateMenuItem());

            app.AddAction(Website);
            menu.AppendItem(Website.CreateMenuItem());

            app.AddAction(Bugs);
            menu.AppendItem(Bugs.CreateMenuItem());

            app.AddAction(Translate);
            menu.AppendItem(Translate.CreateMenuItem());

            // This is part of the application menu on macOS.
            if (PintaCore.System.OperatingSystem != OS.Mac)
            {
                var about_section = new GLib.Menu();
                menu.AppendSection(null, about_section);

                var about = PintaCore.Actions.App.About;
                app.AddAction(about);
                about_section.AppendItem(about.CreateMenuItem());
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///   Configures various elements found on the given UIElement
        ///   to become control points.
        /// </summary>
        /// <param name="root">
        ///    The UIElement that might contain the specially named objects to
        ///    be hooked up.
        /// </param>
        /// <remarks>
        ///   This looks up elements named "desklet-close" and "desklet-drag"
        ///   elements from the given root element and hooks up mouse events
        ///   so that they trigger a close action and a drag action on the
        ///   desklet.
        /// </remarks>
        public static void SetupToolbox(FrameworkElement root)
        {
            UIElement close = root.FindName("desklet-close") as UIElement;

            if (close != null)
            {
                SetupOnClick(close, delegate {
                    // When we move to multiple desklets on an
                    // appdomain we will need to change this to
                    // use some sort of global reference count and
                    // only shut Gtk when the count reaches zero.
                    Application.Quit();
                });
            }

            UIElement drag = root.FindName("desklet-drag") as UIElement;

            if (drag != null)
            {
                //
                // TODO: we need to pass the Gtk.Window, sort out
                // a way of getting this information from mopen or
                // from the surface
                //
                SetupOnClick(drag, delegate {
                    Console.WriteLine("On drag not enabled, as we do not know our Gtk.Window yet");
                });
            }
        }
Ejemplo n.º 15
0
 public static int Main(string[] args)
 {
     app = new Gtk.Application("gtml.testing", GLib.ApplicationFlags.None);
     Gtk.Application.Init("gtml.testing", ref args);
     gtml_activate();
     Gtk.Application.Run();
     return(0);
 }
Ejemplo n.º 16
0
        public static void Main(string[] args)
        {
            Application.Init();
            MainWindow win = new MainWindow();

            win.Show();
            Application.Run();
        }
Ejemplo n.º 17
0
 public static void SetupFormatActions(Gtk.Application app)
 {
     foreach (var item in FormatActionMap)
     {
         // app.AddAction(new GLib.SimpleAction(item.Key, null));
         app.AddAccelerator(item.Value, item.Key, null);
     }
 }
Ejemplo n.º 18
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAction(AddinManager);
            menu.AppendItem(AddinManager.CreateMenuItem());

            addins_menu = new GLib.Menu();
            menu.AppendSection(null, addins_menu);
        }
Ejemplo n.º 19
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAction(About);
            menu.AppendItem(About.CreateMenuItem());

            app.AddAccelAction(Exit, "<Primary>Q");
            menu.AppendItem(Exit.CreateMenuItem());
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Updates the progress bar and progress label during installations, repairs and updates.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">Contains the progress values and current filename.</param>
 private void OnModuleInstallationProgressChanged(object sender, ModuleProgressChangedArgs e)
 {
     Application.Invoke((o, args) =>
     {
         this.MainProgressBar.Text     = e.ProgressBarMessage;
         this.StatusLabel.Text         = e.IndicatorLabelMessage;
         this.MainProgressBar.Fraction = e.ProgressFraction;
     });
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Starts the launcher update process when its files have finished downloading.
        /// </summary>
        private static void OnLauncherDownloadFinished(object sender, EventArgs e)
        {
            Application.Invoke((o, args) =>
            {
                ProcessStartInfo script = LauncherHandler.CreateUpdateScript();
                Process.Start(script);

                Application.Quit();
            });
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Warns the user when the game fails to launch, and offers to attempt a repair.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">Empty event args.</param>
        private void OnGameLaunchFailed(object sender, EventArgs e)
        {
            Application.Invoke((o, args) =>
            {
                this.StatusLabel.Text     = LocalizationCatalog.GetString("The game failed to launch. Try repairing the installation.");
                this.MainProgressBar.Text = string.Empty;

                SetLauncherMode(ELauncherMode.Repair, false);
            });
        }
Ejemplo n.º 23
0
 public void LinkReceived()
 {
     Application.Invoke((_, _) =>
     {
         try
         {
             GtkHelper.ShowMessageBox(this, TextResource.GetText("MSG_REF_LINK_MSG"));
             CloseAndDispose();
         }
         catch { }
     });
 }
Ejemplo n.º 24
0
        private void SaveFile()
        {
            _fileActionProgBar.Visible = true;
            var amt     = _sqlItems.Count;
            var current = 0;

            this._dataContext.Connection.Open();

            foreach (var item in _sqlItems.ToList())
            {
                _fileActionProgBar.Window.ProcessUpdates(true);

                while (Application.EventsPending())
                {
                    Application.RunIteration(true);
                }

                current++;
                Console.WriteLine(_fileActionProgBar.Fraction);

                SQLiteCommand sql = null;

                if (item.IsAdding)
                {
                    sql = item.SqlAdd;
                }
                else if (item.IsDeleting)
                {
                    sql = item.SqlDelete;
                }
                else if (item.IsModifying)
                {
                    sql = item.SqlModify;
                }

                if (sql != null)
                {
                    sql.Connection = this._dataContext.Connection;
                    sql.ExecuteNonQuery();
                }

                _sqlItems.Remove(item);
                _fileActionProgBar.Fraction = (float)current / amt;
            }

            _fileActionProgBar.Fraction = 1;
            _fileActionProgBar.Visible  = false;
            _fileActionProgBar.Fraction = 0;

            this._dataContext.Connection.Close();
            RefreshData();
        }
Ejemplo n.º 25
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(SaveAll, "<Ctrl><Alt>A");
            menu.AppendItem(SaveAll.CreateMenuItem());

            app.AddAccelAction(CloseAll, "<Primary><Shift>W");
            menu.AppendItem(CloseAll.CreateMenuItem());

            doc_section = new GLib.Menu();
            menu.AppendSection(null, doc_section);

            app.AddAction(active_doc_action);
        }
Ejemplo n.º 26
0
        private void Run()
        {
            Gtk.Application.Init();
            app = new Gtk.Application("", GLib.ApplicationFlags.None);
            app.Register(GLib.Cancellable.Current);

            win = new Gtk.Window("");
            app.AddWindow(win);

            Fill();

            win.ShowAll();
            Gtk.Application.Run();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Handles application shutdown procedures - terminating render threads, cleaning
        /// up the UI, etc.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="a">The alpha component.</param>
        private void OnDeleteEvent(object sender, DeleteEventArgs a)
        {
            this.IsShuttingDown = true;

            Idle.Remove(OnIdleRenderFrame);

            this.RenderingEngine.SetRenderTarget(null);
            this.RenderingEngine.Dispose();

            this.ViewportWidget.Dispose();

            Application.Quit();
            a.RetVal = true;
        }
Ejemplo n.º 28
0
        private void Quit()
        {
            if (_model.ActiveRun.Get() != null)
            {
                if (_model.ActiveRun.Get().Running)
                {
                    ShowMessageDialog("Please stop the simulation first");
                }

                _model.ActiveRun.Get().Stop();
                _model.ActiveRun.Get().End();
            }

            Application.Quit();
            CharlieModel.SaveToFile(_model);
        }
Ejemplo n.º 29
0
        public static void Main(string[] args)
        {
            Application.Init();
            Application app = new Application("dev.simo-andreev.catabase", ApplicationFlags.None);

            app.Register(Cancellable.Current);

            Window window = new AppWindow("CataBase S");

            app.AddWindow(window);

            window.SetIconFromFile("res/images/C-Sharp.png");

            window.Show();
            Application.Run();
        }
Ejemplo n.º 30
0
        public SparkleUI ()
        {
            this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);

            this.application.Register (null);
            this.application.Activated += ApplicationActivatedDelegate;

            Gdk.Color color = SparkleUIHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
            SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
                    
            color = SparkleUIHelpers.MixColors (
                SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
                SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
                0.39);
    
            SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
        }
        static void Main(string[] args)
        {
            Application app = new Application("org.gtk.test34", 0);
            app.Activated += delegate {
                var list = app.Windows;
                if (list != null && list.Length > 0) {
                    list[0].Present ();
                }
                else {
                    var window = new Window(WindowType.Toplevel);
                    window.Application = app;
                    window.Show ();
                }
            };

            app.Run (0, "");
        }
Ejemplo n.º 32
0
        public SparkleUI()
        {
            this.application = new Gtk.Application("org.sparkleshare.sparkleshare", 0);

            this.application.Register(null);
            this.application.Activated += ApplicationActivatedDelegate;

            Gdk.Color color = SparkleUIHelpers.RGBAToColor(new Label().StyleContext.GetColor(StateFlags.Insensitive));
            SecondaryTextColor = SparkleUIHelpers.ColorToHex(color);

            color = SparkleUIHelpers.MixColors(
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetColor(StateFlags.Selected)),
                SparkleUIHelpers.RGBAToColor(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Selected)),
                0.39);

            SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex(color);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Handles application shutdown procedures - terminating render threads, cleaning
        /// up the UI, etc.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="a">The alpha component.</param>
        private void OnDeleteEvent(object sender, DeleteEventArgs a)
        {
            this.IsShuttingDown = true;

            if (this.FiletreeBuilder.IsActive)
            {
                this.FiletreeBuilder.Stop();
                this.FiletreeBuilder.Dispose();
            }

            this.RenderingEngine.SetRenderTarget(null);
            this.RenderingEngine.Dispose();

            this.ViewportWidget.Destroy();

            Application.Quit();
            a.RetVal = true;
        }