Пример #1
0
        ///<summary>
        ///Insertion d'une vue dans une zone de la vue principale
        ///</summary>
        public void NewView(string viewName)
        {
            string key = "none";

            //Récupération du controleur de la vue
            IController controller = GetController(viewName);

            //Commande d'initialisation de l'interface graphique.
            //Permet d'instancier l'interface graphique de la vue à partir du controleur
            controller.ExecuteCommand("New", "");

            //Récupération de l'interface graphique de la vue
            IView view = controller.View;

            if (view == null)
            {
                throw new ArgumentNullException("L'interface graphique de la vue n'a pas pu être créée.");
            }

            //Debug
            Console.WriteLine("Appel commande NewView : " + view.Caption + " dans " + view.Destination);

            //Récupération du control de la vue
            Gtk.HBox hbox = view.VisualComponent;
            if (hbox == null)
            {
                throw new ArgumentNullException("La vue n'expose pas son interface graphique.");
            }

            //positionnement dans le Notebook principal
            if (view.Destination.Equals("default"))
            {
                viewGui.NotebookViews.AppendPage(hbox, new Gtk.Label(view.Caption));
                key = (viewGui.NotebookViews.NPages - 1).ToString();
                view.Initialize();
                hbox.ShowAll();
            }

            //positionnement latéral gauche
            if (view.Destination.Equals("left"))
            {
                key = "left";
                viewGui.HpanedMain.Pack1(hbox, true, false);
                hbox.ShowAll();
            }

            //Ajout dans la liste des controleurs
            viewGui.Controller.RegisterController(key, controller);
        }
		public QueryWidget (PhotoQuery query, Db db, TagSelectionWidget selector)
		{
			tips.Enable ();

			this.query = query;
			query.Changed += HandleChanged;

			Gtk.HSeparator sep = new Gtk.HSeparator ();
			sep.Show ();
			this.PackStart (sep, false, false, 0);
			
			Gtk.HBox hbox = new Gtk.HBox ();
			hbox.Show ();
			this.PackStart (hbox, false, false, 0);
			
			label = new Gtk.Label (Catalog.GetString ("Find: "));
			label.Show ();
			label.Ypad = 9;
			hbox.PackStart (label, false, false, 0);

			untagged = new Gtk.Label (Catalog.GetString ("Untagged photos"));
			untagged.Visible = false;
			hbox.PackStart (untagged, false, false, 0);

			comma_label = new Gtk.Label (", ");
			comma_label.Visible = false;
			hbox.PackStart (comma_label, false, false, 0);

			rollfilter = new Gtk.Label (Catalog.GetString ("Import roll"));	
			rollfilter.Visible = false;
			hbox.PackStart (rollfilter, false, false, 0);

			logic_widget = new LogicWidget (query, db.Tags, selector);
			logic_widget.Show ();
			hbox.PackStart (logic_widget, true, true, 0);

			warning_box = new Gtk.HBox ();
			warning_box.PackStart (new Gtk.Label (System.String.Empty));
			
			Gtk.Image warning_image = new Gtk.Image ("gtk-info", Gtk.IconSize.Button);
			warning_image.Show ();
			warning_box.PackStart (warning_image, false, false, 0);
			
			clear_button = new Gtk.Button ();
			clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button));
			clear_button.Clicked += HandleClearButtonClicked;
			clear_button.Relief = Gtk.ReliefStyle.None;
			hbox.PackEnd (clear_button, false, false, 0);
			tips.SetTip (clear_button, Catalog.GetString("Clear search"), null);

			Gtk.Label warning = new Gtk.Label (Catalog.GetString ("No matching photos found"));
			warning_box.PackStart (warning, false, false, 0);
			warning_box.ShowAll ();
			warning_box.Spacing = 6;
			warning_box.Visible = false;

			hbox.PackEnd (warning_box, false, false, 0);
			
			warning_box.Visible = false;
		}
        public QueryWidget(PhotoQuery query, Db db, TagSelectionWidget selector)
        {
            tips.Enable();

            this.query     = query;
            query.Changed += HandleChanged;

            Gtk.HSeparator sep = new Gtk.HSeparator();
            sep.Show();
            this.PackStart(sep, false, false, 0);

            Gtk.HBox hbox = new Gtk.HBox();
            hbox.Show();
            this.PackStart(hbox, false, false, 0);

            label = new Gtk.Label(Catalog.GetString("Find: "));
            label.Show();
            label.Ypad = 9;
            hbox.PackStart(label, false, false, 0);

            untagged         = new Gtk.Label(Catalog.GetString("Untagged photos"));
            untagged.Visible = false;
            hbox.PackStart(untagged, false, false, 0);

            comma_label         = new Gtk.Label(", ");
            comma_label.Visible = false;
            hbox.PackStart(comma_label, false, false, 0);

            rollfilter         = new Gtk.Label(Catalog.GetString("Import roll"));
            rollfilter.Visible = false;
            hbox.PackStart(rollfilter, false, false, 0);

            logic_widget = new LogicWidget(query, db.Tags, selector);
            logic_widget.Show();
            hbox.PackStart(logic_widget, true, true, 0);

            warning_box = new Gtk.HBox();
            warning_box.PackStart(new Gtk.Label(System.String.Empty));

            Gtk.Image warning_image = new Gtk.Image("gtk-info", Gtk.IconSize.Button);
            warning_image.Show();
            warning_box.PackStart(warning_image, false, false, 0);

            clear_button = new Gtk.Button();
            clear_button.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Button));
            clear_button.Clicked += HandleClearButtonClicked;
            clear_button.Relief   = Gtk.ReliefStyle.None;
            hbox.PackEnd(clear_button, false, false, 0);
            tips.SetTip(clear_button, Catalog.GetString("Clear search"), null);

            Gtk.Label warning = new Gtk.Label(Catalog.GetString("No matching photos found"));
            warning_box.PackStart(warning, false, false, 0);
            warning_box.ShowAll();
            warning_box.Spacing = 6;
            warning_box.Visible = false;

            hbox.PackEnd(warning_box, false, false, 0);

            warning_box.Visible = false;
        }
Пример #4
0
        public DocumentPageHandler()
        {
            Control              = new Gtk.VBox();
            tab                  = new Gtk.HBox();
            closeButton          = new Gtk.Button();
            closeButton.Relief   = Gtk.ReliefStyle.None;
            closeButton.CanFocus = false;

#if GTK3
            tab.Expand        = true;
            closeButton.Image = new Gtk.Image(Gtk.IconTheme.Default.LoadIcon("window-close", 12, Gtk.IconLookupFlags.ForceSize));
#else
            closeButton.Image = new Gtk.Image(Gtk.IconTheme.Default.LoadIcon("window-close", 12, 0));
#endif

            tab.PackEnd(closeButton, false, true, 0);
            label = new Gtk.Label();
            label.SetAlignment(0.5f, 0.5f);
            tab.PackEnd(label, true, true, 0);

            tab.SizeAllocated += Tab_SizeAllocated;
            tab.ShowAll();

            closeButton.Clicked  += (o, args) => Parent?.ClosePage(ContainerControl, Widget);
            tab.ButtonPressEvent += (o, args) =>
            {
                if (args.Event.Button == 2 && Closable)
                {
                    Parent?.ClosePage(ContainerControl, Widget);
                }
            };
        }
