Exemplo n.º 1
0
        private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args)
        {
            if (OutputMessageTextView.IsAtUrlTag)
            {
                return;
            }

            Gtk.Menu popup = args.Menu;

            popup.Append(new Gtk.SeparatorMenuItem());

            Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
            whois_item.Activated += _OnMenuWhoisItemActivated;
            popup.Append(whois_item);

            Gtk.ImageMenuItem ctcp_item      = new Gtk.ImageMenuItem(_("CTCP"));
            Gtk.Menu          ctcp_menu_item = new CtcpMenu(_IrcProtocolManager,
                                                            Frontend.MainWindow.ChatViewManager,
                                                            PersonModel);
            ctcp_item.Submenu = ctcp_menu_item;
            popup.Append(ctcp_item);

            Gtk.ImageMenuItem invite_to_item      = new Gtk.ImageMenuItem(_("Invite to"));
            Gtk.Menu          invite_to_menu_item = new InviteToMenu(_IrcProtocolManager,
                                                                     Frontend.MainWindow.ChatViewManager,
                                                                     PersonModel);
            invite_to_item.Submenu = invite_to_menu_item;
            popup.Append(invite_to_item);

            popup.ShowAll();
        }
Exemplo n.º 2
0
        protected virtual void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs e)
        {
            Trace.Call(sender, e);

            if (!_AtLinkTag)
            {
                return;
            }

            Gtk.Menu popup = e.Menu;
            // remove all items
            foreach (Gtk.Widget children in popup.Children)
            {
                popup.Remove(children);
            }

            Gtk.ImageMenuItem open_item = new Gtk.ImageMenuItem(Gtk.Stock.Open, null);
            open_item.Activated += delegate {
                if (_ActiveLink != null)
                {
                    OpenLink(_ActiveLink);
                }
            };
            popup.Append(open_item);

            Gtk.ImageMenuItem copy_item = new Gtk.ImageMenuItem(Gtk.Stock.Copy, null);
            copy_item.Activated += delegate {
                Gdk.Atom      clipboardAtom = Gdk.Atom.Intern("CLIPBOARD", false);
                Gtk.Clipboard clipboard     = Gtk.Clipboard.Get(clipboardAtom);
                clipboard.Text = _ActiveLink.ToString();
            };
            popup.Append(copy_item);

            popup.ShowAll();
        }
Exemplo n.º 3
0
        void UpdateMenu()
        {
            //
            // Clear out the old list
            //
            foreach (Gtk.MenuItem old_item in menu.Children)
            {
                menu.Remove(old_item);
            }

            //
            // Build a new list
            //
            foreach (BacklinkMenuItem item in GetBacklinkMenuItems())
            {
                item.ShowAll();
                menu.Append(item);
            }

            // If nothing was found, add in a "dummy" item
            if (menu.Children.Length == 0)
            {
                Gtk.MenuItem blank_item = new Gtk.MenuItem(Catalog.GetString("(none)"));
                blank_item.Sensitive = false;
                blank_item.ShowAll();
                menu.Append(blank_item);
            }

            submenu_built = true;
        }
Exemplo n.º 4
0
        private void BuildMenu()
        {
            var menuBar = new Gtk.MenuBar();
            var miFile  = new Gtk.MenuItem("File");
            var mFile   = new Gtk.Menu();
            var miHelp  = new Gtk.MenuItem("Help");
            var mHelp   = new Gtk.Menu();
            var miView  = new Gtk.MenuItem("View");
            var mView   = new Gtk.Menu();

            miFile.Submenu = mFile;
            mFile.Append(this.actQuit.CreateMenuItem());
            miHelp.Submenu = mHelp;
            mHelp.Append(this.actAbout.CreateMenuItem());
            miView.Submenu = mView;
            mView.Append(this.actViewBoxes.CreateMenuItem());
            mView.Append(this.actViewFrames.CreateMenuItem());
            mView.Append(this.actViewNotebook.CreateMenuItem());
            mView.Append(this.actViewDrawing.CreateMenuItem());

            menuBar.Append(miFile);
            menuBar.Append(miView);
            menuBar.Append(miHelp);
            this.vbMain.PackStart(menuBar, false, false, 5);
        }
Exemplo n.º 5
0
        private void PopulateAlbums()
        {
            Gtk.Menu menu = new Gtk.Menu();
            if (gallery.Version == GalleryVersion.Version1)
            {
                Gtk.MenuItem top_item = new Gtk.MenuItem(Catalog.GetString("(TopLevel)"));
                menu.Append(top_item);
            }

            foreach (Album album in gallery.Albums)
            {
                System.Text.StringBuilder label_builder = new System.Text.StringBuilder();

                for (int i = 0; i < album.Parents.Count; i++)
                {
                    label_builder.Append("  ");
                }
                label_builder.Append(album.Title);

                Gtk.MenuItem item = new Gtk.MenuItem(label_builder.ToString());
                ((Gtk.Label)item.Child).UseUnderline = false;
                menu.Append(item);

                AlbumPermission create_sub = album.Perms & AlbumPermission.CreateSubAlbum;

                if (create_sub == 0)
                {
                    item.Sensitive = false;
                }
            }

            album_optionmenu.Sensitive = true;
            menu.ShowAll();
            album_optionmenu.Menu = menu;
        }
Exemplo n.º 6
0
		protected void SetupUi()
		{
			var box = new Gtk.VBox();

			var menu = new Gtk.MenuBar();
			var fileMenu = new Gtk.Menu();
			var file = new Gtk.MenuItem("File");
			file.Submenu = fileMenu;
			menu.Append(file);

			var save = new Gtk.MenuItem("Save");
			save.Activated += OnSaveMenuActivated;
			var load = new Gtk.MenuItem("Load");
			load.Activated += OnLoadMenuActivated;

			var exit = new Gtk.MenuItem("Exit");
			exit.Activated += (sender, e) => Gtk.Application.Quit();

			fileMenu.Append(save);
			fileMenu.Append(load);
			fileMenu.Append(exit);


			box.PackStart(menu, false, false, 0);

			nb = new Gtk.Notebook();
			nb.ShowTabs = false;
			nb.AppendPage(SetupOverviewPage(), new Gtk.Label("Overview"));
			nb.AppendPage(SetupNewNotePage(), new Gtk.Label("New"));
			box.PackStart(nb, true, true, 2);

			Add(box);
		}
Exemplo n.º 7
0
 private void BuildPopup()
 {
     popup = new Gtk.Menu();
     popup.Append(this.actAdd.CreateMenuItem());
     popup.Append(this.actRemove.CreateMenuItem());
     popup.Append(this.actModify.CreateMenuItem());
     popup.Append(this.actSettings.CreateMenuItem());
     popup.ShowAll();
 }
Exemplo n.º 8
0
        private void PopulateAlbumOptionMenu(PicasaWeb picasa)
        {
            PicasaAlbumCollection albums = null;

            if (picasa != null)
            {
                try {
                    albums = picasa.GetAlbums();
                } catch {
                    Console.WriteLine("Can't get the albums");
                    picasa = null;
                }
            }

            Gtk.Menu menu = new Gtk.Menu();

            bool disconnected = picasa == null || !account.Connected || albums == null;

            if (disconnected || albums.Count == 0)
            {
                string msg = disconnected ? Catalog.GetString("(Not Connected)")
                                        : Catalog.GetString("(No Albums)");

                Gtk.MenuItem item = new Gtk.MenuItem(msg);
                menu.Append(item);

                ok_button.Sensitive        = false;
                album_optionmenu.Sensitive = false;
                album_button.Sensitive     = false;

                if (disconnected)
                {
                    album_button.Sensitive = false;
                }
            }
            else
            {
                foreach (PicasaAlbum album in albums.AllValues)
                {
                    System.Text.StringBuilder label_builder = new System.Text.StringBuilder();

                    label_builder.Append(album.Title);

                    Gtk.MenuItem item = new Gtk.MenuItem(label_builder.ToString());
                    ((Gtk.Label)item.Child).UseUnderline = false;
                    menu.Append(item);
                }

                ok_button.Sensitive        = items.Length > 0;
                album_optionmenu.Sensitive = true;
                album_button.Sensitive     = true;
            }

            menu.ShowAll();
            album_optionmenu.Menu = menu;
        }
Exemplo n.º 9
0
        internal void ShowDockPopupMenu(uint time)
        {
            Gtk.Menu menu = new Gtk.Menu();

            // Hide menuitem
            if ((Behavior & DockItemBehavior.CantClose) == 0)
            {
                Gtk.MenuItem mitem = new Gtk.MenuItem(Catalog.GetString("Hide"));
                mitem.Activated += delegate { Visible = false; };
                menu.Append(mitem);
            }

            Gtk.MenuItem citem;

            // Auto Hide menuitem
            if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide)
            {
                citem            = new Gtk.MenuItem(Catalog.GetString("Minimize"));
                citem.Activated += delegate { Status = DockItemStatus.AutoHide; };
                menu.Append(citem);
            }

            if (Status != DockItemStatus.Dockable)
            {
                // Dockable menuitem
                citem            = new Gtk.MenuItem(Catalog.GetString("Dock"));
                citem.Activated += delegate { Status = DockItemStatus.Dockable; };
                menu.Append(citem);
            }

            // Floating menuitem
            if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating)
            {
                citem            = new Gtk.MenuItem(Catalog.GetString("Undock"));
                citem.Activated += delegate { Status = DockItemStatus.Floating; };
                menu.Append(citem);
            }

            if (menu.Children.Length == 0)
            {
                menu.Destroy();
                return;
            }

            ShowingContextMemu = true;

            menu.ShowAll();
            menu.Hidden += (o, e) => {
                ShowingContextMemu = false;
            };
            menu.Popup(null, null, null, 3, time);
        }
