// create the status bar public StatusBar(FuseApp fuse, VBox box) { this.fuse = fuse; this.box = box; EventBox eb = new EventBox (); eb.Add (image); eb.ButtonReleaseEvent += notify_clicked; this.PackStart (eb, false, false, 2); }
// creates the main menu bar public MainMenu(FuseApp fuse) : base(false, 0) { this.fuse = fuse; // the actual top menu MenuItem file_item = new MenuItem ("File"); MenuItem options_item = new MenuItem ("Options"); MenuItem help_item = new MenuItem ("Help"); bar.Append (file_item); bar.Append (options_item); bar.Append (help_item); this.PackStart (bar, true, true, 0); file_item.Submenu = file_menu; options_item.Submenu = options_menu; help_item.Submenu = help_menu; // the top menu's children such as quit and about ImageMenuItem quit_item = new ImageMenuItem (Stock.Quit, null); ImageMenuItem plugins_item = new ImageMenuItem ("Plugins"); ImageMenuItem engine_item = new ImageMenuItem ("Media Engines"); shuffle_item = new CheckMenuItem ("Shuffle"); crossfade_item = new CheckMenuItem ("Crossfade"); ImageMenuItem about_item = new ImageMenuItem (Stock.About, null); // change menu item properties plugins_item.Image = new Image (Stock.Connect, IconSize.Menu); engine_item.Image = new Image (Stock.Connect, IconSize.Menu); // add menu items file_menu.Append (quit_item); options_menu.Append (plugins_item); options_menu.Append (engine_item); options_menu.Append (new Gtk.SeparatorMenuItem ()); options_menu.Append (shuffle_item); options_menu.Append (crossfade_item); help_menu.Append (about_item); // event handling for the menu items plugins_item.Activated += plugins_item_activated; engine_item.Activated += engine_item_activated; shuffle_item.Toggled += shuffle_item_activated; crossfade_item.Toggled += crossfade_item_activated; about_item.Activated += about_item_activated; }
// creates the main controls such as play, time left, etc. public Controls(FuseApp fuse) : base(false, 0) { this.fuse = fuse; // the buttons Button prev = new Button (); Button next = new Button (); Button volume = new Button (); play.Image = new Image (Stock.MediaPlay, IconSize.Button); prev.Image = new Image (Stock.MediaPrevious, IconSize.Button); next.Image = new Image (Stock.MediaNext, IconSize.Button); //FIXME: wont work in windows Gdk.Pixbuf vol = IconTheme.Default.LoadIcon ("audio-volume-high", (int)IconSize.Button, IconLookupFlags.ForceSvg); volume.Image = new Image (vol); // media information box mediaInfo.Markup = "<small> </small>"; time.Markup = "<small> </small>"; VBox info_box = new VBox (false, 0); HBox mediaInfo_box = new HBox (false, 0); info_box.PackStart (mediaInfo_box, true, true, 0); info_box.PackStart (seekbar, true, true, 0); mediaInfo_box.PackStart (mediaInfo, true, true, 0); mediaInfo_box.PackStart (time, false, false, 2); // hook in the media timer timer.Elapsed += timer_elapsed; crossfade_timer.Elapsed += crossfade_count; // hook button events play.Clicked += play_clicked; prev.Clicked += prev_clicked; next.Clicked += next_clicked; seekbar.PositionChanged += seek_changed; // pack the widgets in this.PackStart (prev, false, false, 0); this.PackStart (play, false, false, 2); this.PackStart (next, false, false, 0); this.PackStart (info_box, true, true, 5); this.PackStart (volume, false, false, 0); this.BorderWidth = 3; }
// creates the main window user interface public MainWindow(FuseApp fuse) : base("Fuse") { this.fuse = fuse; this.DeleteEvent += window_deleted; bottom.PackStart (fuse.Controls, false, false, 0); core_box.PackStart (info_image, true, true, 0); VBox backbone = new VBox (false, 0); backbone.PackStart (fuse.Menu, false, false, 0); backbone.PackStart (core_box, true, true, 0); backbone.PackStart (bottom, false, false, 0); this.Icon = new Gdk.Pixbuf (null, "fuse-tray.png"); this.Add (backbone); }
// creates the plugins user interface public PluginsWindow(FuseApp fuse, List <Plugin> plugin_list) : base(fuse.Window, "Plugins") { this.fuse = fuse; this.plugin_list = plugin_list; Frame frame = new Frame (); frame.Add (tree); frame.ShadowType = ShadowType.In; HBox backbone = new HBox (false, 5); backbone.PackStart (frame, false, false, 0); backbone.PackStart (pages, true, true, 0); // tree layout tree.Model = store; CellRendererToggle crt = new CellRendererToggle (); tree.AppendColumn ("Plugin", new CellRendererText (), new TreeCellDataFunc (renderPluginName)); tree.AppendColumn ("Enabled", crt, new TreeCellDataFunc (renderPluginEnabled)); tree.Selection.Changed += plugin_selected; crt.Toggled += plugin_toggled; // overview VBox overview = new VBox (false, 0); overview.PackStart (name, false, false, 0); overview.PackStart (description, false, false, 0); overview.PackStart (version, false, false, 0); overview.PackStart (author, false, false, 0); overview.PackStart (website, false, false, 0); pages.AppendPage (overview, new Label ("Overview")); loadPluginList (); backbone.BorderWidth = 10; this.Resize (500, 200); this.SkipPagerHint = true; this.SkipTaskbarHint = true; this.Add (backbone); }
// creates the media engine window public EnginesWindow(FuseApp fuse) : base(fuse.Window, "Media Engines") { this.fuse = fuse; // main widgets VBox backbone = new VBox (false, 2); backbone.BorderWidth = 10; Table details = new Table (5, 4, false); details.ColumnSpacing = 5; combo = new ComboBox (store); Button cancel = new Button (Stock.Cancel); Button save = new Button (Stock.Save); HBox button_box = new HBox (false, 2); // basic setup button_box.PackEnd (save); button_box.PackEnd (cancel); CellRendererText renderer = new CellRendererText (); combo.PackStart (renderer, true); combo.AddAttribute (renderer, "text", 1); // header labels Label instruction = new Label ("Select a media engine from the list below:"); Label title_header = new Label (); Label version_header = new Label (); Label description_header = new Label (); Label author_header = new Label (); Label website_header = new Label (); // add header content and styles title_header.Markup = "<small><b>Title:</b></small>"; version_header.Markup = "<small><b>Version:</b></small>"; description_header.Markup = "<small><b>Description:</b></small>"; author_header.Markup = "<small><b>Author:</b></small>"; website_header.Markup = "<small><b>Website:</b></small>"; // change label alignment title_header.Xalign = 0; version_header.Xalign = 0; description_header.Xalign = 0; author_header.Xalign = 0; website_header.Xalign = 0; title.Xalign = 0; version.Xalign = 0; description.Xalign = 0; author.Xalign = 0; website.Xalign = 0; // attach the labels to the details table details.Attach (title_header, 0, 1, 0, 1); details.Attach (version_header, 0, 1, 1, 2); details.Attach (author_header, 0, 1, 2, 3); details.Attach (website_header, 0, 1, 3, 4); details.Attach (description_header, 0, 1, 4, 5); details.Attach (title, 1, 2, 0, 1); details.Attach (version, 1, 2, 1, 2); details.Attach (author, 1, 2, 2, 3); details.Attach (website, 1, 2, 3, 4); details.Attach (description, 1, 2, 4, 5); // widget events combo.Changed += combo_changed; save.Clicked += save_clicked; cancel.Clicked += cancel_clicked; // add main widgets to the backbone backbone.PackStart (instruction, false, false, 5); backbone.PackStart (combo, false, false, 0); backbone.PackStart (details, false, false, 5); backbone.PackStart (button_box, false, false, 0); this.Resizable = false; this.SkipTaskbarHint = true; this.SkipPagerHint = true; this.Add (backbone); loadEngineList (); TreeIter first_iter; bool not_empty = combo.Model.GetIterFirst (out first_iter); combo.Sensitive = not_empty; if (not_empty) combo.SetActiveIter (first_iter); // select the previously selected engine store.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) { MediaEngine engine = (MediaEngine) model.GetValue (iter, 0); if (engine.Path == fuse.ChosenEngine) { combo.SetActiveIter (iter); return true; } return false; }); }