Пример #5
0
        public DocumentPageHandler()
        {
            Control              = new Gtk.VBox();
            tab                  = new Gtk.HBox();
            closeButton          = new Gtk.Button();
            closeButton.Relief   = Gtk.ReliefStyle.None;
            closeButton.CanFocus = false;

#if GTK3
            tab.Expand = true;
#endif
            var closeImage = s_closeImage.Value;
            if (closeImage != null)
            {
                closeButton.Image = new Gtk.Image(closeImage);
            }
            else
            {
                closeButton.Child = new Gtk.Label("x");
            }

            tab.PackEnd(closeButton, false, true, 0);
            label        = new Gtk.Label();
            label.Xalign = 0.5f;
            label.Yalign = 0.5f;
            tab.PackEnd(label, true, true, 0);

            tab.ShowAll();
        }
Пример #6
0
 public TabPageHandler()
 {
     Control = new Gtk.VBox();
     tab     = new Gtk.HBox();
     label   = new Gtk.Label();
     tab.PackEnd(label, true, true, 0);
     tab.ShowAll();
 }
Пример #7
0
        public void createGui()
        {
            basedir_section = new Section("cuesheets-basedir", "CueSheet Music Directory:", 20);
            source_page.Add(basedir_section);

            string dir = _source.getCueSheetDir();

            Gtk.Label             lbl = new Gtk.Label("CueSheet Music Directory:");
            Gtk.FileChooserButton btn = new Gtk.FileChooserButton("CueSheet Music Directory:", Gtk.FileChooserAction.SelectFolder);
            if (dir != null)
            {
                btn.SelectFilename(dir);
            }
            Gtk.HBox box = new Gtk.HBox();
            box.Add(lbl);
            box.Add(btn);
            box.ShowAll();
            btn.CurrentFolderChanged += delegate(object sender, EventArgs args) {
                string dir1 = btn.Filename;
                Hyena.Log.Information("Folder changed to = " + dir1);
            };
            btn.FileSet += delegate(object sender, EventArgs args) {
                string dir1 = btn.Filename;
                Hyena.Log.Information("Base directory changed to = " + dir1);
                _source.setCueSheetDir(dir1);
            };

            Console.WriteLine(_source);

            Gtk.VBox vb = new Gtk.VBox();
            vb.PackStart(box, false, false, 0);

            Gtk.Image  icn_about = new Gtk.Image(Gtk.Stock.About, Gtk.IconSize.Button);
            Gtk.Button about     = new Gtk.Button(icn_about);
            about.Clicked += new EventHandler(handleAbout);
            Gtk.HBox  hb     = new Gtk.HBox();
            Gtk.Label _about = new Gtk.Label("About the CueSheet extension");
            hb.PackEnd(about, false, false, 0);
            hb.PackEnd(_about, false, false, 5);
            vb.PackStart(hb, false, false, 0);
            Gtk.HBox   hb1      = new Gtk.HBox();
            Gtk.Label  _info    = new Gtk.Label("How to use the Cuesheet extension (opens browser)");
            Gtk.Image  icn_info = new Gtk.Image(Gtk.Stock.Info, Gtk.IconSize.Button);
            Gtk.Button btn_info = new Gtk.Button(icn_info);
            btn_info.Clicked += new EventHandler(handleInfo);
            hb1.PackEnd(btn_info, false, false, 0);
            hb1.PackEnd(_info, false, false, 5);
            vb.PackStart(hb1, false, false, 0);

            Gtk.HBox hbX = new Gtk.HBox();
            vb.PackEnd(hbX, true, true, 0);

            vb.ShowAll();

            source_page.DisplayWidget = vb;
        }
        public void createGui()
        {
            basedir_section=new Section("cuesheets-basedir","CueSheet Music Directory:",20);
            source_page.Add (basedir_section);

            string dir=_source.getCueSheetDir();
            Gtk.Label lbl=new Gtk.Label("CueSheet Music Directory:");
            Gtk.FileChooserButton btn=new Gtk.FileChooserButton("CueSheet Music Directory:",Gtk.FileChooserAction.SelectFolder);
            if (dir!=null) {
                btn.SelectFilename (dir);
            }
            Gtk.HBox box=new Gtk.HBox();
            box.Add (lbl);
            box.Add (btn);
            box.ShowAll ();
            btn.CurrentFolderChanged+=delegate(object sender,EventArgs args) {
                string dir1=btn.Filename;
                Hyena.Log.Information ("Folder changed to = "+dir1);
            };
            btn.FileSet+=delegate(object sender,EventArgs args) {
                string dir1=btn.Filename;
                Hyena.Log.Information ("Base directory changed to = "+dir1);
                _source.setCueSheetDir(dir1);
            };

            Console.WriteLine (_source);

            Gtk.VBox vb=new Gtk.VBox();
            vb.PackStart (box,false,false,0);

            Gtk.Image icn_about=new Gtk.Image(Gtk.Stock.About,Gtk.IconSize.Button);
            Gtk.Button about=new Gtk.Button(icn_about);
            about.Clicked+=new EventHandler(handleAbout);
            Gtk.HBox hb=new Gtk.HBox();
            Gtk.Label _about=new Gtk.Label("About the CueSheet extension");
            hb.PackEnd (about,false,false,0);
            hb.PackEnd (_about,false,false,5);
            vb.PackStart (hb,false,false,0);
            Gtk.HBox hb1=new Gtk.HBox();
            Gtk.Label _info=new Gtk.Label("How to use the Cuesheet extension (opens browser)");
            Gtk.Image icn_info=new Gtk.Image(Gtk.Stock.Info,Gtk.IconSize.Button);
            Gtk.Button btn_info=new Gtk.Button(icn_info);
            btn_info.Clicked+=new EventHandler(handleInfo);
            hb1.PackEnd(btn_info,false,false,0);
            hb1.PackEnd(_info,false,false,5);
            vb.PackStart (hb1,false,false,0);

            Gtk.HBox hbX=new Gtk.HBox();
            vb.PackEnd (hbX,true,true,0);

            vb.ShowAll ();

            source_page.DisplayWidget = vb;
        }
Пример #9
0
 public static Gtk.Widget CreateCellRenderer(ICollection<CellView> views)
 {
     if (views.Count == 1) {
         Gtk.HBox box = new Gtk.HBox ();
         foreach (var v in views)
             box.PackStart (CreateCellRenderer (v), false, false, 0);
         box.ShowAll ();
         return box;
     }
     else
         return CreateCellRenderer (views.First ());
 }
Пример #10
0
        private void BuildUI()
        {
            Gtk.HBox hbox = new Gtk.HBox(false, 3);
            Add(hbox);

            d_removeButton = new Gtk.Button();
            d_removeButton.Add(new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Menu));
            hbox.PackStart(d_removeButton, false, false, 0);

            d_addButton = new Gtk.Button();
            d_addButton.Add(new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Menu));
            hbox.PackStart(d_addButton, false, false, 0);

            hbox.ShowAll();
        }
