示例#1
0
        void ShowEditor(Editor editor)
        {
            SetupEditor(editor);
            current_editor = editor;

            buttons.Hide();

            // Top label
            var vbox  = new VBox(false, 4);
            var label = new Label {
                Markup = $"<big><b>{editor.Label}</b></big>"
            };

            vbox.PackStart(label, false, false, 5);

            // Optional config widget
            var config = editor.ConfigurationWidget();

            if (config != null)
            {
                // This is necessary because GtkBuilder widgets need to be
                // reparented.
                if (config.Parent != null)
                {
                    config.Reparent(vbox);
                }
                else
                {
                    vbox.PackStart(config, false, false, 0);
                }
            }

            // Apply / Cancel buttons
            var tool_buttons = new HButtonBox {
                LayoutStyle = ButtonBoxStyle.End,
                Spacing     = 5,
                BorderWidth = 5,
                Homogeneous = false
            };

            var cancel = new Button(Stock.Cancel);

            cancel.Clicked += HandleCancel;
            tool_buttons.Add(cancel);

            var apply = new Button(editor.ApplyLabel)
            {
                // FIXME, Theme icon
                //Image = new Image (GtkUtil.TryLoadIcon (Settings.Global.IconTheme, editor.IconName, 22, 0))
            };

            apply.Clicked += (s, e) => { Apply(editor); };
            tool_buttons.Add(apply);

            // Pack it all together
            vbox.PackEnd(tool_buttons, false, false, 0);
            active_editor = vbox;
            widgets.Add(active_editor);
            active_editor.ShowAll();
        }
示例#2
0
        void ShowEditor(Editor editor)
        {
            SetupEditor(editor);
            current_editor = editor;

            buttons.Hide();

            // Top label
            VBox  vbox  = new VBox(false, 4);
            Label label = new Label();

            label.Markup = string.Format("<big><b>{0}</b></big>", editor.Label);
            vbox.PackStart(label, false, false, 5);

            // Optional config widget
            Widget config = editor.ConfigurationWidget();

            if (config != null)
            {
                // This is necessary because GtkBuilder widgets need to be
                // reparented.
                if (config.Parent != null)
                {
                    config.Reparent(vbox);
                }
                else
                {
                    vbox.PackStart(config, false, false, 0);
                }
            }

            // Apply / Cancel buttons
            HButtonBox tool_buttons = new HButtonBox();

            tool_buttons.LayoutStyle = ButtonBoxStyle.End;
            tool_buttons.Spacing     = 5;
            tool_buttons.BorderWidth = 5;
            tool_buttons.Homogeneous = false;

            Button cancel = new Button(Stock.Cancel);

            cancel.Clicked += HandleCancel;
            tool_buttons.Add(cancel);

            Button apply = new Button(editor.ApplyLabel);

            apply.Image    = new Image(GtkUtil.TryLoadIcon(FSpot.Settings.Global.IconTheme, editor.IconName, 22, 0));
            apply.Clicked += (s, e) => { Apply(editor); };
            tool_buttons.Add(apply);

            // Pack it all together
            vbox.PackEnd(tool_buttons, false, false, 0);
            active_editor = vbox;
            widgets.Add(active_editor);
            active_editor.ShowAll();
        }
示例#3
0
        private void ShowEditor(Editor editor)
        {
            SetupEditor(editor);
            current_editor = editor;

            buttons.Hide();

            // Top label
            VBox  vbox  = new VBox(false, 4);
            Label label = new Label();

            label.Markup = String.Format("<big><b>{0}</b></big>", editor.Label);
            vbox.PackStart(label, false, false, 5);

            // Optional config widget
            Widget config = editor.ConfigurationWidget();

            if (config != null)
            {
                vbox.PackStart(config, false, false, 0);
            }

            // Apply / Cancel buttons
            HButtonBox tool_buttons = new HButtonBox();

            tool_buttons.LayoutStyle = ButtonBoxStyle.End;
            tool_buttons.Spacing     = 5;
            tool_buttons.BorderWidth = 5;
            tool_buttons.Homogeneous = false;

            Button cancel = new Button(Stock.Cancel);

            cancel.Clicked += HandleCancel;
            tool_buttons.Add(cancel);

            Button apply = new Button(editor.ApplyLabel);

            apply.Image    = new Image(GtkUtil.TryLoadIcon(FSpot.Global.IconTheme, editor.IconName, 22, (Gtk.IconLookupFlags) 0));
            apply.Clicked += delegate { Apply(editor); };
            tool_buttons.Add(apply);

            // Pack it all together
            vbox.PackEnd(tool_buttons, false, false, 0);
            active_editor = vbox;
            widgets.Add(active_editor);
            active_editor.ShowAll();
        }