Exemplo n.º 10
0
        private void PopulateAlbums()
        {
            Gtk.Menu menu = new Gtk.Menu();
            if (gallery.Version == GalleryVersion.Version1)
            {
                Gtk.MenuItem top_item = new Gtk.MenuItem(Catalog.GetString("(TopLevel)"));
                menu.Append(top_item);
            }

            foreach (Album album in gallery.Albums)
            {
                System.Text.StringBuilder label_builder = new System.Text.StringBuilder();

                for (int i = 0; i < album.Parents.Count; i++)
                {
                    label_builder.Append("  ");
                }

                label_builder.Append(album.Title);
                album_optionmenu.AppendText(label_builder.ToString());
            }

            album_optionmenu.Sensitive = true;
            menu.ShowAll();
        }
Exemplo n.º 11
0
		public void CreateMainMenu (Gtk.Menu menu)
		{
			menu.Append (CropToSelection.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
			menu.Append (AutoCrop.CreateAcceleratedMenuItem (Gdk.Key.X, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));
			menu.Append (Resize.CreateAcceleratedMenuItem (Gdk.Key.R, Gdk.ModifierType.ControlMask));
			menu.Append (CanvasSize.CreateAcceleratedMenuItem (Gdk.Key.R, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
			menu.AppendSeparator ();
			menu.Append (FlipHorizontal.CreateMenuItem ());
			menu.Append (FlipVertical.CreateMenuItem ());
			menu.AppendSeparator ();
			menu.Append (RotateCW.CreateAcceleratedMenuItem (Gdk.Key.H, Gdk.ModifierType.ControlMask));
			menu.Append (RotateCCW.CreateAcceleratedMenuItem (Gdk.Key.G, Gdk.ModifierType.ControlMask));
			menu.Append (Rotate180.CreateAcceleratedMenuItem (Gdk.Key.J, Gdk.ModifierType.ControlMask));
			menu.AppendSeparator ();
			menu.Append (Flatten.CreateAcceleratedMenuItem (Gdk.Key.F, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
		}
Exemplo n.º 12
0
        public static void MakeMenuSeparator(Gtk.Menu menu)
        {
            var i = new Gtk.SeparatorMenuItem();

            menu.Append(i);
            i.Show();
        }
Exemplo n.º 13
0
        bool SetMenuItemsIdle()
        {
            idle_source = 0;

            if (menu != null)
            {
                foreach (Gtk.Widget widget in menu.Children)
                {
                    menu.Remove(widget);
                    widget.Destroy();
                }
            }

            menu = new Gtk.Menu();

            foreach (Gtk.MenuItem item in CurrentMenuItems())
            {
                menu.Append(item);
                item.Show();
            }

            menu.Show();

            //if (indicator.Menu == null)
            indicator.Menu = menu;

            return(false);
        }
Exemplo n.º 14
0
        public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string l, EventHandler e, bool enabled)
        {
            Gtk.MenuItem  i;
            Gtk.StockItem item = Gtk.StockItem.Zero;

            if (Gtk.StockManager.Lookup(l, ref item))
            {
                i = new Gtk.ImageMenuItem(l, new Gtk.AccelGroup());
            }
            else
            {
                i = new Gtk.MenuItem(l);
            }

            if (e != null)
            {
                i.Activated += e;
            }

            i.Sensitive = enabled;

            menu.Append(i);
            i.Show();

            return(i);
        }
Exemplo n.º 15
0
        private void AddTemplate(Gtk.Menu menu, Wrappers.Wrapper template)
        {
            if (!(d_filter == null || d_filter(template) || (template is Wrappers.Node && d_recursive)))
            {
                return;
            }

            string lbl = template.FullId.Replace("_", "__");

            Gtk.MenuItem item = new Gtk.MenuItem(lbl);
            item.Show();

            item.Activated += delegate {
                if (item.Submenu == null)
                {
                    Activated(this, template);
                }
            };

            menu.Append(item);

            d_map[template] = new MenuInfo(item, menu);

            if (d_recursive && template is Wrappers.Node)
            {
                Gtk.Menu sub = new Gtk.Menu();
                item.Submenu = sub;

                Traverse((Wrappers.Node)template, sub);
            }

            template.WrappedObject.AddNotification("id", HandleIdChanged);
        }
Exemplo n.º 16
0
        private void ShowPopup()
        {
            Gtk.Menu menu = new Gtk.Menu();

            Gtk.MenuItem deleteFile = new Gtk.MenuItem(GettextCatalog.GetString("Delete file"));
            deleteFile.Activated += new EventHandler(OnDeleteFiles);

            Gtk.MenuItem renameFile = new Gtk.MenuItem(GettextCatalog.GetString("Rename file"));
            renameFile.Activated += new EventHandler(OnRenameFile);
            renameFile.Sensitive  = false;

            menu.Append(deleteFile);
            menu.Append(renameFile);

            menu.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime);
            menu.ShowAll();
        }
Exemplo n.º 17
0
        void OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args)
        {
            if (OutputMessageTextView.IsAtUrlTag)
            {
                return;
            }

            Gtk.Menu popup = args.Menu;

            popup.Append(new Gtk.SeparatorMenuItem());
            foreach (var menu_item in CreateContextMenuItems())
            {
                popup.Append(menu_item);
            }

            popup.ShowAll();
        }
        protected override bool OnPopupMenu()
        {
            Gtk.Menu mnu = new Gtk.Menu();

            Gtk.ImageMenuItem play = new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay, null);
            play.Activated += delegate(object sender, EventArgs a) {
                _view.PlayAlbum((CS_AlbumInfo)this.Model[Selection.FirstIndex]);
            };

            Gtk.ImageMenuItem edit = new Gtk.ImageMenuItem(Gtk.Stock.Edit, null);
            edit.Activated += delegate(object sender, EventArgs a) {
                _view.EditSheet(((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet());
            };

            Gtk.ImageMenuItem show_file = new Gtk.ImageMenuItem("Show in filesystem");
            show_file.Image      = new Gtk.Image(Gtk.Stock.Directory, Gtk.IconSize.Menu);
            show_file.Activated += delegate(object sender, EventArgs a) {
                _view.OpenContainingFolder((CS_AlbumInfo)this.Model[Selection.FirstIndex]);
            };

            mnu.Append(play);
            mnu.Append(new Gtk.SeparatorMenuItem());
            mnu.Append(edit);
            mnu.Append(show_file);

            CueSheet s = ((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet();

            if (Mp3Split.DllPresent())
            {
                if (Mp3Split.IsSupported(s.musicFileName()))
                {
                    Gtk.ImageMenuItem split = new Gtk.ImageMenuItem("Split & Write to location");
                    split.Image      = new Gtk.Image(Gtk.Stock.Convert, Gtk.IconSize.Menu);
                    split.Activated += delegate(object sender, EventArgs a) {
                        _view.MusicFileToDevice(((CS_AlbumInfo)this.Model[Selection.FirstIndex]).getSheet());
                    };
                    mnu.Append(split);
                }
            }

            mnu.ShowAll();
            mnu.Popup();

            return(false);
        }
Exemplo n.º 19
0
        void UpdateMenu()
        {
            //
            // Clear out the old list
            //
            foreach (Gtk.MenuItem oldItem in menu.Children)
            {
                menu.Remove(oldItem);
            }

            //
            // Build a new menu
            //

            // Add the "New Notebook..."
            Gtk.ImageMenuItem newNotebookMenuItem =
                new Gtk.ImageMenuItem(Catalog.GetString("_New notebook..."));
            newNotebookMenuItem.Image      = new Gtk.Image(NewNotebookIcon);
            newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
            newNotebookMenuItem.Show();
            menu.Append(newNotebookMenuItem);

            // Add the "(no notebook)" item at the top of the list
            NotebookMenuItem noNotebookMenuItem = new NotebookMenuItem(Note, null);

            noNotebookMenuItem.ShowAll();
            menu.Append(noNotebookMenuItem);

            // Add in all the real notebooks
            List <NotebookMenuItem> notebookMenuItems = GetNotebookMenuItems();

            if (notebookMenuItems.Count > 0)
            {
                Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
                separator.ShowAll();
                menu.Append(separator);

                foreach (NotebookMenuItem item in GetNotebookMenuItems())
                {
                    item.ShowAll();
                    menu.Append(item);
                }
            }
        }
Exemplo n.º 20
0
        public DamageControlTrayIcon()
        {
            Gtk.Application.Init();
            this.icon = new TrayIcon("DamageControl Monitor");

            InitializeSettings();
            Gtk.EventBox eb = new Gtk.EventBox();

            eb.ButtonPressEvent += new Gtk.ButtonPressEventHandler(IconClicked);
            pixbuf = new Gdk.Pixbuf(null, "gray-24.png");
            image  = new Gtk.Image(pixbuf);
            eb.Add(image);

            this.menu     = new Gtk.Menu();
            this.projects = MonoTray.LoadSettings();

            foreach (Project p in this.projects)
            {
                p.StartPolling();
            }

            Gtk.AccelGroup    ac_quit = new Gtk.AccelGroup();
            Gtk.ImageMenuItem it_quit = new Gtk.ImageMenuItem(Gtk.Stock.Quit, ac_quit);
            it_quit.Activated += new EventHandler(QuitSelected);


            Gtk.AccelGroup    ac_settings = new Gtk.AccelGroup();
            Gtk.ImageMenuItem it_settings = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, ac_settings);
            it_settings.Activated += new EventHandler(SettingsSelected);

            menu.Append(it_settings);
            menu.Append(it_quit);


            this.icon.Add(eb);

            this.icon.ShowAll();

            UpdateProxy();
            UpdateProjectList();

            Gtk.Application.Run();
        }
Exemplo n.º 21
0
        private void _OnOutputMessageTextViewPopulatePopup(object o, Gtk.PopulatePopupArgs args)
        {
            if (OutputMessageTextView.IsAtUrlTag)
            {
                return;
            }

            Gtk.Menu popup = args.Menu;

            // minimum version of any command below
            if (Frontend.EngineProtocolVersion < new Version(0, 8, 11))
            {
                return;
            }

            popup.Append(new Gtk.SeparatorMenuItem());

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12))
            {
                Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
                whois_item.Activated += _OnMenuWhoisItemActivated;
                popup.Append(whois_item);
            }

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 11))
            {
                Gtk.ImageMenuItem AddToContacts_item = new Gtk.ImageMenuItem(_("Add To Contacts"));
                AddToContacts_item.Activated += _OnMenuAddToContactsItemActivated;
                popup.Append(AddToContacts_item);
            }

            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12))
            {
                Gtk.ImageMenuItem invite_to_item      = new Gtk.ImageMenuItem(_("Invite to"));
                Gtk.Menu          invite_to_menu_item = new InviteToMenu(XmppProtocolManager,
                                                                         Frontend.MainWindow.ChatViewManager,
                                                                         PersonModel);
                invite_to_item.Submenu = invite_to_menu_item;
                popup.Append(invite_to_item);
            }

            popup.ShowAll();
        }
        protected override bool OnPopupMenu()
        {
            Gtk.Menu mnu=new Gtk.Menu();

            Gtk.ImageMenuItem play=new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay,null);
            play.Activated+=delegate(object sender,EventArgs a) {
                _view.PlayAlbum((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            Gtk.ImageMenuItem edit=new Gtk.ImageMenuItem(Gtk.Stock.Edit,null);
            edit.Activated+=delegate(object sender,EventArgs a) {
                _view.EditSheet(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
            };

            Gtk.ImageMenuItem show_file=new Gtk.ImageMenuItem("Show in filesystem");
            show_file.Image=new Gtk.Image(Gtk.Stock.Directory,Gtk.IconSize.Menu);
            show_file.Activated+=delegate(object sender, EventArgs a) {
                _view.OpenContainingFolder((CS_AlbumInfo) this.Model[Selection.FirstIndex]);
            };

            mnu.Append (play);
            mnu.Append (new Gtk.SeparatorMenuItem());
            mnu.Append (edit);
            mnu.Append (show_file);

            CueSheet s=((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ();
            if (Mp3Split.DllPresent()) {
                if (Mp3Split.IsSupported(s.musicFileName ())) {
                    Gtk.ImageMenuItem split=new Gtk.ImageMenuItem("Split & Write to location");
                    split.Image=new Gtk.Image(Gtk.Stock.Convert,Gtk.IconSize.Menu);
                    split.Activated+=delegate(object sender,EventArgs a) {
                        _view.MusicFileToDevice(((CS_AlbumInfo) this.Model[Selection.FirstIndex]).getSheet ());
                    };
                    mnu.Append (split);
                }
            }

            mnu.ShowAll ();
            mnu.Popup();

            return false;
        }
Exemplo n.º 23
0
        public static Gtk.MenuItem MakeMenuItem(Gtk.Menu menu, string label, string image_name, EventHandler e, bool enabled)
        {
            Gtk.ImageMenuItem i = new Gtk.ImageMenuItem(label);
            i.Activated += e;
            i.Sensitive  = enabled;
            i.Image      = Gtk.Image.NewFromIconName(image_name, Gtk.IconSize.Menu);

            menu.Append(i);
            i.Show();

            return(i);
        }
        protected override bool OnPopupMenu()
        {
            Gtk.Menu mnu = new Gtk.Menu();

            Gtk.ImageMenuItem play = new Gtk.ImageMenuItem(Gtk.Stock.MediaPlay, null);
            play.Activated += delegate(object sender, EventArgs a) {
                _view.PlayPlayList((CS_PlayList)this.Model[Selection.FirstIndex]);
            };

            //Gtk.ImageMenuItem edit=new Gtk.ImageMenuItem(Gtk.Stock.Edit,null);
            //edit.Activated+=delegate(object sender,EventArgs a) {
            //	_view.EditPlayList(((CS_PlayList) this.Model[Selection.FirstIndex]).getSheet ());
            //};

            mnu.Append(play);
            mnu.Append(new Gtk.SeparatorMenuItem());
            //mnu.Append (edit);
            mnu.ShowAll();
            mnu.Popup();

            return(false);
        }
Exemplo n.º 25
0
        public static Gtk.MenuItem MakeCheckMenuItem(Gtk.Menu menu, string label, EventHandler e, bool enabled, bool active, bool as_radio)
        {
            Gtk.CheckMenuItem i = new Gtk.CheckMenuItem(label);
            i.Activated  += e;
            i.Sensitive   = enabled;
            i.DrawAsRadio = as_radio;
            i.Active      = active;

            menu.Append(i);
            i.Show();

            return(i);
        }
Exemplo n.º 26
0
        Gtk.Menu GetRightClickMenu()
        {
            if (tray.TomboyTrayMenu != null)
            {
                tray.TomboyTrayMenu.Hide();
            }

            if (context_menu != null)
            {
                context_menu.Hide();
                return(context_menu);
            }

            context_menu = new Gtk.Menu();

            Gtk.AccelGroup accel_group = new Gtk.AccelGroup();
            context_menu.AccelGroup = accel_group;

            Gtk.ImageMenuItem item;

            sync_menu_item       = new Gtk.ImageMenuItem(Catalog.GetString("S_ynchronize Notes"));
            sync_menu_item.Image = new Gtk.Image(Gtk.Stock.Convert, Gtk.IconSize.Menu);
            UpdateMenuItems();
            Preferences.SettingChanged += Preferences_SettingChanged;
            sync_menu_item.Activated   += SyncNotes;
            context_menu.Append(sync_menu_item);

            context_menu.Append(new Gtk.SeparatorMenuItem());

            item            = new Gtk.ImageMenuItem(Catalog.GetString("_Preferences"));
            item.Image      = new Gtk.Image(Gtk.Stock.Preferences, Gtk.IconSize.Menu);
            item.Activated += ShowPreferences;
            context_menu.Append(item);

            item            = new Gtk.ImageMenuItem(Catalog.GetString("_Help"));
            item.Image      = new Gtk.Image(Gtk.Stock.Help, Gtk.IconSize.Menu);
            item.Activated += ShowHelpContents;
            context_menu.Append(item);

            item            = new Gtk.ImageMenuItem(Catalog.GetString("_About Tomboy"));
            item.Image      = new Gtk.Image(Gtk.Stock.About, Gtk.IconSize.Menu);
            item.Activated += ShowAbout;
            context_menu.Append(item);

            context_menu.Append(new Gtk.SeparatorMenuItem());

            item            = new Gtk.ImageMenuItem(Catalog.GetString("_Quit"));
            item.Image      = new Gtk.Image(Gtk.Stock.Quit, Gtk.IconSize.Menu);
            item.Activated += Quit;
            context_menu.Append(item);

            context_menu.ShowAll();
            return(context_menu);
        }
Exemplo n.º 27
0
        private void AddMenuItems(Gtk.Menu menu)
        {
            RemoveMenuItems(menu);

            NotebookNewNoteMenuItem item;

            Gtk.TreeModel model = NotebookManager.Notebooks;
            Gtk.TreeIter  iter;

            // Add in the "New Notebook..." menu item
            Gtk.ImageMenuItem newNotebookMenuItem =
                new Gtk.ImageMenuItem(Catalog.GetString("New Note_book..."));
            newNotebookMenuItem.Image      = new Gtk.Image(NewNotebookIcon);
            newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
            newNotebookMenuItem.ShowAll();
            menu.Append(newNotebookMenuItem);

            if (model.IterNChildren() > 0)
            {
                Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem();
                separator.ShowAll();
                menu.Append(separator);

                if (model.GetIterFirst(out iter) == true)
                {
                    do
                    {
                        Notebook notebook = model.GetValue(iter, 0) as Notebook;
                        item = new NotebookNewNoteMenuItem(notebook);
                        item.ShowAll();
                        menu.Append(item);
                    } while (model.IterNext(ref iter) == true);
                }
            }
#if MAC
            menu.ShowAll();
#endif
        }
Exemplo n.º 28
0
        protected virtual void OnTabMenuShown(object sender, EventArgs e)
        {
            Trace.Call(sender, e);

            foreach (var child in _TabMenu.Children)
            {
                _TabMenu.Remove(child);
            }
            var closeItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);

            closeItem.Activated += OnTabMenuCloseActivated;
            _TabMenu.Append(closeItem);
            _TabMenu.ShowAll();
        }
Exemplo n.º 29
0
        protected override void ShowPopupMenu(Gdk.Event ev)
        {
            Gtk.Menu menu = new Gtk.Menu();
            for (int i = 0; i < ObjectGroupEditor.ObjectNames.Length; i++)
            {
                if (i >= 2 && i <= 4) // Skip "Pointer" objects
                {
                    continue;
                }
                Gtk.MenuItem item = new Gtk.MenuItem("Add " + ObjectGroupEditor.ObjectNames[i]);
                menu.Append(item);

                int index = i;

                item.Activated += (sender, args) => {
                    SetSelectedIndex(ObjectGroup.AddObject((ObjectType)index));
                };
            }

            if (HoveringIndex != -1)
            {
                menu.Append(new Gtk.SeparatorMenuItem());

                Gtk.MenuItem deleteItem = new Gtk.MenuItem("Delete");
                deleteItem.Activated += (sender, args) => {
                    if (SelectedIndex != -1)
                    {
                        ObjectGroup.RemoveObject(SelectedIndex);
                    }
                };
                menu.Append(deleteItem);
            }

            menu.AttachToWidget(this, null);
            menu.ShowAll();
            menu.PopupAtPointer(ev);
        }
        static Gtk.Menu FromMenu(ContextMenu menu)
        {
            var result = new Gtk.Menu();

            foreach (var menuItem in menu.Items)
            {
                var item = CreateMenuItem(menuItem);
                if (item != null)
                {
                    result.Append(item);
                }
            }

            return(result);
        }
Exemplo n.º 31
0
        private void PopulateGoogleOptionMenu(GoogleAccountManager manager, GoogleAccount changed_account)
        {
            Gtk.Menu menu = new Gtk.Menu();
            this.account = changed_account;
            int pos = -1;

            accounts = manager.GetAccounts();
            if (accounts == null || accounts.Count == 0)
            {
                Gtk.MenuItem item = new Gtk.MenuItem(Catalog.GetString("(No Gallery)"));
                menu.Append(item);
                gallery_optionmenu.Sensitive = false;
                edit_button.Sensitive        = false;
            }
            else
            {
                int i = 0;
                foreach (GoogleAccount account in accounts)
                {
                    if (account == changed_account)
                    {
                        pos = i;
                    }

                    Gtk.MenuItem item = new Gtk.MenuItem(account.Username);
                    menu.Append(item);
                    i++;
                }
                gallery_optionmenu.Sensitive = true;
                edit_button.Sensitive        = true;
            }

            menu.ShowAll();
            gallery_optionmenu.Menu = menu;
            gallery_optionmenu.SetHistory((uint)pos);
        }
Exemplo n.º 32
0
        public void AddAccelerator(EventHandler handler,
                                   uint key,
                                   Gdk.ModifierType modifiers,
                                   Gtk.AccelFlags flags)
        {
            Gtk.MenuItem foo = new Gtk.MenuItem();
            foo.Activated += handler;
            foo.AddAccelerator("activate",
                               accel_group,
                               key,
                               modifiers,
                               flags);
            foo.Show();

            fake_menu.Append(foo);
        }
Exemplo n.º 33
0
		void nsIContextMenuListener2.OnShowContextMenu(uint aContextFlags, nsIContextMenuInfo info)
		{
			// if we don't have a target node, we can't do anything by default.  this happens in XUL forms (i.e. about:config)
			if (info.GetTargetNodeAttribute() == null)
				return;
			
			ContextMenu menu = new ContextMenu();
			
			// no default items are added when the context menu is disabled
			if (!this.NoDefaultContextMenu)
			{
				List<MenuItem> optionals = new List<MenuItem>();
				
				if (this.CanUndo || this.CanRedo)
				{
					optionals.Add(new MenuItem("Undo", delegate { Undo(); }));
					optionals.Add(new MenuItem("Redo", delegate { Redo(); }));
					
					optionals[0].Enabled = this.CanUndo;
					optionals[1].Enabled = this.CanRedo;
				}
				else
				{
					optionals.Add(new MenuItem("Back", delegate { GoBack(); }));
					optionals.Add(new MenuItem("Forward", delegate { GoForward(); }));
					
					optionals[0].Enabled = this.CanGoBack;
					optionals[1].Enabled = this.CanGoForward;
				}
				
				optionals.Add(new MenuItem("-"));
				
				if (this.CanCopyImageContents)
					optionals.Add(new MenuItem("Copy Image Contents", delegate { CopyImageContents(); }));
				
				if (this.CanCopyImageLocation)
					optionals.Add(new MenuItem("Copy Image Location", delegate { CopyImageLocation(); }));
				
				if (this.CanCopyLinkLocation)
					optionals.Add(new MenuItem("Copy Link Location", delegate { CopyLinkLocation(); }));
				
				if (this.CanCopySelection)
					optionals.Add(new MenuItem("Copy Selection", delegate { CopySelection(); }));
				
				MenuItem mnuSelectAll = new MenuItem("Select All");
				mnuSelectAll.Click += delegate { SelectAll(); };

				GeckoDomDocument doc = GeckoDomDocument.CreateDomDocumentWraper(info.GetTargetNodeAttribute().GetOwnerDocumentAttribute());

				string viewSourceUrl = (doc == null) ? null : Convert.ToString(doc.Uri);
				
				MenuItem mnuViewSource = new MenuItem("View Source");
				mnuViewSource.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuViewSource.Click += delegate { ViewSource(viewSourceUrl); };

				MenuItem mnuOpenInSystemBrowser = new MenuItem("View In System Browser");//nice for debugging with firefox/firebug
				mnuOpenInSystemBrowser.Enabled = !string.IsNullOrEmpty(viewSourceUrl);
				mnuOpenInSystemBrowser.Click += delegate { ViewInSystemBrowser(viewSourceUrl); };


				string properties = (doc != null && doc.Uri == Document.Uri) ? "Page Properties" : "IFRAME Properties";
				
				MenuItem mnuProperties = new MenuItem(properties);
				mnuProperties.Enabled = doc != null;
				mnuProperties.Click += delegate { ShowPageProperties(doc); };
				
				menu.MenuItems.AddRange(optionals.ToArray());
				menu.MenuItems.Add(mnuSelectAll);
				menu.MenuItems.Add("-");
				menu.MenuItems.Add(mnuViewSource);
				menu.MenuItems.Add(mnuOpenInSystemBrowser);
				menu.MenuItems.Add(mnuProperties);
			}

			// get image urls
			Uri backgroundImageSrc = null, imageSrc = null;
			nsIURI src;
			try
			{
				src = info.GetBackgroundImageSrcAttribute();
				backgroundImageSrc = src.ToUri();
				Marshal.ReleaseComObject( src );
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}

			try
			{
				src = info.GetImageSrcAttribute();
				if ( src != null )
				{
					imageSrc = src.ToUri();
					Marshal.ReleaseComObject( src );
				}
			}
			catch (COMException comException)
			{
				if ((comException.ErrorCode & 0xFFFFFFFF) != 0x80004005)
					throw comException;
			}
			
			// get associated link.  note that this needs to be done manually because GetAssociatedLink returns a non-zero
			// result when no associated link is available, so an exception would be thrown by nsString.Get()
			string associatedLink = null;
			try
			{
				using (nsAString str = new nsAString())
				{
					info.GetAssociatedLinkAttribute(str);
					associatedLink = str.ToString();
				}
			}
			catch (COMException comException) { }			
			
			GeckoContextMenuEventArgs e = new GeckoContextMenuEventArgs(
				PointToClient(MousePosition), menu, associatedLink, backgroundImageSrc, imageSrc,
				GeckoNode.Create(Xpcom.QueryInterface<nsIDOMNode>(info.GetTargetNodeAttribute()))
				);
			
			OnShowContextMenu(e);
			
			if (e.ContextMenu != null && e.ContextMenu.MenuItems.Count > 0)
			{
#if GTK
				// When using GTK we can't use SWF to display the context menu: SWF displays
				// the context menu and then tries to track the mouse so that it knows when to
				// close the context menu. However, GTK intercepts the mouse click before SWF gets
				// it, so the menu never closes. Instead we display a GTK menu and translate
				// the SWF menu items into Gtk.MenuItems.
				// TODO: currently this code only handles text menu items. Would be nice to also
				// translate images etc.
				var popupMenu = new Gtk.Menu();

				foreach (MenuItem swfMenuItem in e.ContextMenu.MenuItems)
				{
					var gtkMenuItem = new Gtk.MenuItem(swfMenuItem.Text);
					gtkMenuItem.Sensitive = swfMenuItem.Enabled;
					MenuItem origMenuItem = swfMenuItem;
					gtkMenuItem.Activated += (sender, ev) => origMenuItem.PerformClick();
					popupMenu.Append(gtkMenuItem);
				}
				popupMenu.ShowAll();
				popupMenu.Popup();
#else
				e.ContextMenu.Show(this, e.Location);
#endif
			}
		}
Exemplo n.º 34
0
		Gtk.Menu GetRightClickMenu ()
		{
			if (tray.TomboyTrayMenu != null)
				tray.TomboyTrayMenu.Hide ();

			if (context_menu != null) {
				context_menu.Hide ();
				return context_menu;
			}

			context_menu = new Gtk.Menu ();

			Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
			context_menu.AccelGroup = accel_group;

			Gtk.ImageMenuItem item;

			sync_menu_item = new Gtk.ImageMenuItem (Catalog.GetString ("S_ynchronize Notes"));
			sync_menu_item.Image = new Gtk.Image (Gtk.Stock.Convert, Gtk.IconSize.Menu);
			UpdateMenuItems();
			Preferences.SettingChanged += Preferences_SettingChanged;
			sync_menu_item.Activated += SyncNotes;
			context_menu.Append (sync_menu_item);

			context_menu.Append (new Gtk.SeparatorMenuItem ());

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Preferences"));
			item.Image = new Gtk.Image (Gtk.Stock.Preferences, Gtk.IconSize.Menu);
			item.Activated += ShowPreferences;
			context_menu.Append (item);

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Help"));
			item.Image = new Gtk.Image (Gtk.Stock.Help, Gtk.IconSize.Menu);
			item.Activated += ShowHelpContents;
			context_menu.Append (item);

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_About Tomboy"));
			item.Image = new Gtk.Image (Gtk.Stock.About, Gtk.IconSize.Menu);
			item.Activated += ShowAbout;
			context_menu.Append (item);

			context_menu.Append (new Gtk.SeparatorMenuItem ());

			item = new Gtk.ImageMenuItem (Catalog.GetString ("_Quit"));
			item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
			item.Activated += Quit;
			context_menu.Append (item);

			context_menu.ShowAll ();
			return context_menu;
		}
Exemplo n.º 35
0
        private void BuildMenu()
        {
            var menuBar = new Gtk.MenuBar();
            var miFile = new Gtk.MenuItem( "File" );
            var mFile = new Gtk.Menu();
            var miHelp = new Gtk.MenuItem( "Help" );
            var mHelp = new Gtk.Menu();
            var miView = new Gtk.MenuItem( "View" );
            var mView = new Gtk.Menu();

            miFile.Submenu = mFile;
            mFile.Append( this.actQuit.CreateMenuItem() );
            miHelp.Submenu = mHelp;
            mHelp.Append( this.actAbout.CreateMenuItem() );
            miView.Submenu = mView;
            mView.Append( this.actViewBoxes.CreateMenuItem() );
            mView.Append( this.actViewFrames.CreateMenuItem() );
            mView.Append( this.actViewNotebook.CreateMenuItem() );
            mView.Append( this.actViewDrawing.CreateMenuItem() );

            menuBar.Append( miFile );
            menuBar.Append( miView );
            menuBar.Append( miHelp );
            this.vbMain.PackStart( menuBar, false, false, 5 );
        }
		private void PopulateAlbumOptionMenu (PicasaWeb picasa)
		{
			if (picasa != null) {
				try {
					albums = picasa.GetAlbums();
				} catch {
					Console.WriteLine("Can't get the albums");
					albums = null;
					picasa = null;
				}
			}

			Gtk.Menu menu = new Gtk.Menu ();

			bool disconnected = picasa == null || !account.Connected || albums == null;

			if (disconnected || albums.Count == 0) {
				string msg = disconnected ? Catalog.GetString ("(Not Connected)")
					: Catalog.GetString ("(No Albums)");

				Gtk.MenuItem item = new Gtk.MenuItem (msg);
				menu.Append (item);

				export_button.Sensitive = false;
				album_optionmenu.Sensitive = false;
				album_button.Sensitive = false;

				if (disconnected)
					album_button.Sensitive = false;
			} else {
				foreach (PicasaAlbum album in albums.AllValues) {
					System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

					label_builder.Append (album.Title);
					label_builder.Append (" (" + album.PicturesCount + ")");

					Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
					((Gtk.Label)item.Child).UseUnderline = false;
					menu.Append (item);
				}

				export_button.Sensitive = items.Length > 0;
				album_optionmenu.Sensitive = true;
				album_button.Sensitive = true;
			}

			menu.ShowAll ();
			album_optionmenu.Menu = menu;
		}
Exemplo n.º 37
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width < -1 || heigth < -1) {
                width = -1;
                heigth = -1;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x < 0 || y < 0) {
                x = 0;
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            Gtk.AccelGroup agrp = new Gtk.AccelGroup();
            Gtk.AccelKey   akey;
            AddAccelGroup(agrp);

            // Menu
            MenuBar = new Gtk.MenuBar();
            Gtk.Menu menu;
            Gtk.MenuItem item;
            Gtk.ImageMenuItem image_item;

            // Menu - File
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_File"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp);
            item.Activated += new EventHandler(_OnPreferencesButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp);
            item.Activated += new EventHandler(_OnQuitButtonClicked);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            // Menu - Server
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Server"));
            item.Submenu = menu;
            MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(_("_Quick Connect"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu);
            image_item.Activated += OnServerQuickConnectButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp);
            image_item.Activated += OnServerAddButtonClicked;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Manage"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu);
            image_item.Activated += OnServerManageServersButtonClicked;
            menu.Append(image_item);

            // Menu - Chat
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Chat"));
            item.Submenu = menu;
            MenuBar.Append(item);

            _OpenChatMenuItem = new Gtk.ImageMenuItem(_("Open / Join Chat"));
            _OpenChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu);
            _OpenChatMenuItem.Activated += OnOpenChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.L;
            _OpenChatMenuItem.AddAccelerator("activate", agrp, akey);
            _OpenChatMenuItem.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(_OpenChatMenuItem);

            _FindGroupChatMenuItem = new Gtk.ImageMenuItem(_("_Find Group Chat"));
            _FindGroupChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu);
            _FindGroupChatMenuItem.Activated += OnChatFindGroupChatButtonClicked;
            _FindGroupChatMenuItem.Sensitive = false;
            menu.Append(_FindGroupChatMenuItem);

            image_item = new Gtk.ImageMenuItem(_("C_lear All Activity"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu);
            image_item.Activated += OnChatClearAllActivityButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Next Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoForward, Gtk.IconSize.Menu);
            image_item.Activated += OnNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Down;
            image_item.AddAccelerator("activate", agrp, akey);
            image_item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Previous Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoBack, Gtk.IconSize.Menu);
            image_item.Activated += OnPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Up;
            image_item.AddAccelerator("activate", agrp, akey);
            image_item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            /*
            // TODO: make a radio item for each chat hotkey
            Gtk.RadioMenuItem radio_item;
            radio_item = new Gtk.RadioMenuItem();
            radio_item = new Gtk.RadioMenuItem(radio_item);
            radio_item = new Gtk.RadioMenuItem(radio_item);

            menu.Append(new Gtk.SeparatorMenuItem());
            */

            /*
            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Find, agrp);
            image_item.Activated += OnFindChatMenuItemActivated;
            menu.Append(image_item);

            item = new Gtk.MenuItem(_("Find _Next"));
            item.Activated += OnFindNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.MenuItem(_("Find _Previous"));
            item.Activated += OnFindPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);
            */

            // ROFL: the empty code statement below is needed to keep stupid
            // gettext away from using all the commented code from above as
            // translator comment
            ;
            _OpenLogChatMenuItem = new Gtk.ImageMenuItem(_("Open Log"));
            _OpenLogChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open,
                                                       Gtk.IconSize.Menu);
            _OpenLogChatMenuItem.Activated += OnOpenLogChatMenuItemActivated;
            _OpenLogChatMenuItem.Sensitive = false;
            _OpenLogChatMenuItem.NoShowAll = true;
            menu.Append(_OpenLogChatMenuItem);

            _CloseChatMenuItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, agrp);
            _CloseChatMenuItem.Activated += OnCloseChatMenuItemActivated;
            _CloseChatMenuItem.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(_CloseChatMenuItem);

            // Menu - Engine
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Engine"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.MenuItem(_("_Use Local Engine"));
            item.Activated += new EventHandler(_OnUseLocalEngineButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Add Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnAddRemoteEngineButtonClicked);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Switch Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnSwitchRemoteEngineButtonClicked);
            menu.Append(image_item);

            // Menu - View
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_View"));
            item.Submenu = menu;
            MenuBar.Append(item);

            item = new Gtk.CheckMenuItem(_("_Caret Mode"));
            item.Activated += new EventHandler(_OnCaretModeButtonClicked);
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F7;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            item = new Gtk.CheckMenuItem(_("_Browse Mode"));
            item.Activated += delegate {
                try {
                    _Notebook.IsBrowseModeEnabled = !_Notebook.IsBrowseModeEnabled;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F8;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            ShowMenuBarMenuItem = new Gtk.CheckMenuItem(_("Show _Menubar"));
            ShowMenuBarMenuItem.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"];
            ShowMenuBarMenuItem.Activated += OnShowMenuBarMenuItemActivated;
            menu.Append(ShowMenuBarMenuItem);

            ShowStatusBarMenuItem = new Gtk.CheckMenuItem(_("Show _Status Bar"));
            ShowStatusBarMenuItem.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"];
            ShowStatusBarMenuItem.Activated += OnShowStatusBarMenuItemActivated;
            menu.Append(ShowStatusBarMenuItem);

            JoinWidget = new JoinWidget();
            JoinWidget.NoShowAll = true;
            JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"];
            JoinWidget.Activated += OnJoinWidgetActivated;

            ShowQuickJoinMenuItem = new Gtk.CheckMenuItem(_("Show _Quick Join"));
            ShowQuickJoinMenuItem.Active = JoinWidget.Visible;
            ShowQuickJoinMenuItem.Activated += OnShowQuickJoinMenuItemActivated;
            menu.Append(ShowQuickJoinMenuItem);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Fullscreen, agrp);
            item.Activated += delegate {
                try {
                    IsFullscreen = !IsFullscreen;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F11;
            item.AddAccelerator("activate", agrp, akey);
            item.AccelCanActivate += AccelCanActivateSensitive;
            menu.Append(item);

            // Menu - Help
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Help"));
            item.Submenu = menu;
            MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.About, agrp);
            image_item.Activated += new EventHandler(_OnAboutButtonClicked);
            menu.Append(image_item);

            MenuBar.ShowAll();
            MenuBar.NoShowAll = true;
            MenuBar.Visible = ShowMenuBarMenuItem.Active;

            // TODO: network treeview
            _Notebook = new Notebook();
            _Notebook.SwitchPage += OnNotebookSwitchPage;
            _Notebook.FocusInEvent += OnNotebookFocusInEvent;

            _ChatViewManager = new ChatViewManager(_Notebook, null);
            Assembly asm = Assembly.GetExecutingAssembly();
            _ChatViewManager.Load(asm);
            _ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            _ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            _ChatViewManager.ChatSynced += OnChatViewManagerChatSynced;
            _ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            _StatusIconManager = new StatusIconManager(this, _ChatViewManager);
            #endif
            #if INDICATE_SHARP
            _IndicateManager = new IndicateManager(this, _ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            _NotifyManager = new NotifyManager(this, _ChatViewManager);
            #endif
            #if IPC_DBUS
            _NetworkManager = new NetworkManager(_ChatViewManager);
            #endif

            _UI = new GnomeUI(_ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            _EngineManager = new EngineManager(Frontend.FrontendConfig, _UI);

            _Entry = new Entry(_ChatViewManager);
            var entryScrolledWindow = new Gtk.ScrolledWindow();
            entryScrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
            entryScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
            entryScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful heigth
                var layout = _Entry.CreatePangoLayout("Qp");
                int lineWidth, lineHeigth;
                layout.GetPixelSize(out lineHeigth, out lineHeigth);
                var text = Entry.Text;
                var newLines = text.Count(f => f == '\n');
                // cap to 1-3 lines
                if (text.Length > 0) {
                    newLines++;
                    newLines = Math.Max(newLines, 1);
                    newLines = Math.Min(newLines, 3);
                } else {
                    newLines = 1;
                }
                // use text heigth + a bit extra
                var bestSize = new Gtk.Requisition() {
                    Height = (lineHeigth * newLines) + 5
                };
                args.Requisition = bestSize;
            };
            entryScrolledWindow.Add(_Entry);

            _ProgressBar = new Gtk.ProgressBar();
            _ProgressBar.BarStyle = Gtk.ProgressBarStyle.Continuous;

            MenuHBox = new Gtk.HBox();
            MenuHBox.PackStart(MenuBar, false, false, 0);
            MenuHBox.PackEnd(JoinWidget, false, false, 0);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuHBox, false, false, 0);
            vbox.PackStart(_Notebook, true, true, 0);
            vbox.PackStart(entryScrolledWindow, false, false, 0);

            _NetworkStatusbar = new Gtk.Statusbar();
            _NetworkStatusbar.WidthRequest = 300;
            _NetworkStatusbar.HasResizeGrip = false;

            _Statusbar = new Gtk.Statusbar();
            _Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(_NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(_Statusbar, true, true, 0);

            StatusHBox = new Gtk.HBox();
            StatusHBox.PackStart(status_bar_hbox);
            StatusHBox.PackStart(_ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = ShowStatusBarMenuItem.Active;

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);
        }
Exemplo n.º 38
0
        private void PopulateAlbums()
        {
            Gtk.Menu menu = new Gtk.Menu ();
            if (gallery.Version == GalleryVersion.Version1) {
                Gtk.MenuItem top_item = new Gtk.MenuItem (Catalog.GetString ("(TopLevel)"));
                menu.Append (top_item);
            }

            foreach (Album album in gallery.Albums) {
                System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

                for (int i=0; i < album.Parents.Count; i++) {
                    label_builder.Append ("  ");
                }

                label_builder.Append (album.Title);
                album_optionmenu.AppendText(label_builder.ToString());
            }

            album_optionmenu.Sensitive = true;
            menu.ShowAll ();
        }
Exemplo n.º 39
0
        private void BuildMenu()
        {
            var accelerators = new Gtk.AccelGroup();
            var mMain = new Gtk.MenuBar();
            var mFile = new Gtk.Menu();
            var mEdit = new Gtk.Menu();
            var mView = new Gtk.Menu();
            var mTools = new Gtk.Menu();
            var mHelp = new Gtk.Menu();
            var miFile = new Gtk.MenuItem( "_File" );
            var miEdit = new Gtk.MenuItem( "_Edit" );
            var miView = new Gtk.MenuItem( "_View" );
            var miTools = new Gtk.MenuItem( "_Tools" );
            var miHelp = new Gtk.MenuItem( "_Help" );

            // Menu items
            var opNew = this.actNew.CreateMenuItem();
            opNew.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opOpen = this.actOpen.CreateMenuItem();
            opOpen.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.o, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opSave = this.actSave.CreateMenuItem();
            opSave.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.s, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opQuit = this.actQuit.CreateMenuItem();
            opQuit.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opAdd = this.actAdd.CreateMenuItem();
            opAdd.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.plus, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opRemove = this.actRemove.CreateMenuItem();
            opRemove.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.Delete, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opFind = this.actFind.CreateMenuItem();
            opFind.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.f, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible ) );

            var opFindAgain = this.actFindAgain.CreateMenuItem();
            opFindAgain.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.F3, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opSettings = this.actSettings.CreateMenuItem();
            opSettings.AddAccelerator( "activate", accelerators, new Gtk.AccelKey(
                Gdk.Key.F2, Gdk.ModifierType.None, Gtk.AccelFlags.Visible ) );

            var opView = new Gtk.CheckMenuItem( this.actViewCard.Label );
            opView.Active = true;
            opView.Activated += (sender, e) => this.actViewCard.Activate();

            // Create menu structure
            mMain.Append( miFile );
            miFile.Submenu = mFile;
            mFile.Append( opNew );
            mFile.Append( opOpen );
            mFile.Append( this.actImport.CreateMenuItem() );
            mFile.Append( new Gtk.SeparatorMenuItem() );
            mFile.Append( opSave );
            mFile.Append( this.actExport.CreateMenuItem() );
            mFile.Append( new Gtk.SeparatorMenuItem() );
            mFile.Append( opQuit );

            mMain.Append( miEdit );
            miEdit.Submenu = mEdit;
            mEdit.Append( opAdd );
            mEdit.Append( opRemove );
            mEdit.Append( this.actModify.CreateMenuItem() );
            mEdit.Append( this.actConnect.CreateMenuItem() );
            mEdit.Append( new Gtk.SeparatorMenuItem() );
            mEdit.Append( opFind );
            mEdit.Append( opFindAgain );
            mEdit.Append( new Gtk.SeparatorMenuItem() );
            mEdit.Append( opSettings );

            mMain.Append( miView );
            miView.Submenu = mView;
            mView.Append( opView );

            mMain.Append( miTools );
            miTools.Submenu = mTools;
            mTools.Append( this.actSort.CreateMenuItem() );

            mMain.Append( miHelp );
            miHelp.Submenu = mHelp;
            mHelp.Append( this.actAbout.CreateMenuItem() );

            this.AddAccelGroup( accelerators );
            this.vbMain.PackStart( mMain, false, false, 0 );
        }