Пример #11
0
		public static Gtk.Button MakeImageButton (Gtk.Image image, string label)
		{
			Gtk.HBox box = new Gtk.HBox (false, 2);
			box.PackStart (image, false, false, 0);
			box.PackEnd (new Gtk.Label (label), false, false, 0);
			box.ShowAll ();

			Gtk.Button button = new Gtk.Button ();

			Gtk.Alignment align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f);
			align.Add (box);
			align.Show ();

			button.Add (align);
			return button;
		}			
Пример #12
0
        public static Gtk.Button MakeImageButton(Gtk.Image image, string label)
        {
            Gtk.HBox box = new Gtk.HBox(false, 2);
            box.PackStart(image, false, false, 0);
            box.PackEnd(new Gtk.Label(label), false, false, 0);
            box.ShowAll();

            Gtk.Button button = new Gtk.Button();

            Gtk.Alignment align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 0.0f);
            align.Add(box);
            align.Show();

            button.Add(align);
            return(button);
        }
Пример #13
0
 public static Gtk.Widget CreateCellRenderer(ICollection <CellView> views)
 {
     if (views.Count == 1)
     {
         Gtk.HBox box = new Gtk.HBox();
         foreach (var v in views)
         {
             box.PackStart(CreateCellRenderer(v), false, false, 0);
         }
         box.ShowAll();
         return(box);
     }
     else
     {
         return(CreateCellRenderer(views.First()));
     }
 }
Пример #14
0
        public AnimatedButton(string label, bool from_zero)
        {
            custom_hbox  = new Gtk.HBox();
            custom_label = new Gtk.Label(label);

            custom_label.LineWrap      = true;
            custom_label.LineWrapMode  = Pango.WrapMode.Word;
            custom_label.MaxWidthChars = 30;

            custom_image        = new Gtk.Image();
            custom_image.Pixbuf = Gdk.Pixbuf.LoadFromResource("llum.arrow.svg");

            custom_hbox.PackStart(custom_image, false, false, 5);
            custom_hbox.PackStart(custom_label, false, false, 5);



            custom_hbox.ShowAll();
            custom_image.Hide();
            custom_label.Hide();

            this.Add(custom_hbox);



            height    = 50;
            width     = 150;
            dec_width = width;

            this.Show();

            if (!from_zero)
            {
                this.SetSizeRequest(width, height);
            }
            else
            {
                appear();
            }
        }
Пример #15
0
		public MessageDialog ()
		{
			Resizable = false;
			HasSeparator = false;
			BorderWidth = 12;

			label = new Gtk.Label ();
			label.LineWrap = true;
			label.Selectable = true;
			label.UseMarkup = true;
			label.SetAlignment (0.0f, 0.0f);

			secondaryLabel = new Gtk.Label ();
			secondaryLabel.LineWrap = true;
			secondaryLabel.Selectable = true;
			secondaryLabel.UseMarkup = true;
			secondaryLabel.SetAlignment (0.0f, 0.0f);

			icon = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog);
			icon.SetAlignment (0.5f, 0.0f);

			Gtk.StockItem item = Gtk.Stock.Lookup (icon.Stock);
			Title = item.Label;

			Gtk.HBox hbox = new Gtk.HBox (false, 12);
			Gtk.VBox vbox = new Gtk.VBox (false, 12);

			vbox.PackStart (label, false, false, 0);
			vbox.PackStart (secondaryLabel, true, true, 0);

			hbox.PackStart (icon, false, false, 0);
			hbox.PackStart (vbox, true, true, 0);

			VBox.PackStart (hbox, false, false, 0);
			hbox.ShowAll ();

			Buttons = Gtk.ButtonsType.OkCancel;
		}
Пример #16
0
        public MessageDialog()
        {
            Resizable    = false;
            HasSeparator = false;
            BorderWidth  = 12;

            label            = new Gtk.Label();
            label.LineWrap   = true;
            label.Selectable = true;
            label.UseMarkup  = true;
            label.SetAlignment(0.0f, 0.0f);

            secondaryLabel            = new Gtk.Label();
            secondaryLabel.LineWrap   = true;
            secondaryLabel.Selectable = true;
            secondaryLabel.UseMarkup  = true;
            secondaryLabel.SetAlignment(0.0f, 0.0f);

            icon = new Gtk.Image(Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog);
            icon.SetAlignment(0.5f, 0.0f);

            Gtk.StockItem item = Gtk.Stock.Lookup(icon.Stock);
            Title = item.Label;

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            Gtk.VBox vbox = new Gtk.VBox(false, 12);

            vbox.PackStart(label, false, false, 0);
            vbox.PackStart(secondaryLabel, true, true, 0);

            hbox.PackStart(icon, false, false, 0);
            hbox.PackStart(vbox, true, true, 0);

            VBox.PackStart(hbox, false, false, 0);
            hbox.ShowAll();

            Buttons = Gtk.ButtonsType.OkCancel;
        }
Пример #17
0
 public void SetContent(string label, object imageBackend)
 {
     Gdk.Pixbuf pix = (Gdk.Pixbuf)imageBackend;
     if (label != null && imageBackend == null)
     {
         Widget.Label = label;
     }
     else if (label == null && imageBackend != null)
     {
         var img = new Gtk.Image(pix);
         img.Show();
         Widget.Image = img;
     }
     else if (label != null && imageBackend != null)
     {
         Gtk.HBox box = new Gtk.HBox(false, 3);
         var      img = new Gtk.Image(pix);
         box.PackStart(img, false, false, 0);
         var lab = new Gtk.Label(label);
         box.PackStart(lab, false, false, 0);
         box.ShowAll();
         Widget.Image = box;
     }
 }
 public ResXEditorImageViewContent(ResXData data) : base(data)
 {
     box = new Gtk.HBox();
     box.Add(new Gtk.Label("Hello world"));
     box.ShowAll();
 }
Пример #19
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();
        }
