Beispiel #1
0
        /// <summary>
        /// Initializes a new instance class.
        /// </summary>
        /// <param name="ui">User interface.</param>
        public EditContentWindow(Ui ui)
            : base(WindowType.Toplevel)
        {
            this.Build();
            this.ui = ui;

            try
            {
                this.Icon = IconTheme.Default.LoadIcon("glippy", 128, Gtk.IconLookupFlags.GenericFallback);
            }
            catch (Exception ex)
            {
                Tools.PrintInfo(ex, this.GetType());
            }

            if (Core.Clipboard.Instance.Items.Count > 0)
            {
                Core.Item item = Core.Clipboard.Instance.Items[0];

                if (item.IsData)
                    this.content.Buffer.Text = item.Target.Name == Core.Targets.Html ? Encoding.Unicode.GetString(item.Data) : Encoding.Unicode.GetString(item.DataText);
                else
                    this.content.Buffer.Text = item.Text;
            }

            this.Destroyed += (s, e) => this.Purge();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of class.
        /// </summary>
        /// <param name="ui">User interface.</param>
        public PreferencesWindow(Ui ui)
            : base(WindowType.Toplevel)
        {
            this.Build();
            this.originalPages = this.notebook.NPages;
            this.ui = ui;

            try
            {
                this.Icon = IconTheme.Default.LoadIcon("glippy", 128, IconLookupFlags.GenericFallback);
            }
            catch (Exception ex)
            {
                Tools.PrintInfo(ex, this.GetType());
            }

            this.handleEvents = false;

            this.startAtLogin.Active = Core.Settings.Instance[Core.Settings.Keys.Core.StartAtLogin].AsBoolean();
            this.keyboardClipboard.Active = Core.Settings.Instance[Core.Settings.Keys.Core.KeyboardClipboard].AsBoolean();
            this.images.Active = Core.Settings.Instance[Core.Settings.Keys.Core.Images].AsBoolean();
            this.supportedFilesAsImages.Active = Core.Settings.Instance[Core.Settings.Keys.Core.SupportedFilesAsImages].AsBoolean();
            this.mouseClipboard.Active = Core.Settings.Instance[Core.Settings.Keys.Core.MouseClipboard].AsBoolean();
            this.synchronizeClipboards.Active = Core.Settings.Instance[Core.Settings.Keys.Core.SynchronizeClipboards].AsBoolean();
            this.saveHistoryOnExit.Active = Core.Settings.Instance[Core.Settings.Keys.Core.SaveHistoryOnExit].AsBoolean();
            this.pasteItemContentOnSelection.Active = Core.Settings.Instance[Core.Settings.Keys.Core.PasteOnSelection].AsBoolean();

            this.size.Value = Core.Settings.Instance[Core.Settings.Keys.UI.Size].AsInteger();
            this.labelLength.Value = Core.Settings.Instance[Core.Settings.Keys.UI.LabelLength].AsInteger();
            this.reverseOrder.Active = Core.Settings.Instance[Core.Settings.Keys.UI.ReverseOrder].AsBoolean();
            this.pasteIcon.Active = Core.Settings.Instance[Core.Settings.Keys.UI.PasteIcon].AsBoolean();
            this.showAbout.Active = Core.Settings.Instance[Core.Settings.Keys.UI.ShowAbout].AsBoolean();
            this.showEditClipboard.Active = Core.Settings.Instance[Core.Settings.Keys.UI.ShowEditClipboard].AsBoolean();
            this.showQuit.Active = Core.Settings.Instance[Core.Settings.Keys.UI.ShowQuit].AsBoolean();

            this.menuHotkey.Active = Core.Settings.Instance[Core.Settings.Keys.Hotkeys.Menu].AsBoolean();
            this.menuHotkeyText.Sensitive = this.buttonGrabMenuHotkey.Sensitive = this.menuHotkey.Active;
            this.menuHotkeyText.Text = Hotkeys.Instance[Core.Settings.Keys.Hotkeys.Menu].ToString();
            this.copyMouseHotkey.Active = this.mouseClipboard.Active && Core.Settings.Instance[Core.Settings.Keys.Hotkeys.CopyMouse].AsBoolean();
            this.copyMouseHotkeyText.Sensitive = this.buttonGrabCopyMouseHotkey.Sensitive = this.copyMouseHotkey.Active;
            this.copyMouseHotkeyText.Text = Hotkeys.Instance[Core.Settings.Keys.Hotkeys.CopyMouse].ToString();

            this.synchronizeClipboards.Sensitive = this.keyboardClipboard.Active && this.mouseClipboard.Active && !this.copyMouseHotkey.Active;
            this.images.Sensitive = this.keyboardClipboard.Active;
            this.supportedFilesAsImages.Sensitive = this.images.Sensitive && this.images.Active;
            this.handleEvents = true;

            this.LoadPluginsTreeview();

            foreach (IPlugin plug in this.ui.Plugins)
            {
                if (plug.PreferencesPage != null)
                    this.notebook.AppendPage(plug.PreferencesPage, new Label(plug.Name));
            }

            this.Destroyed += (s, e) => this.Purge();
        }