Exemplo n.º 40
0
        private void PopulateAlbumOptionMenu(Gallery gallery)
        {
            System.Collections.ArrayList albums = null;
            if (gallery != null) {
                //gallery.FetchAlbumsPrune ();
                try {
                    gallery.FetchAlbums ();
                    albums = gallery.Albums;
                } catch (GalleryCommandException e) {
                    gallery.PopupException (e, export_dialog);
                    return;
                }
            }

            Gtk.Menu menu = new Gtk.Menu ();

            bool disconnected = gallery == null || !account.Connected || albums == null;

            if (disconnected || albums.Count == 0) {
                string msg = disconnected ? Catalog.GetString ("(Not Connected)")
                    : Catalog.GetString ("(No Albums)");

                Gtk.MenuItem item = new Gtk.MenuItem (msg);
                menu.Append (item);

                export_button.Sensitive = false;
                album_optionmenu.Sensitive = false;
                album_button.Sensitive = false;

                if (disconnected)
                    album_button.Sensitive = false;
            } else {
                foreach (Album album in albums) {
                    System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

                    for (int i=0; i < album.Parents.Count; i++) {
                        label_builder.Append ("  ");
                    }
                    label_builder.Append (album.Title);

                    Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
                    ((Gtk.Label)item.Child).UseUnderline = false;
                    menu.Append (item);

                        AlbumPermission add_permission = album.Perms & AlbumPermission.Add;

                    if (add_permission == 0)
                        item.Sensitive = false;
                }

                export_button.Sensitive = items.Length > 0;
                album_optionmenu.Sensitive = true;
                album_button.Sensitive = true;
            }

            menu.ShowAll ();
            album_optionmenu.Menu = menu;
        }