Пример #20
0
        private void OnPreferencesServiceInstallWidgetAdapters(object sender, EventArgs args)
        {
            if (pref_section == null)
            {
                return;
            }

            var user_entry = new Gtk.Entry(user_pref.Value ?? "");

            user_entry.Changed += (o, a) => { user_pref.Value = user_entry.Text; };

            var auth_button = new Gtk.Button(Authorized ? Catalog.GetString("Authorized!") : Catalog.GetString("Authorize..."));

            user_pref.ValueChanged += (s) => { auth_button.Sensitive = NeedAuth; };
            auth_button.Sensitive   = NeedAuth;
            auth_button.TooltipText = Catalog.GetString("Open Last.fm in a browser, giving you the option to authorize Banshee to work with your account");
            auth_button.Clicked    += delegate {
                account.SessionKey = null;
                account.RequestAuthorization();
            };

            var signup_button = new Gtk.LinkButton(account.SignUpUrl, Catalog.GetString("Sign up for Last.fm"));

            signup_button.Xalign = 0f;

            var refresh_button = new Gtk.Button(new Gtk.Image(Gtk.Stock.Refresh, Gtk.IconSize.Button));

            user_pref.ValueChanged    += (s) => { refresh_button.Sensitive = NeedAuth; };
            refresh_button.Sensitive   = NeedAuth;
            refresh_button.TooltipText = Catalog.GetString("Check if Banshee has been authorized");
            refresh_button.Clicked    += delegate {
                if (String.IsNullOrEmpty(account.UserName) || account.SessionKey == null)
                {
                    account.UserName = LastUserSchema.Get();
                    account.FetchSessionKey();
                    account.Save();
                    LastSessionKeySchema.Set(account.SessionKey);
                }

                auth_button.Sensitive = refresh_button.Sensitive = NeedAuth;
                auth_button.Label     = Authorized
                    ? Catalog.GetString("Authorized!")
                    : Catalog.GetString("Authorize...");
            };

            var auth_box = new Gtk.HBox()
            {
                Spacing = 6
            };

            auth_box.PackStart(user_entry, true, true, 0);
            auth_box.PackStart(auth_button, false, false, 0);
            auth_box.PackStart(refresh_button, false, false, 0);
            auth_box.ShowAll();

            signup_button.Visible = String.IsNullOrEmpty(user_pref.Value);

            var button_box = new Gtk.HBox()
            {
                Spacing = 6
            };

            button_box.PackStart(new Badge(account)
            {
                Visible = true
            }, false, false, 0);
            button_box.PackStart(signup_button, true, true, 0);

            user_pref.DisplayWidget = auth_box;
            pref_section["lastfm-signup"].DisplayWidget = button_box;
        }
Пример #21
0
		void AddClicked (object sender, EventArgs args)
		{
			Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog (
			        Catalog.GetString ("Select an icon..."),
			        null, Gtk.FileChooserAction.Open, new object[] {});
			dialog.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
			dialog.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);

			dialog.DefaultResponse = Gtk.ResponseType.Ok;
			dialog.LocalOnly = true;
			dialog.SetCurrentFolder (last_opened_dir);

			Gtk.FileFilter filter = new Gtk.FileFilter ();
			filter.AddPixbufFormats ();

			dialog.Filter = filter;

			// Extra Widget
			Gtk.Label l = new Gtk.Label (Catalog.GetString ("_Host name:"));
			Gtk.Entry host_entry = new Gtk.Entry ();
			l.MnemonicWidget = host_entry;
			Gtk.HBox hbox = new Gtk.HBox (false, 6);
			hbox.PackStart (l, false, false, 0);
			hbox.PackStart (host_entry, true, true, 0);
			hbox.ShowAll ();

			dialog.ExtraWidget = hbox;

			int response;
			string icon_file;
			string host;

run_add_dialog:
			response = dialog.Run ();
			icon_file = dialog.Filename;
			host = host_entry.Text.Trim ();

			if (response == (int) Gtk.ResponseType.Ok
			                && host == String.Empty) {
				// Let the user know that they
				// have to specify a host name.
				HIGMessageDialog warn =
				        new HIGMessageDialog (
				        null,
				        Gtk.DialogFlags.DestroyWithParent,
				        Gtk.MessageType.Warning,
				        Gtk.ButtonsType.Ok,
				        Catalog.GetString ("No host name specified"),
				        Catalog.GetString ("You must specify the Bugzilla " +
				                           "host name to use with this icon."));
				warn.Run ();
				warn.Destroy ();

				host_entry.GrabFocus ();
				goto run_add_dialog;
			} else if (response != (int) Gtk.ResponseType.Ok) {
				dialog.Destroy ();
				return;
			}

			// Keep track of the last directory the user had open
			last_opened_dir = dialog.CurrentFolder;

			dialog.Destroy ();

			// Copy the file to the BugzillaIcons directory
			string err_msg;
			if (!CopyToBugizllaIconsDir (icon_file, host, out err_msg)) {
				HIGMessageDialog err =
				        new HIGMessageDialog (
				        null,
				        Gtk.DialogFlags.DestroyWithParent,
				        Gtk.MessageType.Error,
				        Gtk.ButtonsType.Ok,
				        Catalog.GetString ("Error saving icon"),
				        Catalog.GetString ("Could not save the icon file.") +
					                   "  " +
					                   err_msg);
				err.Run ();
				err.Destroy ();
			}

			UpdateIconStore ();
		}
Пример #22
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();
            };
            tv.PersonClicked += OnMessageTextViewPersonClicked;
            _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 += OnVadjustmentValueChanged;
            sw.Add(_OutputMessageTextView);

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

            //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;
        }
Пример #23
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);
        }
Пример #24
0
		// Page 1
		// List of editing options
		public Gtk.Widget MakeEditingPane ()
		{
			Gtk.Label label;
			Gtk.CheckButton check;
			Gtk.Alignment align;
			IPropertyEditorBool peditor, font_peditor, bullet_peditor;

			Gtk.VBox options_list = new Gtk.VBox (false, 12);
			options_list.BorderWidth = 12;
			options_list.Show ();


			// Spell checking...

			#if FIXED_GTKSPELL
			if (NoteSpellChecker.GtkSpellAvailable) {
				check = MakeCheckButton (
				                Catalog.GetString ("_Spell check while typing"));
				options_list.PackStart (check, false, false, 0);

				peditor = Services.Factory.CreatePropertyEditorToggleButton (
				        Preferences.ENABLE_SPELLCHECKING,
				        check);
				SetupPropertyEditor (peditor);

				label = MakeTipLabel (
				                Catalog.GetString ("Misspellings will be underlined " +
				                                   "in red, with correct spelling " +
				                                   "suggestions shown in the context " +
				                                   "menu."));
				options_list.PackStart (label, false, false, 0);
			}
			#endif


			// WikiWords...

			check = MakeCheckButton (Catalog.GetString ("Highlight _WikiWords"));
			options_list.PackStart (check, false, false, 0);

			peditor = Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_WIKIWORDS,
			                check);
			SetupPropertyEditor (peditor);

			label = MakeTipLabel (
			                Catalog.GetString ("Enable this option to highlight " +
			                                   "words <b>ThatLookLikeThis</b>. " +
			                                   "Clicking the word will create a " +
			                                   "note with that name."));
			options_list.PackStart (label, false, false, 0);

			// Auto bulleted list
			check = MakeCheckButton (Catalog.GetString ("Enable auto-_bulleted lists"));
			options_list.PackStart (check, false, false, 0);
			bullet_peditor =
			        Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_AUTO_BULLETED_LISTS,
			                                        check);
			SetupPropertyEditor (bullet_peditor);

			// Custom font...
			Gtk.HBox font_box = new Gtk.HBox (false, 0);
			check = MakeCheckButton (Catalog.GetString ("Use custom _font"));
			font_box.PackStart (check);

			font_peditor =
			        Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_CUSTOM_FONT,
			                                        check);
			SetupPropertyEditor (font_peditor);

			font_button = MakeFontButton ();
			font_button.Sensitive = check.Active;
			font_box.PackStart (font_button);
			font_box.ShowAll ();
			options_list.PackStart (font_box, false, false, 0);

			font_peditor.AddGuard (font_button);

			// Note renaming bahvior
			Gtk.HBox rename_behavior_box = new Gtk.HBox (false, 0);
			label = MakeLabel (Catalog.GetString ("When renaming a linked note: "));
			rename_behavior_box.PackStart (label);
			rename_behavior_combo = new Gtk.ComboBox (new string [] {
				Catalog.GetString ("Ask me what to do"),
				Catalog.GetString ("Never rename links"),
				Catalog.GetString ("Always rename links")});
			int rename_behavior = (int) Preferences.Get (Preferences.NOTE_RENAME_BEHAVIOR);
			if (rename_behavior < 0 || rename_behavior > 2) {
				rename_behavior = 0;
				Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR, rename_behavior);
			}
			rename_behavior_combo.Active = rename_behavior;
			rename_behavior_combo.Changed += (o, e) =>
				Preferences.Set (Preferences.NOTE_RENAME_BEHAVIOR,
				                 rename_behavior_combo.Active);
			rename_behavior_box.PackStart (rename_behavior_combo);
			rename_behavior_box.ShowAll ();
			options_list.PackStart (rename_behavior_box, false, false, 0);
			
			// New Note Template
			// Translators: This is 'New Note' Template, not New 'Note Template'
			label = MakeLabel (Catalog.GetString ("New Note Template"));
			options_list.PackStart (label, false, false, 0);

			label = MakeTipLabel (
				Catalog.GetString ("Use the new note template to specify the text " +
								   "that should be used when creating a new note."));
			options_list.PackStart (label, false, false, 0);
			
			align = new Gtk.Alignment (0.5f, 0.5f, 0.4f, 1.0f);
			align.Show ();
			options_list.PackStart (align, false, false, 0);
			
			Gtk.Button open_template_button = new Gtk.Button ();
			open_template_button.Label = Catalog.GetString ("Open New Note Template");

			open_template_button.Clicked += OpenTemplateButtonClicked;
			open_template_button.Show ();
			align.Add (open_template_button);

			return options_list;
		}
