Exemplo n.º 1
0
		private void AttachWidgets (TextView textView)
		{
			// This is really different from the C version, but the
			// C versions seems a little pointless.

			Button button = new Button ("Click Me");
			button.Clicked +=  new EventHandler(EasterEggCB);
			textView.AddChildAtAnchor (button, buttonAnchor);
			button.ShowAll ();

			ComboBoxText combo = new ComboBoxText ();
			combo.AppendText ("Option 1");
			combo.AppendText ("Option 2");
			combo.AppendText ("Option 3");

 			textView.AddChildAtAnchor (combo, menuAnchor);

			HScale scale = new HScale (null);
			scale.SetRange (0,100);
			scale.SetSizeRequest (70, -1);
			textView.AddChildAtAnchor (scale, scaleAnchor);
			scale.ShowAll ();

			Gtk.Image image = Gtk.Image.LoadFromResource ("floppybuddy.gif");
			textView.AddChildAtAnchor (image, animationAnchor);
			image.ShowAll ();

			Entry entry = new Entry ();
			textView.AddChildAtAnchor (entry, entryAnchor);
			entry.ShowAll ();
		}
Exemplo n.º 2
0
		// Convenience function to create a combo box holding a number of strings
		private ComboBox CreateComboBox (string [] strings)
		{
			ComboBoxText combo = new ComboBoxText ();

			foreach (string str in strings)
				combo.AppendText (str);

			combo.Active = 0;
			return combo;
		}
Exemplo n.º 3
0
        // Relative: [<|>] [num] [minutes|hours] ago
        // TODO: Absolute: [>|>=|=|<|<=] [date/time]
        public FileSizeQueryValueEntry()
            : base()
        {
            spin_button = new SpinButton (0.0, 1.0, 1.0);
            spin_button.Digits = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange (0.0, Double.MaxValue);
            Add (spin_button);

            combo = new ComboBoxText ();
            combo.AppendText (Catalog.GetString ("bytes"));
            combo.AppendText (Catalog.GetString ("KB"));
            combo.AppendText (Catalog.GetString ("MB"));
            combo.AppendText (Catalog.GetString ("GB"));
            combo.Realized += delegate { if (!combo_set) { combo.Active = 2; } };
            Add (combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed += HandleValueChanged;
        }
Exemplo n.º 4
0
        public QueryLimitBox(QueryOrder [] orders, QueryLimit [] limits)
            : base()
        {
            this.orders = orders;
            this.limits = limits;

            Spacing = 5;

            enabled_checkbox = new CheckButton (Catalog.GetString ("_Limit to"));
            enabled_checkbox.Toggled += OnEnabledToggled;

            count_spin = new SpinButton (0, Double.MaxValue, 1);
            count_spin.Numeric = true;
            count_spin.Digits = 0;
            count_spin.Value = 25;
            count_spin.SetSizeRequest (60, -1);

            limit_combo = new ComboBoxText ();
            foreach (QueryLimit limit in limits) {
                limit_combo.AppendText (limit.Label);
            }

            order_combo = new ComboBoxText ();
            order_combo.RowSeparatorFunc = IsRowSeparator;
            foreach (QueryOrder order in orders) {
                if (order == null) {
                    order_combo.AppendText (String.Empty);
                } else {
                    order_combo.AppendText (order.Label);
                }
            }

            PackStart (enabled_checkbox, false, false, 0);
            PackStart (count_spin, false, false, 0);
            PackStart (limit_combo, false, false, 0);
            PackStart (new Label (Catalog.GetString ("selected by")), false, false, 0);
            PackStart (order_combo, false, false, 0);

            enabled_checkbox.Active = false;
            limit_combo.Active = 0;
            order_combo.Active = 0;

            OnEnabledToggled (null, null);

            ShowAll ();
        }
Exemplo n.º 5
0
        public void SetConstantsMapping(ConstantsMapping mapping)
        {
            this.mapping = mapping;
            keyText      = new string[mapping.GetAllStrings().Count];

            int i = 0;

            foreach (string key in mapping.GetAllStrings())
            {
                string text  = mapping.RemovePrefix(key);
                int    value = mapping.StringToByte(key);
                combobox1.AppendText(text);

                keyText[i] = key;
                i++;
            }
        }
Exemplo n.º 6
0
        public PlaylistQueryValueEntry()
            : base()
        {
            combo = new ComboBoxText ();
            combo.WidthRequest = DefaultWidth;

            int count = 0;
            PlaylistSource playlist;
            foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children) {
                playlist = child as PlaylistSource;
                if (playlist != null && playlist.DbId != null) {
                    combo.AppendText (playlist.Name);
                    playlist_id_combo_map [(int)playlist.DbId] = count;
                    combo_playlist_id_map [count++] = (int) playlist.DbId;
                }
            }

            Add (combo);
            combo.Active = 0;

            combo.Changed += HandleValueChanged;
        }
        public SmartPlaylistQueryValueEntry()
            : base()
        {
            combo = new ComboBoxText ();
            combo.WidthRequest = DefaultWidth;

            int count = 0;
            SmartPlaylistSource playlist;
            foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children) {
                playlist = child as SmartPlaylistSource;
                if (playlist != null && playlist.DbId != null) {
                    if (Editor.CurrentlyEditing == null || (Editor.CurrentlyEditing != playlist && !playlist.DependsOn (Editor.CurrentlyEditing))) {
                        combo.AppendText (playlist.Name);
                        playlist_id_combo_map [playlist.DbId.Value] = count;
                        combo_playlist_id_map [count++] = playlist.DbId.Value;
                    }
                }
            }

            Add (combo);
            combo.Active = 0;

            combo.Changed += HandleValueChanged;
        }