Exemplo n.º 41
0
        private void ShowPopup()
        {
            if ((presets == null) || (presets.Length == 0))
                return;

            EventHandler onActivated = delegate(object sender, EventArgs e) {
                Gtk.MenuItem item = (Gtk.MenuItem)sender;

                SetPlaceholderText(false);

                if (Text.Length > 0) {
                    if ((!Text.TrimEnd().EndsWith(" or")) && (!Text.TrimEnd().EndsWith(" OR")) &&
                        (!Text.TrimEnd().EndsWith(" and")) && (!Text.TrimEnd().EndsWith(" AND"))) {

                        if (!Text.EndsWith(" "))
                            Text += " ";

                        Text += "and ";
                    } else {
                        if (!Text.EndsWith(" "))
                            Text += " ";
                    }
                }

                var p = (SearchEntryPreset)item.Data["preset"];

                if (!string.IsNullOrEmpty(p.Value)) {
                    Text += p.Value;

                    if (!string.IsNullOrEmpty(p.Suggestion)) {
                        Text += " " + p.Suggestion;

                        GrabFocus();
                        SelectRegion(Text.Length - p.Suggestion.Length, Text.Length);
                    } else {
                        GrabFocus();
                        SelectRegion(Text.Length, Text.Length);
                    }
                }
            };

            if (presetsChanged) {

                if (popup != null)
                    popup.Dispose();

                popup = new Gtk.Menu();

                foreach (var p in presets) {
                    Gtk.MenuItem item = new Gtk.MenuItem(p.Caption);
                    item.Activated += onActivated;
                    item.Data["preset"] = p;

                    popup.Append(item);
                }

                popup.ShowAll();
                presetsChanged = false;
            }

            popup.Popup();
        }