Пример #25
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;

            // 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 lineWidth, 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();
            StatusHBox = new Gtk.HBox();

            MenuWidget = new MenuWidget(this, ChatViewManager);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuWidget, 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.PackStart(status_bar_hbox);
            StatusHBox.PackStart(ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = (bool) Frontend.FrontendConfig["ShowStatusBar"];

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);

            if (Frontend.IsMacOSX) {
                IgeMacMenu.GlobalKeyHandlerEnabled = true;
                IgeMacMenu.MenuBar = MenuWidget.MenuBar;
                ShowMenuBar = false;

                var appGroup = IgeMacMenu.AddAppMenuGroup();
                appGroup.AddMenuItem(
                    (Gtk.MenuItem) MenuWidget.PreferencesAction.CreateMenuItem(),
                    _("Preferences")
                );
                IgeMacMenu.QuitMenuItem = (Gtk.MenuItem)
                    MenuWidget.QuitAction.CreateMenuItem();
            }
        }
Пример #26
0
        public ChatView(ChatModel chat)
        {
            Trace.Call(chat);

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

            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;
            _OutputMessageTextView = 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(_OutputMessageTextView);
            _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);
            _TabMenu.ShowAll();

            //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();

            _ThemeSettings = new ThemeSettings();

            // OPT-TODO: this should use a TaskStack instead of TaskQueue
            _LastSeenHighlightQueue = new TaskQueue("LastSeenHighlightQueue("+_Name+")");
            _LastSeenHighlightQueue.AbortedEvent += OnLastSeenHighlightQueueAbortedEvent;
            _LastSeenHighlightQueue.ExceptionEvent += OnLastSeenHighlightQueueExceptionEvent;
        }
