Exemple #1
0
        public PreferencesDialog(Gtk.Window parent, Gtk.Builder builder, IntPtr handle) :
            base(handle)
        {
            Trace.Call(parent, builder, handle);

            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }
            if (handle == IntPtr.Zero)
            {
                throw new ArgumentException("handle", "handle must not be zero.");
            }

            Parent       = parent;
            TransientFor = parent;
            Builder      = builder;
            Builder.Autoconnect(this);
            f_CategoryNotebook.ShowTabs     = false;
            f_ConnectionToggleButton.Active = true;
            // not implemented
            f_InternalSettingsToolbar.NoShowAll = true;
            f_InternalSettingsToolbar.Visible   = false;

            // Filters
            FilterListWidget = new FilterListWidget(parent, Frontend.UserConfig);
            // REMOTING CALL
            FilterListWidget.InitProtocols(Frontend.Session.GetSupportedProtocols());
            FilterListWidget.Load();
            f_FilterListBox.Add(FilterListWidget);

            // Servers
            ServerListView = new ServerListView(parent);
            ServerListView.Load();
            f_ServerListBox.Add(ServerListView);

            Init();
            ReadFromConfig();

            ShowAll();
        }
Exemple #2
0
        public PreferencesDialog(Gtk.Window parent)
        {
            Trace.Call(parent);

            if (parent == null) {
                throw new ArgumentNullException("parent");
            }

            _Glade = new Glade.XML(null, Frontend.GladeFilename, "PreferencesDialog", null);
            //_Glade.BindFields(this);
            // changed signal is used in all settings, so use glade for now
            _Glade.Autoconnect(this);
            _Dialog = (Gtk.Dialog)_Glade["PreferencesDialog"];
            _Dialog.TransientFor = parent;

            ((Gtk.Button)_Glade["OKButton"]).Clicked += new EventHandler(_OnOKButtonClicked);
            ((Gtk.Button)_Glade["ApplyButton"]).Clicked += new EventHandler(_OnApplyButtonClicked);
            ((Gtk.Button)_Glade["CancelButton"]).Clicked += new EventHandler(_OnCancelButtonClicked);

            ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged);
            ((Gtk.TextView)_Glade["OnStartupCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged);

            ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += OnNotificationAreaIconCheckButtonToggled;
            ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += _OnChanged;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Toggled += _OnChanged;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Toggled += _OnChanged;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Toggled += _OnChanged;

            ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Toggled += OnOverrideForegroundColorCheckButtonToggled;
            ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Toggled += OnOverrideBackgroundColorCheckButtonToggled;
            ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Toggled += OnOverrideFontCheckButtonToggled;

            Gtk.ComboBox wrapModeComboBox = (Gtk.ComboBox)_Glade["WrapModeComboBox"];
            // initialize wrap modes
            // glade might initialize it already!
            wrapModeComboBox.Clear();
            wrapModeComboBox.Changed += _OnChanged;
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            wrapModeComboBox.PackStart(cell, false);
            wrapModeComboBox.AddAttribute(cell, "text", 1);
            Gtk.ListStore store = new Gtk.ListStore(typeof(Gtk.WrapMode), typeof(string));
            // fill ListStore
            store.AppendValues(Gtk.WrapMode.Char,     _("Character"));
            store.AppendValues(Gtk.WrapMode.WordChar, _("Word"));
            wrapModeComboBox.Model = store;
            wrapModeComboBox.Active = 0;

            _Notebook.ShowTabs = false;

            Gtk.ListStore ls = new Gtk.ListStore(typeof(Page), typeof(Gdk.Pixbuf), typeof(string));
            ls.AppendValues(Page.Connection, _Dialog.RenderIcon(
                                                Gtk.Stock.Connect,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Connection"));
            ls.AppendValues(Page.Interface, _Dialog.RenderIcon(
                                                Gtk.Stock.SelectFont,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Interface"));
            ls.AppendValues(Page.Servers, _Dialog.RenderIcon(
                                                Gtk.Stock.Network,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Servers"));
            /*
            ls.AppendValues(Page.Filters, _Dialog.RenderIcon(
                                                Gtk.Stock.Delete,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Filters"));
            */

            int i = 1;
            _MenuTreeView.AppendColumn(null, new Gtk.CellRendererPixbuf(), "pixbuf",i++);
            _MenuTreeView.AppendColumn(null, new Gtk.CellRendererText(), "text", i++);
            _MenuTreeView.Selection.Changed += new EventHandler(_MenuTreeViewSelectionChanged);
            _MenuTreeView.Selection.Mode = Gtk.SelectionMode.Browse;
            _MenuTreeView.Model = ls;

            // select the first item
            Gtk.TreeIter iter;
            ls.GetIterFirst(out iter);
            _MenuTreeView.Selection.SelectIter(iter);

            _ChannelFilterListView = new ChannelFilterListView(_Glade);
            _ServerListView = new ServerListView(parent, _Glade);

            _Load();
        }
Exemple #3
0
        public PreferencesDialog(Gtk.Window parent)
        {
            Trace.Call(parent);

            if (parent == null) {
                throw new ArgumentNullException("parent");
            }

            _Glade = new Glade.XML(null, Frontend.GladeFilename, "PreferencesDialog", null);
            //_Glade.BindFields(this);
            // changed signal is used in all settings, so use glade for now
            _Glade.Autoconnect(this);
            _Dialog = (Gtk.Dialog)_Glade["PreferencesDialog"];
            _Dialog.TransientFor = parent;

            ((Gtk.Button)_Glade["OKButton"]).Clicked += new EventHandler(_OnOKButtonClicked);
            ((Gtk.Button)_Glade["ApplyButton"]).Clicked += new EventHandler(_OnApplyButtonClicked);
            ((Gtk.Button)_Glade["CancelButton"]).Clicked += new EventHandler(_OnCancelButtonClicked);

            ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged);
            ((Gtk.TextView)_Glade["OnStartupCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged);

            ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += OnNotificationAreaIconCheckButtonToggled;
            ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += _OnChanged;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Toggled += _OnChanged;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Toggled += _OnChanged;
            // we can't support minimize for now, see: http://projects.qnetp.net/issues/show/158
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Visible = false;
            ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Toggled += _OnChanged;

            ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Toggled += OnOverrideForegroundColorCheckButtonToggled;
            ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Toggled += OnOverrideBackgroundColorCheckButtonToggled;
            ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Toggled += OnOverrideFontCheckButtonToggled;
            ((Gtk.FontButton)_Glade["FontButton"]).FontSet += _OnChanged;
            ((Gtk.CheckButton)_Glade["ShowAdvancedSettingsCheckButton"]).Toggled += delegate {
                CheckShowAdvancedSettingsCheckButton();
            };

            ((Gtk.CheckButton)_Glade["ProxyShowPasswordCheckButton"]).Toggled += delegate {
                CheckProxyShowPasswordCheckButton();
            };

            ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Buffer.Changed += _OnChanged;
            if (Frontend.EngineVersion < new Version("0.7.2")) {
                // feature introduced in >= 0.7.2
                ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Sensitive = false;
            }

            ((Gtk.Button)_Glade["LoggingOpenButton"]).Clicked += delegate {
                ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        var logPath = Platform.LogPath;
                        if (!Directory.Exists(logPath)) {
                            Directory.CreateDirectory(logPath);
                        }
                        Process.Start(logPath);
                    } catch (Exception ex) {
                        Frontend.ShowError(parent, ex);
                    }
                });
            };

            Gtk.ComboBox wrapModeComboBox = (Gtk.ComboBox)_Glade["WrapModeComboBox"];
            // initialize wrap modes
            // glade might initialize it already!
            wrapModeComboBox.Clear();
            wrapModeComboBox.Changed += _OnChanged;
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            wrapModeComboBox.PackStart(cell, false);
            wrapModeComboBox.AddAttribute(cell, "text", 1);
            Gtk.ListStore store = new Gtk.ListStore(typeof(Gtk.WrapMode), typeof(string));
            // fill ListStore
            store.AppendValues(Gtk.WrapMode.Char,     _("Character"));
            store.AppendValues(Gtk.WrapMode.WordChar, _("Word"));
            wrapModeComboBox.Model = store;
            wrapModeComboBox.Active = 0;

            Gtk.ComboBox persistencyTypeComboBox =
                (Gtk.ComboBox) _Glade["PersistencyTypeComboBox"];
            // glade might initialize it already!
            persistencyTypeComboBox.Clear();
            persistencyTypeComboBox.Changed += _OnChanged;
            cell = new Gtk.CellRendererText();
            persistencyTypeComboBox.PackStart(cell, false);
            persistencyTypeComboBox.AddAttribute(cell, "text", 1);
            store = new Gtk.ListStore(
                typeof(MessageBufferPersistencyType), typeof(string)
            );
            // fill ListStore
            store.AppendValues(MessageBufferPersistencyType.Volatile,
                               _("Volatile"));
            store.AppendValues(MessageBufferPersistencyType.Persistent,
                               _("Persistent"));
            persistencyTypeComboBox.Model = store;
            persistencyTypeComboBox.Active = 0;
            if (Frontend.EngineVersion < new Version("0.8.1")) {
                persistencyTypeComboBox.Sensitive = false;
                ((Gtk.SpinButton) _Glade["VolatileMaxCapacitySpinButton"]).Sensitive = false;
                ((Gtk.SpinButton) _Glade["PersistentMaxCapacitySpinButton"]).Sensitive = false;
            }

            Gtk.ComboBox proxyTypeComboBox = (Gtk.ComboBox)_Glade["ProxyTypeComboBox"];
            // initialize wrap modes
            // glade might initialize it already!
            proxyTypeComboBox.Clear();
            proxyTypeComboBox.Changed += _OnChanged;
            proxyTypeComboBox.Changed += delegate {
                CheckProxyTypeComBoBox();
            };
            cell = new Gtk.CellRendererText();
            proxyTypeComboBox.PackStart(cell, false);
            proxyTypeComboBox.AddAttribute(cell, "text", 1);
            store = new Gtk.ListStore(typeof(ProxyType), typeof(string));
            // fill ListStore
            store.AppendValues(ProxyType.None,    String.Format("<{0}>",
                                                                _("No Proxy")));
            store.AppendValues(ProxyType.System,  String.Format("<{0}>",
                                                                _("System Default")));
            store.AppendValues(ProxyType.Http,    "HTTP");
            store.AppendValues(ProxyType.Socks4,  "SOCK 4");
            store.AppendValues(ProxyType.Socks4a, "SOCK 4a");
            store.AppendValues(ProxyType.Socks5,  "SOCK 5");
            proxyTypeComboBox.Model = store;
            proxyTypeComboBox.Active = 0;

            _Notebook.ShowTabs = false;

            Gtk.ListStore ls = new Gtk.ListStore(typeof(Page), typeof(Gdk.Pixbuf), typeof(string));
            ls.AppendValues(Page.Connection, _Dialog.RenderIcon(
                                                Gtk.Stock.Connect,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Connection"));
            ls.AppendValues(Page.Interface, _Dialog.RenderIcon(
                                                Gtk.Stock.SelectFont,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Interface"));
            ls.AppendValues(Page.Servers, _Dialog.RenderIcon(
                                                Gtk.Stock.Network,
                                                Gtk.IconSize.SmallToolbar, null),
                            _("Servers"));

            if (Frontend.EngineVersion >= new Version("0.7.2")) {
                // features introduced in >= 0.7.2
                ls.AppendValues(Page.Filters, _Dialog.RenderIcon(
                                                    Gtk.Stock.Delete,
                                                    Gtk.IconSize.SmallToolbar, null),
                                _("Filters"));
                ls.AppendValues(Page.Logging, _Dialog.RenderIcon(
                                                    Gtk.Stock.JustifyLeft,
                                                    Gtk.IconSize.SmallToolbar, null),
                                _("Logging"));
            }

            int i = 1;
            _MenuTreeView.AppendColumn(null, new Gtk.CellRendererPixbuf(), "pixbuf",i++);
            _MenuTreeView.AppendColumn(null, new Gtk.CellRendererText(), "text", i++);
            _MenuTreeView.Selection.Changed += new EventHandler(_MenuTreeViewSelectionChanged);
            _MenuTreeView.Selection.Mode = Gtk.SelectionMode.Browse;
            _MenuTreeView.Model = ls;

            // select the first item
            Gtk.TreeIter iter;
            ls.GetIterFirst(out iter);
            _MenuTreeView.Selection.SelectIter(iter);

            _ServerListView = new ServerListView(_Dialog, _Glade);
            _FilterListWidget = new FilterListWidget(_Dialog, Frontend.UserConfig);
            _FilterListWidget.Changed += _OnChanged;
            _FilterListEventBox.Add(_FilterListWidget);
            _FilterListEventBox.ShowAll();

            _Load();
        }