Exemplo n.º 42
0
 void UpdateRoutesButton()
 {
     var menu = new Gtk.Menu();
     foreach(var route in routesAtDay)
     {
         var name = String.Format("МЛ №{0} - {1}", route.Id, route.Driver.ShortName);
         var item = new MenuItemId<RouteList>(name);
         item.ID = route;
         item.Activated += AddToRLItem_Activated;
         menu.Append(item);
     }
     menu.ShowAll();
     menuAddToRL.Menu = menu;
 }
Exemplo n.º 43
0
 private void BuildPopup()
 {
     popup = new Gtk.Menu();
     popup.Append( this.actAdd.CreateMenuItem() );
     popup.Append( this.actRemove.CreateMenuItem() );
     popup.Append( this.actModify.CreateMenuItem() );
     popup.Append( this.actSettings.CreateMenuItem() );
     popup.ShowAll();
 }
Exemplo n.º 44
0
		private void ArrowButton_Click(object sender, EventArgs e)
		{
			Gtk.Menu menu = new Gtk.Menu();
			
			foreach (string childId in _dummyFam.Children)
			{
				GedcomIndividualRecord child = (GedcomIndividualRecord)_database[childId];
				
				string name = child.GetName().Name;
				
				Gtk.ImageMenuItem menuItem = new Gtk.ImageMenuItem(name);
				menuItem.Image = new Gtk.Image(Gtk.Stock.JumpTo, Gtk.IconSize.Menu);
				menuItem.ShowAll();
				
				menu.Append(menuItem);
								
				menuItem.Activated += ChildMenu_Activated;
			}
			
			menu.Popup();
		}