Пример #27
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;

            ChatTreeView = new ChatTreeView();

            Notebook               = new Notebook();
            Notebook.SwitchPage   += OnNotebookSwitchPage;
            Notebook.FocusInEvent += OnNotebookFocusInEvent;

            ChatViewManager = new ChatViewManager(Notebook, ChatTreeView);
            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 || MESSAGING_MENU_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 height
                int lineWidth, lineHeight;
                using (var layout = Entry.CreatePangoLayout("Qp")) {
                    layout.GetPixelSize(out lineWidth, out lineHeight);
                }
                var it       = Entry.Buffer.StartIter;
                int newLines = 1;
                // move to end of next visual line
                while (Entry.ForwardDisplayLineEnd(ref it))
                {
                    newLines++;
                    // calling ForwardDisplayLineEnd repeatedly stays on the same position
                    // therefor we move one cursor position further
                    it.ForwardCursorPosition();
                }
                newLines = Math.Min(newLines, 3);
                // use text heigth + a bit extra
                var bestSize = new Gtk.Requisition()
                {
                    Height = (lineHeight * newLines) + 5
                };
                args.Requisition = bestSize;
            };
            entryScrolledWindow.Add(Entry);

            ProgressBar = new Gtk.ProgressBar();
            StatusHBox  = new Gtk.HBox();

            MenuWidget = new MenuWidget(this, ChatViewManager);

            var treeviewScrolledWindow = new Gtk.ScrolledWindow()
            {
                ShadowType       = Gtk.ShadowType.EtchedIn,
                HscrollbarPolicy = Gtk.PolicyType.Never,
                VscrollbarPolicy = Gtk.PolicyType.Automatic
            };
            treeviewScrolledWindow.Add(ChatTreeView);
            ChatViewManager.ChatAdded += (sender, e) => {
                treeviewScrolledWindow.CheckResize();
            };

            var notebookPaned = new Gtk.VPaned();
            notebookPaned.Pack1(Notebook, true, false);
            notebookPaned.Pack2(entryScrolledWindow, false, false);

            var treeviewPaned = new Gtk.HPaned();
            treeviewPaned.Pack1(treeviewScrolledWindow, false, false);
            treeviewPaned.Pack2(notebookPaned, true, false);
            TreeViewHPaned = treeviewPaned;

            var entryPaned = new Gtk.VPaned();
            entryPaned.ButtonPressEvent += (sender, e) => {
                // reset entry size on double click
                if (e.Event.Type == Gdk.EventType.TwoButtonPress &&
                    e.Event.Button == 1)
                {
                    GLib.Timeout.Add(100, delegate {
                        entryPaned.Position = -1;
                        return(false);
                    });
                }
            };
            entryPaned.Pack1(treeviewPaned, true, false);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuWidget, false, false, 0);
            vbox.PackStart(entryPaned, true, true, 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.PackStart(status_bar_hbox);
            StatusHBox.PackStart(ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible   = (bool)Frontend.FrontendConfig["ShowStatusBar"];

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);
        }
        public AudiobookLibrarySource () : base (Catalog.GetString ("Audiobooks, etc"), "AudiobookLibrary", 49)
        {
            MediaTypes = TrackMediaAttributes.AudioBook;
            NotMediaTypes = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.Music;
            SupportsPlaylists = false;

            Properties.SetStringList ("Icon.Name", "audiobook", "source-library");
            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search your audiobooks"));
            Properties.SetString ("TrackView.ColumnControllerXml", String.Format (@"
                <column-controller>
                  <add-all-defaults />
                  <remove-default column=""DiscColumn"" />
                  <remove-default column=""AlbumColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""AlbumArtistColumn"" />
                  <remove-default column=""ConductorColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""BpmColumn"" />
                  <sort-column direction=""asc"">track_title</sort-column>
                  <column modify-default=""ArtistColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                </column-controller>
            ", Catalog.GetString ("Author")));

            var pattern = new AudiobookFileNamePattern ();
            pattern.FolderSchema = CreateSchema<string> ("folder_pattern", pattern.DefaultFolder, "", "");
            pattern.FileSchema   = CreateSchema<string> ("file_pattern",   pattern.DefaultFile, "", "");
            SetFileNamePattern (pattern);

            Actions = new Actions (this);

            grid_view = new LazyLoadSourceContents<AudiobookContent> ();
            book_view = new LazyLoadSourceContents<BookView> ();
            Properties.Set<ISourceContents> ("Nereid.SourceContents", grid_view);

            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set<bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set<System.Action> ("ActivationAction", delegate { SwitchToGridView (); });

            title_switcher = new Gtk.HBox () { Spacing = 0 };
            var b = new Gtk.Button () { Label = this.Name, Relief = Gtk.ReliefStyle.None };
            b.Clicked += delegate { SwitchToGridView (); };
            title_switcher.PackStart (b);

            title_switcher.ShowAll ();
            book_label = new Gtk.Label () { Visible = false };
            title_switcher.PackStart (book_label);
            Properties.Set<Gtk.Widget> ("Nereid.SourceContents.TitleWidget", title_switcher);

            TracksAdded += (o, a) => {
                if (!IsAdding) {
                    MergeBooksAddedSince (DateTime.Now - TimeSpan.FromHours (2));

                    ServiceManager.DbConnection.Execute (
                        "UPDATE CoreTracks SET Attributes = Attributes | ? WHERE PrimarySourceID = ?",
                        TrackMediaAttributes.AudioBook, this.DbId);
                }
            };

            TrackIsPlayingHandler = ServiceManager.PlayerEngine.IsPlaying;

            PlaybackSource = new BookPlaylist ("audiobook-playback-source", this);
            PlaybackSource.DatabaseTrackModel.ForcedSortQuery = BansheeQuery.GetSort ("track", true);

            ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged;

            // Listen for playback changes and auto-set the last-played bookmark
            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.Seek,
                true);
        }
Пример #29
0
        public AudiobookLibrarySource() : base(Catalog.GetString("Audiobooks"), "AudiobookLibrary", 49)
        {
            MediaTypes        = TrackMediaAttributes.AudioBook;
            NotMediaTypes     = TrackMediaAttributes.Podcast | TrackMediaAttributes.VideoStream | TrackMediaAttributes.Music;
            SupportsPlaylists = false;

            Properties.SetStringList("Icon.Name", "audiobook", "source-library");
            Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search your audiobooks"));
            Properties.SetString("TrackView.ColumnControllerXml", String.Format(@"
                <column-controller>
                  <add-all-defaults />
                  <remove-default column=""DiscColumn"" />
                  <remove-default column=""AlbumColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""AlbumArtistColumn"" />
                  <remove-default column=""ConductorColumn"" />
                  <remove-default column=""ComposerColumn"" />
                  <remove-default column=""BpmColumn"" />
                  <sort-column direction=""asc"">track_title</sort-column>
                  <column modify-default=""ArtistColumn"">
                    <title>{0}</title>
                    <long-title>{0}</long-title>
                  </column>
                </column-controller>
            ", Catalog.GetString("Author")));

            var pattern = new AudiobookFileNamePattern();

            pattern.FolderSchema = CreateSchema <string> ("folder_pattern", pattern.DefaultFolder, "", "");
            pattern.FileSchema   = CreateSchema <string> ("file_pattern", pattern.DefaultFile, "", "");
            SetFileNamePattern(pattern);

            Actions = new Actions(this);

            grid_view = new LazyLoadSourceContents <AudiobookContent> ();
            book_view = new LazyLoadSourceContents <BookView> ();
            Properties.Set <ISourceContents> ("Nereid.SourceContents", grid_view);

            Properties.Set <System.Reflection.Assembly> ("ActiveSourceUIResource.Assembly", System.Reflection.Assembly.GetExecutingAssembly());
            Properties.SetString("ActiveSourceUIResource", "ActiveSourceUI.xml");
            Properties.Set <bool> ("ActiveSourceUIResourcePropagate", true);
            Properties.Set <System.Action> ("ActivationAction", delegate { SwitchToGridView(); });

            title_switcher = new Gtk.HBox()
            {
                Spacing = 0
            };
            var title_label = new Gtk.Label()
            {
                Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(this.Name))
            };
            var b = new Gtk.Button(title_label)
            {
                Relief = Gtk.ReliefStyle.None
            };

            b.Clicked += delegate { SwitchToGridView(); };
            title_switcher.PackStart(b);

            title_switcher.ShowAll();
            book_label = new Gtk.Label()
            {
                Visible = false
            };
            title_switcher.PackStart(book_label);
            Properties.Set <Gtk.Widget> ("Nereid.SourceContents.TitleWidget", title_switcher);

            TracksAdded += (o, a) => {
                if (!IsAdding)
                {
                    MergeBooksAddedSince(DateTime.Now - TimeSpan.FromHours(2));

                    ServiceManager.DbConnection.Execute(
                        "UPDATE CoreTracks SET Attributes = Attributes | ? WHERE PrimarySourceID = ?",
                        TrackMediaAttributes.AudioBook, this.DbId);
                }
            };

            TrackIsPlayingHandler = ServiceManager.PlayerEngine.IsPlaying;

            PlaybackSource = new BookPlaylist("audiobook-playback-source", this);
            PlaybackSource.DatabaseTrackModel.ForcedSortQuery = BansheeQuery.GetSort("track", true);

            ServiceManager.PlaybackController.SourceChanged += OnPlaybackSourceChanged;

            // Listen for playback changes and auto-set the last-played bookmark
            ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent,
                                                     PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.Seek,
                                                     true);
        }
Пример #30
0
        public virtual void Initialize(PropertyDescriptor prop)
        {
            CheckType(prop);

            this.prop = prop;

            mainHBox = new Gtk.HBox(false, 6);
            PackStart(mainHBox, false, false, 0);

            if (!prop.Translatable)
            {
                return;
            }

            button = new Gtk.Button();
            try {
                globe     = Gdk.Pixbuf.LoadFromResource("globe.png");
                globe_not = Gdk.Pixbuf.LoadFromResource("globe-not.png");
            } catch (Exception e) {
                Console.WriteLine("Error while loading pixbuf: " + e);
            }
            image = new Gtk.Image(globe);
            button.Add(image);
            button.ButtonPressEvent += ButtonPressed;
            mainHBox.PackEnd(button, false, false, 0);
            mainHBox.ShowAll();

            menu = new Gtk.Menu();

            markItem          = new Gtk.CheckMenuItem("Mark for Translation");
            markItem.Toggled += ToggleMark;
            markItem.Show();
            menu.Add(markItem);

            addContextItem            = new Gtk.MenuItem("Add Translation Context Hint");
            addContextItem.Activated += AddContext;
            menu.Add(addContextItem);
            remContextItem            = new Gtk.MenuItem("Remove Translation Context Hint");
            remContextItem.Activated += RemoveContext;
            menu.Add(remContextItem);

            addCommentItem            = new Gtk.MenuItem("Add Comment for Translators");
            addCommentItem.Activated += AddComment;
            menu.Add(addCommentItem);
            remCommentItem            = new Gtk.MenuItem("Remove Comment for Translators");
            remCommentItem.Activated += RemoveComment;
            menu.Add(remCommentItem);

            contextBox = new Gtk.HBox(false, 6);
            Gtk.Label contextLabel = new Gtk.Label("Translation context");
            contextLabel.Xalign = 0.0f;
            contextBox.PackStart(contextLabel, false, false, 0);
            contextEntry            = new Gtk.Entry();
            contextEntry.WidthChars = 8;
            contextBox.PackStart(contextEntry, true, true, 0);
            contextBox.ShowAll();
            contextEntry.Changed += ContextChanged;

            commentBox = new Gtk.VBox(false, 3);
            Gtk.Label commentLabel = new Gtk.Label("Comment for Translators:");
            commentLabel.Xalign = 0.0f;
            commentBox.PackStart(commentLabel, false, false, 0);
            commentText = new TextBox(3);
            commentBox.PackStart(commentText, false, false, 0);
            commentBox.ShowAll();
            commentText.Changed += CommentChanged;
        }
Пример #31
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;

            ChatTreeView = new ChatTreeView();

            Notebook = new Notebook();
            Notebook.SwitchPage += OnNotebookSwitchPage;
            Notebook.FocusInEvent += OnNotebookFocusInEvent;

            ChatViewManager = new ChatViewManager(Notebook, ChatTreeView);
            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 || MESSAGING_MENU_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
                int lineWidth, lineHeigth;
                using (var layout = Entry.CreatePangoLayout("Qp")) {
                    layout.GetPixelSize(out lineHeigth, out lineHeigth);
                }
                var it = Entry.Buffer.StartIter;
                int newLines = 1;
                // move to end of next visual line
                while (Entry.ForwardDisplayLineEnd(ref it)) {
                    newLines++;
                    // calling ForwardDisplayLineEnd repeatedly stays on the same position
                    // therefor we move one cursor position further
                    it.ForwardCursorPosition();
                }
                newLines = Math.Min(newLines, 3);
                // 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();
            StatusHBox = new Gtk.HBox();

            MenuWidget = new MenuWidget(this, ChatViewManager);

            var treeviewScrolledWindow = new Gtk.ScrolledWindow() {
                ShadowType = Gtk.ShadowType.EtchedIn,
                HscrollbarPolicy = Gtk.PolicyType.Never,
                VscrollbarPolicy = Gtk.PolicyType.Automatic
            };
            treeviewScrolledWindow.Add(ChatTreeView);
            ChatViewManager.ChatAdded += (sender, e) => {
                treeviewScrolledWindow.CheckResize();
            };

            var notebookPaned = new Gtk.VPaned();
            notebookPaned.Pack1(Notebook, true, false);
            notebookPaned.Pack2(entryScrolledWindow, false, false);

            var treeviewPaned = new Gtk.HPaned();
            treeviewPaned.Pack1(treeviewScrolledWindow, false, false);
            treeviewPaned.Pack2(notebookPaned, true, false);
            TreeViewHPaned = treeviewPaned;

            var entryPaned = new Gtk.VPaned();
            entryPaned.ButtonPressEvent += (sender, e) => {
                // reset entry size on double click
                if (e.Event.Type == Gdk.EventType.TwoButtonPress &&
                    e.Event.Button == 1) {
                    GLib.Timeout.Add(100, delegate {
                        entryPaned.Position = -1;
                        return false;
                    });
                }
            };
            entryPaned.Pack1(treeviewPaned, true, false);

            Gtk.VBox vbox = new Gtk.VBox();
            vbox.PackStart(MenuWidget, false, false, 0);
            vbox.PackStart(entryPaned, true, true, 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.PackStart(status_bar_hbox);
            StatusHBox.PackStart(ProgressBar, false, false, 0);
            StatusHBox.ShowAll();
            StatusHBox.NoShowAll = true;
            StatusHBox.Visible = (bool) Frontend.FrontendConfig["ShowStatusBar"];

            vbox.PackStart(StatusHBox, false, false, 0);
            Add(vbox);
        }
Пример #32
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;
        }