Exemplo n.º 8
0
        public TimeSpanQueryValueEntry()
            : base()
        {
            spin_button = new SpinButton (0.0, 1.0, 1.0);
            spin_button.Digits = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange (0.0, Double.MaxValue);
            Add (spin_button);

            combo = new ComboBoxText ();
            combo.AppendText (Catalog.GetString ("seconds"));
            combo.AppendText (Catalog.GetString ("minutes"));
            combo.AppendText (Catalog.GetString ("hours"));
            combo.AppendText (Catalog.GetString ("days"));
            combo.AppendText (Catalog.GetString ("weeks"));
            combo.AppendText (Catalog.GetString ("months"));
            combo.AppendText (Catalog.GetString ("years"));
            combo.Realized += delegate { combo.Active = set_combo; };
            Add (combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed += HandleValueChanged;
        }
Exemplo n.º 9
0
        private void BuildInterface ()
        {
            field_chooser = new ComboBoxText ();
            field_chooser.Changed += HandleFieldChanged;

            op_chooser = new ComboBoxText ();
            op_chooser.RowSeparatorFunc = IsRowSeparator;
            op_chooser.Changed += HandleOperatorChanged;

            value_box = new HBox ();

            remove_button = new Button (new Image ("gtk-remove", IconSize.Button));
            remove_button.Relief = ReliefStyle.None;
            remove_button.Clicked += OnButtonRemoveClicked;

            add_button = new Button (new Image ("gtk-add", IconSize.Button));
            add_button.Relief = ReliefStyle.None;
            add_button.Clicked += OnButtonAddClicked;

            button_box = new HBox ();
            button_box.PackStart (remove_button, false, false, 0);
            button_box.PackStart (add_button, false, false, 0);

            foreach (QueryField field in sorted_fields) {
                field_chooser.AppendText (field.Label);
            }

            Show ();
            field_chooser.Active = 0;
        }
        public void InitializeDialog()
        {
            FillGenreList ();

            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;

            BorderWidth = 6;
            DefaultResponse = ResponseType.Ok;

            ContentArea.Spacing = 6;

            HBox split_box = new HBox ();
            split_box.Spacing = 12;
            split_box.BorderWidth = 6;

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Text = String.Format (AddinManager.CurrentLocalizer.GetString ("{0}Radiostation fetcher{1}\n({2})"),
                "<span weight=\"bold\" size=\"larger\">", "</span>",source_name);
            header.Xalign = 0.0f;
            header.Yalign = 0.0f;
            header.UseMarkup = true;
            header.Wrap = true;
            header.Show ();

            Label message = new Label ();
            message.Text = AddinManager.CurrentLocalizer.GetString ("Choose a genre or enter a text that you wish to be queried, " +
                "then press the Get stations button. Found stations will be added to internet-radio source.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

            table = new Table (5, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 6;

            genre_entry = new ComboBoxText ();
            freeText_entry = new Entry ();

            genre_button = new Button (AddinManager.CurrentLocalizer.GetString ("Get stations"));
            freeText_button = new Button (AddinManager.CurrentLocalizer.GetString ("Get stations"));

            genre_button.CanDefault = true;
            genre_button.UseStock = true;
            genre_button.Clicked += OnGenreQueryButtonClick;
            genre_button.Show ();

            freeText_button.CanDefault = true;
            freeText_button.UseStock = true;
            freeText_button.Clicked += OnFreetextQueryButtonClick;
            freeText_button.Show ();

            foreach (string genre in genre_list) {
                if (!String.IsNullOrEmpty (genre))
                    genre_entry.AppendText (genre);
            }

            if (this is IGenreSearchable) {
                AddRow (AddinManager.CurrentLocalizer.GetString ("Query by genre:"), genre_entry, genre_button);
            }

            if (this is IFreetextSearchable) {
                AddRow (AddinManager.CurrentLocalizer.GetString ("Query by free text:"), freeText_entry, freeText_button);
            }

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            ContentArea.PackStart (split_box, true, true, 0);

            close_button = new Button ();
            close_button.Image = new Image ("gtk-close", IconSize.Button);
            close_button.Label = AddinManager.CurrentLocalizer.GetString ("_Close");
            close_button.CanDefault = true;
            close_button.UseStock = true;
            close_button.Show ();
            AddActionWidget (close_button, ResponseType.Close);

            close_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            close_button.Clicked += OnCloseButtonClick;

            statusbar = new Statusbar ();
            SetStatusBarMessage (source_name);
            main_box.PackEnd (statusbar, false, false, 0);
        }
Exemplo n.º 11
0
        public StationEditor(DatabaseTrackInfo track)
            : base()
        {
            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;
            Modal = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString ("Add new radio station")
                : Catalog.GetString ("Edit radio station");

            BorderWidth = 6;
            DefaultResponse = ResponseType.Ok;
            Modal = true;

            ContentArea.Spacing = 6;

            HBox split_box = new HBox ();
            split_box.Spacing = 12;
            split_box.BorderWidth = 6;

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
            header.Xalign = 0.0f;
            header.Show ();

            Label message = new Label ();
            message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

            table = new Table (5, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 6;

            genre_entry = ComboBoxText.NewWithEntry ();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                if (!String.IsNullOrEmpty (genre)) {
                    genre_entry.AppendText (genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty (track.Genre)) {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow (Catalog.GetString ("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow (Catalog.GetString ("Station Name:"));
            stream_entry      = AddEntryRow (Catalog.GetString ("Stream URL:"));
            creator_entry     = AddEntryRow (Catalog.GetString ("Station Creator:"));
            description_entry = AddEntryRow (Catalog.GetString ("Description:"));

            rating_entry = new RatingEntry ();
            HBox rating_box = new HBox ();
            rating_box.PackStart (rating_entry, false, false, 0);
            AddRow (Catalog.GetString ("Rating:"), rating_box);

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            ContentArea.PackStart (split_box, true, true, 0);

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.CanDefault = false;
            cancel_button.UseStock = true;
            cancel_button.Show ();
            AddActionWidget (cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            save_button = new Button (Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock = true;
            save_button.Sensitive = false;
            save_button.Show ();
            AddActionWidget (save_button, ResponseType.Ok);

            save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
                0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null) {
                if (!String.IsNullOrEmpty (track.TrackTitle)) {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty (track.Comment)) {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty (track.ArtistName)) {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox ();
            error_box.Spacing = 4;

            Image error_image = new Image ();
            error_image.Stock = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show ();

            error = new Label ();
            error.Xalign = 0.0f;
            error.Show ();

            error_box.PackStart (error_image, false, false, 0);
            error_box.PackStart (error, true, true, 0);
            error_box.Show ();

            error_container.Add (error_box);

            table.Attach (error_container, 0, 2, 6, 7, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed += OnFieldsChanged;
            stream_entry.Changed += OnFieldsChanged;

            OnFieldsChanged (this, EventArgs.Empty);
        }
Exemplo n.º 12
0
        private void Initialize()
        {
            DefaultResponse = Gtk.ResponseType.Ok;
            AddStockButton (Stock.Cancel, ResponseType.Cancel);
            AddStockButton (Stock.Ok, ResponseType.Ok, true);

            int minimum_width, natural_width;
            GetPreferredWidth (out minimum_width, out natural_width);
            SetGeometryHints (this, new Gdk.Geometry () {
                    MinWidth = minimum_width,
                    MaxWidth = Gdk.Screen.Default.Width,
                    MinHeight = -1,
                    MaxHeight = -1
                }, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);

            var table = new Table (2, 2, false) {
                RowSpacing = 12,
                ColumnSpacing = 6
            };

            table.Attach (new Label () {
                    Text = Catalog.GetString ("Station _Type:"),
                    UseUnderline = true,
                    Xalign = 0.0f
                }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach (arg_label = new Label () {
                    Xalign = 0.0f
                }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach (type_combo = new ComboBoxText (),
                1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            table.Attach (arg_entry = new Entry (),
                1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            VBox.PackStart (table, true, true, 0);
            VBox.Spacing = 12;
            VBox.ShowAll ();

            type_combo.Remove (0);
            int active_type = 0;
            int i = 0;
            foreach (StationType type in StationType.Types) {
                if (!type.SubscribersOnly || lastfm.Account.Subscriber) {
                    type_combo.AppendText (type.Label);
                    if (source != null && type == source.Type) {
                        active_type = i;
                    }
                    i++;
                }
            }

            type_combo.Changed += HandleTypeChanged;
            type_combo.Active = active_type;
            type_combo.GrabFocus ();
        }
Exemplo n.º 13
0
        public AddinView()
        {
            var hbox = new HBox () { Spacing = 6 };

            var filter_label = new Label (Catalog.GetString ("Show:"));
            var filter_combo = new ComboBoxText ();
            filter_combo.AppendText (Catalog.GetString ("All"));
            filter_combo.AppendText (Catalog.GetString ("Enabled"));
            filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
            filter_combo.Active = 0;

            var search_label = new Label (Catalog.GetString ("Search:"));
            var search_entry = new Banshee.Widgets.SearchEntry () {
                WidthRequest = 160,
                Visible = true,
                Ready = true
            };

            hbox.PackStart (filter_label, false, false, 0);
            hbox.PackStart (filter_combo, false, false, 0);
            hbox.PackEnd   (search_entry, false, false, 0);
            hbox.PackEnd   (search_label, false, false, 0);

            var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));

            var addins = AddinManager.Registry.GetAddins ().Where (a => { return
                a.Name != a.Id && a.Description != null &&
                !String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
                (!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
            });

            var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
                                           .Select (c => new {
                                                Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
                                                Name = c.Key,
                                                NameLocalized = Catalog.GetString (c.Key) })
                                           .OrderBy (c => c.NameLocalized)
                                           .ToList ();

            tree_view = new TreeView () {
                FixedHeightMode = false,
                HeadersVisible = false,
                SearchColumn = 1,
                RulesHint = true,
                Model = model
            };

            var update_model = new System.Action (() => {
                string search = search_entry.Query;
                bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
                model.Clear ();
                foreach (var cat in categorized_addins) {
                    var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
                    bool any = false;
                    foreach (var a in cat.Addins.Matching (search)) {
                        if (enabled == null || (a.Enabled == enabled.Value)) {
                            model.AppendValues (cat_iter, true,
                                a.Enabled,
                                String.Format (
                                    "<b>{0}</b>\n<small>{1}</small>",
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
                                a
                            );
                            any = true;
                        }
                    }

                    if (!any) {
                        model.Remove (ref cat_iter);
                    }
                }
                tree_view.ExpandAll ();
            });

            var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
            tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);

            var check_cell = new CellRendererToggle () { Activatable = true };
            tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
            check_cell.Toggled += (o, a) => {
                TreeIter iter;
                if (model.GetIter (out iter, new TreePath (a.Path))) {
                    var addin = model.GetValue (iter, 3) as Addin;
                    bool enabled = (bool) model.GetValue (iter, 1);
                    addin.Enabled = !enabled;
                    model.SetValue (iter, 1, addin.Enabled);
                    model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
                        var an = current_model.GetValue (current_iter, 3) as Addin;
                        if (an != null) {
                            current_model.SetValue (current_iter, 1, an.Enabled);
                        }
                        return false;
                    });
                }
            };

            update_model ();
            search_entry.Changed += (o, a) => update_model ();
            filter_combo.Changed += (o, a) => update_model ();

            var tree_scroll = new Hyena.Widgets.ScrolledWindow () {
                HscrollbarPolicy = PolicyType.Never
            };
            tree_scroll.AddWithFrame (tree_view);

            Spacing = 6;
            PackStart (hbox, false, false, 0);
            PackStart (tree_scroll, true, true, 0);
            ShowAll ();
            search_entry.GrabFocus ();

            txt_cell.WrapWidth = 300;
        }
Exemplo n.º 14
0
		protected NoteRecentChanges (NoteManager manager)
: base (Catalog.GetString ("Search All Notes"))
		{
			this.manager = manager;
			this.IconName = "tomboy";
			this.DefaultWidth = 450;
			this.DefaultHeight = 400;
			this.current_matches = new Dictionary<string, int> ();
			this.Resizable = true;

			selected_tags = new Dictionary<Tag, Tag> ();

			AddAccelGroup (Tomboy.ActionManager.UI.AccelGroup);

			menu_bar = CreateMenuBar ();

			Gtk.Label label = new Gtk.Label (Catalog.GetString ("_Search:"));
			label.Xalign = 0.0f;

			find_combo = Gtk.ComboBoxText.NewWithEntry ();
			label.MnemonicWidget = find_combo;
			find_combo.Changed += OnEntryChanged;
			find_combo.Entry.ActivatesDefault = false;
			find_combo.Entry.Activated += OnEntryActivated;
			if (previous_searches != null) {
				foreach (string prev in previous_searches) {
					find_combo.AppendText (prev);
				}
			}

			clear_search_button = new Gtk.Button (new Gtk.Image (Gtk.Stock.Clear,
							      Gtk.IconSize.Menu));
			clear_search_button.Sensitive = false;
			clear_search_button.Clicked += ClearSearchClicked;
			clear_search_button.Show ();

			Gtk.Table table = new Gtk.Table (1, 3, false);
			table.Attach (label, 0, 1, 0, 1,
			              Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.Attach (find_combo, 1, 2, 0, 1,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.Attach (clear_search_button,
				      2, 3, 0, 1,
			              Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.ColumnSpacing = 4;
			table.ShowAll ();

			Gtk.HBox hbox = new Gtk.HBox (false, 0);
			hbox.PackStart (table, true, true, 0);
			hbox.ShowAll ();

			// Notebooks Pane
			Gtk.Widget notebooksPane = MakeNotebooksPane ();
			notebooksPane.Show ();

			MakeRecentTree ();
			tree.Show ();

			status_bar = new Gtk.Statusbar ();

			// TODO: fix BUG 585479
			//status_bar.HasResizeGrip = true;
			status_bar.Show ();

			// Update on changes to notes
			manager.NoteDeleted += OnNotesDeleted;
			manager.NoteAdded += OnNotesChanged;
			manager.NoteRenamed += OnNoteRenamed;
			manager.NoteSaved += OnNoteSaved;

			// List all the current notes
			UpdateResults ();

			matches_window = new Gtk.ScrolledWindow ();
			matches_window.ShadowType = Gtk.ShadowType.In;

			matches_window.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			matches_window.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			matches_window.Add (tree);
			matches_window.Show ();

			hpaned = new Gtk.HPaned ();
			hpaned.Position = 150;
			hpaned.Add1 (notebooksPane);
			hpaned.Add2 (matches_window);
			hpaned.Show ();

			RestorePosition ();

			Gtk.VBox vbox = new Gtk.VBox (false, 8);
			vbox.BorderWidth = 6;
			vbox.PackStart (hbox, false, false, 4);
			vbox.PackStart (hpaned, true, true, 0);
			vbox.PackStart (status_bar, false, false, 0);
			vbox.Show ();

			// Use another VBox to place the MenuBar
			// right at thetop of the window.
			content_vbox = new Gtk.VBox (false, 0);
#if !MAC
			content_vbox.PackStart (menu_bar, false, false, 0);
#endif
			content_vbox.PackStart (vbox, true, true, 0);
			content_vbox.Show ();

			this.Add (content_vbox);
			this.DeleteEvent += OnDelete;
			this.KeyPressEvent += OnKeyPressed; // For Escape

			// Watch when notes are added to notebooks so the search
			// results will be updated immediately instead of waiting
			// until the note's QueueSave () kicks in.
			Notebooks.NotebookManager.NoteAddedToNotebook += OnNoteAddedToNotebook;
			Notebooks.NotebookManager.NoteRemovedFromNotebook += OnNoteRemovedFromNotebook;
			
			// Set the focus chain for the top-most containers Bug #512175
			Gtk.Widget[] vbox_focus = new Gtk.Widget[2];
			vbox_focus[0] = hbox;
			vbox_focus[1] = hpaned;
			vbox.FocusChain = vbox_focus;

			// Set focus chain for sub widgits of first top-most container
			Gtk.Widget[] table_focus = new Gtk.Widget[2];
			table_focus[0] = find_combo;
			table_focus[1] = matches_window;
			hbox.FocusChain = table_focus;
			
			// set focus chain for sub widgits of seconf top-most container
			Gtk.Widget[] hpaned_focus = new Gtk.Widget[2];
			hpaned_focus[0] = matches_window;
			hpaned_focus[1] = notebooksPane;
			hpaned.FocusChain = hpaned_focus;
			
			// get back to the beginning of the focus chain
			Gtk.Widget[] scroll_right = new Gtk.Widget[1];
			scroll_right[0] = tree;
			matches_window.FocusChain = scroll_right;
			
			Tomboy.ExitingEvent += OnExitingEvent;
		}
Exemplo n.º 15
0
		static ComboBox Create_ComboBox (string [] strings)
		{
			/*Menu menu = new Menu ();

			MenuItem menu_item = null;

			foreach (string str in strings) {
				menu_item = new MenuItem (str);
				menu_item.Show ();
				menu.Append (menu_item);
			}

			OptionMenu option_menu = new OptionMenu ();
			option_menu.Menu = menu;

			return option_menu;*/
			ComboBoxText combo_box = new ComboBoxText ();
			foreach (string str in strings) {
				combo_box.AppendText (str);
			}
			
			return combo_box;
		}
Exemplo n.º 16
0
        private HBox BuildMatchHeader()
        {
            HBox header = new HBox ();
            header.Show ();

            terms_enabled_checkbox = new CheckButton (Catalog.GetString ("_Match"));
            terms_enabled_checkbox.Show ();
            terms_enabled_checkbox.Active = true;
            terms_enabled_checkbox.Toggled += OnMatchCheckBoxToggled;
            header.PackStart (terms_enabled_checkbox, false, false, 0);

            terms_logic_combo = new ComboBoxText ();
            terms_logic_combo.AppendText (Catalog.GetString ("all"));
            terms_logic_combo.AppendText (Catalog.GetString ("any"));
            terms_logic_combo.Show ();
            terms_logic_combo.Active = 0;
            header.PackStart (terms_logic_combo, false, false, 0);

            terms_label = new Label (Catalog.GetString ("of the following:"));
            terms_label.Show ();
            terms_label.Xalign = 0.0f;
            header.PackStart (terms_label, true, true, 0);

            header.Spacing = 5;

            return header;
        }
Exemplo n.º 17
0
        private void Initialize()
        {
            DefaultResponse = Gtk.ResponseType.Ok;
            AddStockButton(Stock.Cancel, ResponseType.Cancel);
            AddStockButton(Stock.Ok, ResponseType.Ok, true);

            int minimum_width, natural_width;

            GetPreferredWidth(out minimum_width, out natural_width);
            SetGeometryHints(this, new Gdk.Geometry()
            {
                MinWidth  = minimum_width,
                MaxWidth  = Gdk.Screen.Default.Width,
                MinHeight = -1,
                MaxHeight = -1
            }, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);

            var table = new Table(2, 2, false)
            {
                RowSpacing    = 12,
                ColumnSpacing = 6
            };

            table.Attach(new Label()
            {
                Text         = Catalog.GetString("Station _Type:"),
                UseUnderline = true,
                Xalign       = 0.0f
            }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach(arg_label = new Label()
            {
                Xalign = 0.0f
            }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach(type_combo = new ComboBoxText(),
                         1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            table.Attach(arg_entry = new Entry(),
                         1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);

            VBox.PackStart(table, true, true, 0);
            VBox.Spacing = 12;
            VBox.ShowAll();

            type_combo.Remove(0);
            int active_type = 0;
            int i           = 0;

            foreach (StationType type in StationType.Types)
            {
                if (!type.SubscribersOnly || lastfm.Account.Subscriber)
                {
                    type_combo.AppendText(type.Label);
                    if (source != null && type == source.Type)
                    {
                        active_type = i;
                    }
                    i++;
                }
            }

            type_combo.Changed += HandleTypeChanged;
            type_combo.Active   = active_type;
            type_combo.GrabFocus();
        }