Exemplo n.º 45
0
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;
            _Name = _ChatModel.Name;
            Name = _Name;

            // TextTags
            Gtk.TextTagTable ttt = new Gtk.TextTagTable();
            _OutputTextTagTable = ttt;
            Gtk.TextTag tt;
            Pango.FontDescription fd;

            tt = new Gtk.TextTag("bold");
            fd = new Pango.FontDescription();
            fd.Weight = Pango.Weight.Bold;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("italic");
            fd = new Pango.FontDescription();
            fd.Style = Pango.Style.Italic;
            tt.FontDesc = fd;
            ttt.Add(tt);

            tt = new Gtk.TextTag("underline");
            tt.Underline = Pango.Underline.Single;
            ttt.Add(tt);

            tt = new Gtk.TextTag("url");
            tt.Underline = Pango.Underline.Single;
            tt.Foreground = "darkblue";
            tt.TextEvent += new Gtk.TextEventHandler(_OnTextTagUrlTextEvent);
            fd = new Pango.FontDescription();
            tt.FontDesc = fd;
            ttt.Add(tt);

            Gtk.TextView tv = new Gtk.TextView();
            tv.Buffer = new Gtk.TextBuffer(ttt);
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.Editable = false;
            //tv.CursorVisible = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.Buffer.Changed += new EventHandler(_OnTextBufferChanged);
            tv.MotionNotifyEvent += new Gtk.MotionNotifyEventHandler(_OnMotionNotifyEvent);
            _OutputTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Add(_OutputTextView);
            _OutputScrolledWindow = sw;

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();
            _TabLabel.Text = _Name;

            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();
        }