Пример #33
0
		public AddinInfoDialog (
		        Mono.Addins.Setup.AddinHeader info,
		        Gtk.Window parent)
: base (info.Name,
		        parent,
		        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.NoSeparator,
		        Gtk.Stock.Close, Gtk.ResponseType.Close)
		{
			this.info = info;

			// TODO: Change this icon to be an addin/package icon
			Gtk.Image icon =
			        new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog);
			icon.Yalign = 0;

			info_label = new Gtk.Label ();
			info_label.Xalign = 0;
			info_label.Yalign = 0;
			info_label.UseMarkup = true;
			info_label.UseUnderline = false;
			info_label.Wrap = true;

			Gtk.HBox hbox = new Gtk.HBox (false, 6);
			Gtk.VBox vbox = new Gtk.VBox (false, 12);
			hbox.BorderWidth = 12;
			vbox.BorderWidth = 6;

			hbox.PackStart (icon, false, false, 0);
			hbox.PackStart (vbox, true, true, 0);

			vbox.PackStart (info_label, true, true, 0);

			hbox.ShowAll ();

			VBox.PackStart (hbox, true, true, 0);

			Fill ();
		}
Пример #34
0
        void AddClicked(object sender, EventArgs args)
        {
            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog(
                Catalog.GetString("Select an icon..."),
                null, Gtk.FileChooserAction.Open, new object[] {});
            dialog.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
            dialog.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok);

            dialog.DefaultResponse = Gtk.ResponseType.Ok;
            dialog.LocalOnly       = true;
            dialog.SetCurrentFolder(last_opened_dir);

            Gtk.FileFilter filter = new Gtk.FileFilter();
            filter.AddPixbufFormats();

            dialog.Filter = filter;

            // Extra Widget
            Gtk.Label l          = new Gtk.Label(Catalog.GetString("_Host name:"));
            Gtk.Entry host_entry = new Gtk.Entry();
            l.MnemonicWidget = host_entry;
            Gtk.HBox hbox = new Gtk.HBox(false, 6);
            hbox.PackStart(l, false, false, 0);
            hbox.PackStart(host_entry, true, true, 0);
            hbox.ShowAll();

            dialog.ExtraWidget = hbox;

            int    response;
            string icon_file;
            string host;