Exemplo n.º 46
0
        public MainWindow()
            : base("Smuxi")
        {
            // restore window size / position
            int width, heigth;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"] != null) {
                width  = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Width"];
            } else {
                width = 800;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"] != null) {
                heigth = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/Heigth"];
            } else {
                heigth = 600;
            }
            if (width == -1 && heigth == -1) {
                SetDefaultSize(800, 600);
                Maximize();
            } else if (width == 0 && heigth == 0) {
                // HACK: map 0/0 to default size as it crashes on Windows :/
                SetDefaultSize(800, 600);
            } else {
                SetDefaultSize(width, heigth);
            }

            int x, y;
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"] != null) {
                x = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/XPosition"];
            } else {
                x = 0;
            }
            if (Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"] != null) {
                y = (int) Frontend.FrontendConfig[Frontend.UIName + "/Interface/YPosition"];
            } else {
                y = 0;
            }
            if (x == 0 && y == 0) {
                SetPosition(Gtk.WindowPosition.Center);
            } else {
                Move(x, y);
            }

            DeleteEvent += OnDeleteEvent;
            FocusInEvent += OnFocusInEvent;
            FocusOutEvent += OnFocusOutEvent;
            WindowStateEvent += OnWindowStateEvent;

            Gtk.AccelGroup agrp = new Gtk.AccelGroup();
            Gtk.AccelKey   akey;
            AddAccelGroup(agrp);

            // Menu
            _MenuBar = new Gtk.MenuBar();
            Gtk.Menu menu;
            Gtk.MenuItem item;
            Gtk.ImageMenuItem image_item;

            // Menu - File
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_File"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Preferences, agrp);
            item.Activated += new EventHandler(_OnPreferencesButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            item = new Gtk.ImageMenuItem(Gtk.Stock.Quit, agrp);
            item.Activated += new EventHandler(_OnQuitButtonClicked);
            menu.Append(item);

            // Menu - Server
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Server"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(_("_Quick Connect"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Connect, Gtk.IconSize.Menu);
            image_item.Activated += OnServerQuickConnectButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Add, agrp);
            image_item.Activated += OnServerAddButtonClicked;
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Manage"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Edit, Gtk.IconSize.Menu);
            image_item.Activated += OnServerManageServersButtonClicked;
            menu.Append(image_item);

            // Menu - Chat
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Chat"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            _OpenChatMenuItem = new Gtk.ImageMenuItem(_("Open / Join Chat"));
            _OpenChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Menu);
            _OpenChatMenuItem.Activated += OnChatOpenChatButtonClicked;
            _OpenChatMenuItem.Sensitive = false;
            menu.Append(_OpenChatMenuItem);

            _FindGroupChatMenuItem = new Gtk.ImageMenuItem(_("_Find Group Chat"));
            _FindGroupChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Menu);
            _FindGroupChatMenuItem.Activated += OnChatFindGroupChatButtonClicked;
            _FindGroupChatMenuItem.Sensitive = false;
            menu.Append(_FindGroupChatMenuItem);

            image_item = new Gtk.ImageMenuItem(_("C_lear All Activity"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu);
            image_item.Activated += OnChatClearAllActivityButtonClicked;
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Next Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoForward, Gtk.IconSize.Menu);
            image_item.Activated += OnNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Down;
            image_item.AddAccelerator("activate", agrp, akey);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Previous Chat"));
            image_item.Image = new Gtk.Image(Gtk.Stock.GoBack, Gtk.IconSize.Menu);
            image_item.Activated += OnPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.Page_Up;
            image_item.AddAccelerator("activate", agrp, akey);
            menu.Append(image_item);

            menu.Append(new Gtk.SeparatorMenuItem());

            /*
            // TODO: make a radio item for each chat hotkey
            Gtk.RadioMenuItem radio_item;
            radio_item = new Gtk.RadioMenuItem();
            radio_item = new Gtk.RadioMenuItem(radio_item);
            radio_item = new Gtk.RadioMenuItem(radio_item);

            menu.Append(new Gtk.SeparatorMenuItem());
            */

            /*
            image_item = new Gtk.ImageMenuItem(Gtk.Stock.Find, agrp);
            image_item.Activated += OnFindChatMenuItemActivated;
            menu.Append(image_item);

            item = new Gtk.MenuItem(_("Find _Next"));
            item.Activated += OnFindNextChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.MenuItem(_("Find _Previous"));
            item.Activated += OnFindPreviousChatMenuItemActivated;
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.AccelMods = Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask;
            akey.Key = Gdk.Key.G;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);
            */

            // ROFL: the empty code statement below is needed to keep stupid
            // gettext away from using all the commented code from above as
            // translator comment
            ;
            _OpenLogChatMenuItem = new Gtk.ImageMenuItem(_("Open Log"));
            _OpenLogChatMenuItem.Image = new Gtk.Image(Gtk.Stock.Open,
                                                       Gtk.IconSize.Menu);
            _OpenLogChatMenuItem.Activated += OnOpenLogChatMenuItemActivated;
            _OpenLogChatMenuItem.Sensitive = false;
            _OpenLogChatMenuItem.NoShowAll = true;
            menu.Append(_OpenLogChatMenuItem);

            _CloseChatMenuItem = new Gtk.ImageMenuItem(Gtk.Stock.Close, agrp);
            _CloseChatMenuItem.Activated += OnCloseChatMenuItemActivated;
            menu.Append(_CloseChatMenuItem);

            // Menu - Engine
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Engine"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.MenuItem(_("_Use Local Engine"));
            item.Activated += new EventHandler(_OnUseLocalEngineButtonClicked);
            menu.Append(item);

            menu.Append(new Gtk.SeparatorMenuItem());

            image_item = new Gtk.ImageMenuItem(_("_Add Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnAddRemoteEngineButtonClicked);
            menu.Append(image_item);

            image_item = new Gtk.ImageMenuItem(_("_Switch Remote Engine"));
            image_item.Image = new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Menu);
            image_item.Activated += new EventHandler(_OnSwitchRemoteEngineButtonClicked);
            menu.Append(image_item);

            // Menu - View
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_View"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            item = new Gtk.CheckMenuItem(_("_Caret Mode"));
            item.Activated += new EventHandler(_OnCaretModeButtonClicked);
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F7;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            item = new Gtk.CheckMenuItem(_("_Browse Mode"));
            item.Activated += delegate {
                try {
                    _Notebook.IsBrowseModeEnabled = !_Notebook.IsBrowseModeEnabled;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F8;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            _ShowMenuBarItem = new Gtk.CheckMenuItem(_("Show _Menubar"));
            _ShowMenuBarItem.Active = true;
            _ShowMenuBarItem.Activated += delegate {
                try {
                    _MenuBar.Visible = !_MenuBar.Visible;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            menu.Append(_ShowMenuBarItem);

            item = new Gtk.ImageMenuItem(Gtk.Stock.Fullscreen, agrp);
            item.Activated += delegate {
                try {
                    IsFullscreen = !IsFullscreen;
                } catch (Exception ex) {
                    Frontend.ShowException(this, ex);
                }
            };
            akey = new Gtk.AccelKey();
            akey.AccelFlags = Gtk.AccelFlags.Visible;
            akey.Key = Gdk.Key.F11;
            item.AddAccelerator("activate", agrp, akey);
            menu.Append(item);

            // Menu - Help
            menu = new Gtk.Menu();
            item = new Gtk.MenuItem(_("_Help"));
            item.Submenu = menu;
            _MenuBar.Append(item);

            image_item = new Gtk.ImageMenuItem(Gtk.Stock.About, agrp);
            image_item.Activated += new EventHandler(_OnAboutButtonClicked);
            menu.Append(image_item);

            // TODO: network treeview
            _Notebook = new Notebook();
            _Notebook.SwitchPage += OnNotebookSwitchPage;

            _ChatViewManager = new ChatViewManager(_Notebook, null);
            Assembly asm = Assembly.GetExecutingAssembly();
            _ChatViewManager.Load(asm);
            _ChatViewManager.LoadAll(System.IO.Path.GetDirectoryName(asm.Location),
                                     "smuxi-frontend-gnome-*.dll");
            _ChatViewManager.ChatAdded += OnChatViewManagerChatAdded;
            _ChatViewManager.ChatRemoved += OnChatViewManagerChatRemoved;

            #if GTK_SHARP_2_10
            _StatusIconManager = new StatusIconManager(this, _ChatViewManager);
            #endif
            #if INDICATE_SHARP
            _IndicateManager = new IndicateManager(this, _ChatViewManager);
            #endif
            #if NOTIFY_SHARP
            _NotifyManager = new NotifyManager(this, _ChatViewManager);
            #endif

            _UI = new GnomeUI(_ChatViewManager);

            // HACK: Frontend.FrontendConfig out of scope
            _EngineManager = new EngineManager(Frontend.FrontendConfig, _UI);

            _Entry = new Entry(_Notebook);

            _ProgressBar = new Gtk.ProgressBar();

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(_MenuBar, false, false, 0);
            vbox.PackStart(_Notebook, true, true, 0);
            vbox.PackStart(_Entry, false, false, 0);

            _NetworkStatusbar = new Gtk.Statusbar();
            _NetworkStatusbar.WidthRequest = 300;
            _NetworkStatusbar.HasResizeGrip = false;

            _Statusbar = new Gtk.Statusbar();
            _Statusbar.HasResizeGrip = false;

            Gtk.HBox status_bar_hbox = new Gtk.HBox();
            status_bar_hbox.Homogeneous = true;
            status_bar_hbox.PackStart(_NetworkStatusbar, false, true, 0);
            status_bar_hbox.PackStart(_Statusbar, true, true, 0);

            Gtk.HBox status_hbox = new Gtk.HBox();
            status_hbox.PackStart(status_bar_hbox);
            status_hbox.PackStart(_ProgressBar, false, false, 0);

            vbox.PackStart(status_hbox, false, false, 0);
            Add(vbox);
        }
		static Gtk.Menu FromMenu (ContextMenu menu)
		{
			var result = new Gtk.Menu ();

			foreach (var menuItem in menu.Items) {
				var item = CreateMenuItem (menuItem);
				if (item != null)
					result.Append (item);
			}

			return result;
		}
Exemplo n.º 48
0
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

            _ChatModel = chat;

            IsAutoScrolling = true;
            MessageTextView tv = new MessageTextView();
            _EndMark = tv.Buffer.CreateMark("end", tv.Buffer.EndIter, false);
            tv.ShowTimestamps = true;
            tv.ShowMarkerline = true;
            tv.Editable = false;
            tv.CursorVisible = true;
            tv.WrapMode = Gtk.WrapMode.Char;
            tv.MessageAdded += OnMessageTextViewMessageAdded;
            tv.MessageHighlighted += OnMessageTextViewMessageHighlighted;
            tv.PopulatePopup += OnMessageTextViewPopulatePopup;
            tv.SizeRequested += delegate {
                AutoScroll();
            };
            _OutputMessageTextView = tv;

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            _OutputScrolledWindow = sw;
            //sw.HscrollbarPolicy = Gtk.PolicyType.Never;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Always;
            sw.ShadowType = Gtk.ShadowType.In;
            sw.Vadjustment.ValueChanged += delegate {
                CheckAutoScroll();
            };
            sw.Add(_OutputMessageTextView);

            // popup menu
            _TabMenu = new Gtk.Menu();

            Gtk.ImageMenuItem close_item = new Gtk.ImageMenuItem(Gtk.Stock.Close, null);
            close_item.Activated += new EventHandler(OnTabMenuCloseActivated);
            _TabMenu.Append(close_item);
            _TabMenu.ShowAll();

            //FocusChild = _OutputTextView;
            //CanFocus = false;

            _TabLabel = new Gtk.Label();

            TabImage = DefaultTabImage;
            _TabHBox = new Gtk.HBox();
            _TabHBox.PackEnd(new Gtk.Fixed(), true, true, 0);
            _TabHBox.PackEnd(_TabLabel, false, false, 0);
            _TabHBox.PackStart(TabImage, false, false, 2);
            _TabHBox.ShowAll();

            _TabEventBox = new Gtk.EventBox();
            _TabEventBox.VisibleWindow = false;
            _TabEventBox.ButtonPressEvent += new Gtk.ButtonPressEventHandler(OnTabButtonPress);
            _TabEventBox.Add(_TabHBox);
            _TabEventBox.ShowAll();

            _ThemeSettings = new ThemeSettings();

            // OPT-TODO: this should use a TaskStack instead of TaskQueue
            _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+ID+")");
            _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent;
            _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent;
        }
		static Gtk.Menu FromMenu (ContextMenu menu, Action closeHandler)
		{
			var result = new Gtk.Menu ();

			foreach (var menuItem in menu.Items) {
				var item = CreateMenuItem (menuItem);
				if (item != null)
					result.Append (item);
			}

			result.Hidden += delegate {
				if (closeHandler != null)
					closeHandler ();
				menu.FireClosedEvent ();
			};
			return result;
		}
		static Gtk.Menu FromMenu (ContextMenu menu, Action closeHandler)
		{
			var result = new Gtk.Menu ();

			foreach (var menuItem in menu.Items) {
				var item = CreateMenuItem (menuItem);
				if (item != null)
					result.Append (item);
			}

			if (closeHandler != null) {
				result.Hidden += (sender, e) => closeHandler ();
			}
			return result;
		}
Exemplo n.º 51
0
        private void PopulateGalleryOptionMenu(GalleryAccountManager manager, GalleryAccount changed_account)
        {
            Gtk.Menu menu = new Gtk.Menu ();
            this.account = changed_account;
            int pos = -1;

            accounts = manager.GetAccounts ();
            if (accounts == null || accounts.Count == 0) {
                Gtk.MenuItem item = new Gtk.MenuItem (Catalog.GetString ("(No Gallery)"));
                menu.Append (item);
                gallery_optionmenu.Sensitive = false;
                edit_button.Sensitive = false;
            } else {
                int i = 0;
                foreach (GalleryAccount account in accounts) {
                    if (account == changed_account)
                        pos = i;

                    Gtk.MenuItem item = new Gtk.MenuItem (account.Name);
                    menu.Append (item);
                    i++;
                }
                gallery_optionmenu.Sensitive = true;
                edit_button.Sensitive = true;
            }

            menu.ShowAll ();
            gallery_optionmenu.Menu = menu;
            gallery_optionmenu.SetHistory ((uint)pos);
        }
Exemplo n.º 52
0
        private void PopulateAlbums()
        {
            Gtk.Menu menu = new Gtk.Menu ();
            if (gallery.Version == GalleryVersion.Version1) {
                Gtk.MenuItem top_item = new Gtk.MenuItem (Catalog.GetString ("(TopLevel)"));
                menu.Append (top_item);
            }

            foreach (Album album in gallery.Albums) {
                System.Text.StringBuilder label_builder = new System.Text.StringBuilder ();

                for (int i=0; i < album.Parents.Count; i++) {
                    label_builder.Append ("  ");
                }
                label_builder.Append (album.Title);

                Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
                ((Gtk.Label)item.Child).UseUnderline = false;
                menu.Append (item);

                AlbumPermission create_sub = album.Perms & AlbumPermission.CreateSubAlbum;

                if (create_sub == 0)
                    item.Sensitive = false;
            }

            album_optionmenu.Sensitive = true;
            menu.ShowAll ();
            album_optionmenu.Menu = menu;
        }
Exemplo n.º 53
0
		internal void ShowDockPopupMenu (uint time)
		{
			Gtk.Menu menu = new Gtk.Menu ();
			
			// Hide menuitem
			if ((Behavior & DockItemBehavior.CantClose) == 0) {
				Gtk.MenuItem mitem = new Gtk.MenuItem (Catalog.GetString("Hide"));
				mitem.Activated += delegate { Visible = false; };
				menu.Append (mitem);
			}

			Gtk.MenuItem citem;

			// Auto Hide menuitem
			if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
				citem = new Gtk.MenuItem (Catalog.GetString("Minimize"));
				citem.Activated += delegate { Status = DockItemStatus.AutoHide; };
				menu.Append (citem);
			}

			if (Status != DockItemStatus.Dockable) {
				// Dockable menuitem
				citem = new Gtk.MenuItem (Catalog.GetString("Dock"));
				citem.Activated += delegate { Status = DockItemStatus.Dockable; };
				menu.Append (citem);
			}

			// Floating menuitem
			if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
				citem = new Gtk.MenuItem (Catalog.GetString("Undock"));
				citem.Activated += delegate { Status = DockItemStatus.Floating; };
				menu.Append (citem);
			}

			if (menu.Children.Length == 0) {
				menu.Destroy ();
				return;
			}

			ShowingContextMemu = true;

			menu.ShowAll ();
			menu.Hidden += (o,e) => {
				ShowingContextMemu = false;
			};
			menu.Popup (null, null, null, 3, time);
		}
Exemplo n.º 54
0
        private void ShowPopup()
        {
            Gtk.Menu menu = new Gtk.Menu ();

            Gtk.MenuItem deleteFile = new Gtk.MenuItem (GettextCatalog.GetString ("Delete file"));
            deleteFile.Activated += new EventHandler (OnDeleteFiles);

            Gtk.MenuItem renameFile = new Gtk.MenuItem (GettextCatalog.GetString ("Rename file"));
            renameFile.Activated += new EventHandler (OnRenameFile);
            renameFile.Sensitive = false;

            menu.Append (deleteFile);
            menu.Append (renameFile);

            menu.Popup (null, null, null, 3, Gtk.Global.CurrentEventTime);
            menu.ShowAll ();
        }