run_add_dialog:
            response  = dialog.Run();
            icon_file = dialog.Filename;
            host      = host_entry.Text.Trim();

            if (response == (int)Gtk.ResponseType.Ok &&
                host == String.Empty)
            {
                // Let the user know that they
                // have to specify a host name.
                HIGMessageDialog warn =
                    new HIGMessageDialog(
                        null,
                        Gtk.DialogFlags.DestroyWithParent,
                        Gtk.MessageType.Warning,
                        Gtk.ButtonsType.Ok,
                        Catalog.GetString("No host name specified"),
                        Catalog.GetString("You must specify the Bugzilla " +
                                          "host name to use with this icon."));
                warn.Run();
                warn.Destroy();

                host_entry.GrabFocus();
                goto run_add_dialog;
            }
            else if (response != (int)Gtk.ResponseType.Ok)
            {
                dialog.Destroy();
                return;
            }

            // Keep track of the last directory the user had open
            last_opened_dir = dialog.CurrentFolder;

            dialog.Destroy();

            // Copy the file to the BugzillaIcons directory
            string err_msg;

            if (!CopyToBugizllaIconsDir(icon_file, host, out err_msg))
            {
                HIGMessageDialog err =
                    new HIGMessageDialog(
                        null,
                        Gtk.DialogFlags.DestroyWithParent,
                        Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok,
                        Catalog.GetString("Error saving icon"),
                        Catalog.GetString("Could not save the icon file.") +
                        "  " +
                        err_msg);
                err.Run();
                err.Destroy();
            }

            UpdateIconStore();
        }
Пример #35
0
 public void SetContent(string label, object imageBackend)
 {
     Gdk.Pixbuf pix = (Gdk.Pixbuf)imageBackend;
     if (label != null && imageBackend == null)
         Widget.Label = label;
     else if (label == null && imageBackend != null) {
         var img = new Gtk.Image (pix);
         img.Show ();
         Widget.Image = img;
     } else if (label != null && imageBackend != null) {
         Gtk.HBox box = new Gtk.HBox (false, 3);
         var img = new Gtk.Image (pix);
         box.PackStart (img, false, false, 0);
         var lab = new Gtk.Label (label);
         box.PackStart (lab, false, false, 0);
         box.ShowAll ();
         Widget.Image = box;
     }
 }
Пример #36
0
 public Main(Controller.Main c)
     : base(Gtk.WindowType.Toplevel)
 {
     ctl = c;
     Name = "di";
     Title = "di";
     DefaultWidth = 800;
     DefaultHeight = 600;
     DeleteEvent += OnDeleteEvent;
     topLevelBox = new Gtk.HBox();
     topLevelBox.Homogeneous = false;
     topLevelBox.Spacing = 20;
     Add(topLevelBox);
     windowsBox = new Gtk.HBox();
     windowsBox.Homogeneous = true;
     windowsBox.Spacing = 10;
     foreach (var window in ctl.Windows)
     {
         var view = new WindowView(this, window);
         windowsBox.Add(view);
     }
     topLevelBox.PackStart(windowsBox, true, true, 0);
     ctl.Windows.Added.Add((index, window) =>
     {
         var view = new WindowView(this, window);
         windowsBox.Add(view);
         windowsBox.ShowAll();
     });
     ctl.Windows.Removed.Add((index, window) =>
     {
         var view = windowsBox.Children[index];
         bool hadFocus = view.ContainsFocus();
         windowsBox.Remove(view);
         if (hadFocus && windowsBox.Children.Length > 0)
         {
             windowsBox.Children[0].GiveFocus();
         }
     });
     ctl.Windows.Cleared.Add(() =>
     {
         foreach (var view in windowsBox.Children)
         {
             windowsBox.Remove(view);
         }
     });
     ctl.Windows.CurrentChanged.Add((idx, win) => ApplyControllerFocus(win));
     ctl.BeginTask.Add(task =>
     {
         var sidebar = Sidebar.Create(task);
         topLevelBox.PackEnd(sidebar, false, false, 20);
         task.End.Add(() =>
         {
             bool hadFocus = sidebar.ContainsFocus();
             topLevelBox.Remove(sidebar);
             if (hadFocus)
             {
                 ApplyControllerFocus(ctl.Windows.Current);
             }
         });
         sidebar.ShowAll();
     });
 }
Пример #37
0
		public virtual void Initialize (PropertyDescriptor prop)
		{
			CheckType (prop);
			
			this.prop = prop;

			mainHBox = new Gtk.HBox (false, 6);
			PackStart (mainHBox, false, false, 0);

			if (!prop.Translatable)
				return;

			button = new Gtk.Button ();
			try {
				globe = Gdk.Pixbuf.LoadFromResource ("globe.png");
				globe_not = Gdk.Pixbuf.LoadFromResource ("globe-not.png");
			} catch (Exception e) {
				Console.WriteLine ("Error while loading pixbuf: " + e);
			}
			image = new Gtk.Image (globe);
			button.Add (image);
			button.ButtonPressEvent += ButtonPressed;
			mainHBox.PackEnd (button, false, false, 0);
			mainHBox.ShowAll ();
			
			menu = new Gtk.Menu ();

			markItem = new Gtk.CheckMenuItem ("Mark for Translation");
			markItem.Toggled += ToggleMark;
			markItem.Show ();
			menu.Add (markItem);
			
			addContextItem = new Gtk.MenuItem ("Add Translation Context Hint");
			addContextItem.Activated += AddContext;
			menu.Add (addContextItem);
			remContextItem = new Gtk.MenuItem ("Remove Translation Context Hint");
			remContextItem.Activated += RemoveContext;
			menu.Add (remContextItem);
			
			addCommentItem = new Gtk.MenuItem ("Add Comment for Translators");
			addCommentItem.Activated += AddComment;
			menu.Add (addCommentItem);
			remCommentItem = new Gtk.MenuItem ("Remove Comment for Translators");
			remCommentItem.Activated += RemoveComment;
			menu.Add (remCommentItem);
			
			contextBox = new Gtk.HBox (false, 6);
			Gtk.Label contextLabel = new Gtk.Label ("Translation context");
			contextLabel.Xalign = 0.0f;
			contextBox.PackStart (contextLabel, false, false, 0);
			contextEntry = new Gtk.Entry ();
			contextEntry.WidthChars = 8;
			contextBox.PackStart (contextEntry, true, true, 0);
			contextBox.ShowAll ();
			contextEntry.Changed += ContextChanged;

			commentBox = new Gtk.VBox (false, 3);
			Gtk.Label commentLabel = new Gtk.Label ("Comment for Translators:");
			commentLabel.Xalign = 0.0f;
			commentBox.PackStart (commentLabel, false, false, 0);
			commentText = new TextBox (3);
			commentBox.PackStart (commentText, false, false, 0);
			commentBox.ShowAll ();
			commentText.Changed += CommentChanged;
		}