Example #1
0
        public TomboyPanelAppletEventBox(NoteManager manager)
            : base()
        {
            this.manager = manager;
            tray         = new TomboyTray(manager, this);

            // Load a 16x16-sized icon to ensure we don't end up with a
            // 1x1 pixel.
            panel_size = 16;
            // Load Icon to display in the panel.
            // First we try the "tomboy-panel" icon. This icon can be replaced
            // by the user's icon theme. If the theme does not have this icon
            // then we fall back to the Tomboy Menu icon named "tomboy".
            var icon = GuiUtils.GetIcon("tomboy-panel", panel_size) ??
                       GuiUtils.GetIcon("tomboy", panel_size);

            this.image = new Gtk.Image(icon);

            this.CanFocus          = true;
            this.ButtonPressEvent += ButtonPress;
            this.Add(image);
            this.ShowAll();

            string tip_text = TomboyTrayUtils.GetToolTipText();

            tips = new Gtk.Tooltips();
            tips.SetTip(this, tip_text, null);
            tips.Enable();
            tips.Sink();

            SetupDragAndDrop();
        }
        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;
        }
Example #3
0
		public TomboyPanelAppletEventBox (NoteManager manager)
: base ()
		{
			this.manager = manager;
			tray = new TomboyTray (manager, this);

			// Load a 16x16-sized icon to ensure we don't end up with a
			// 1x1 pixel.
			panel_size = 16;
			// Load Icon to display in the panel.
			// First we try the "tomboy-panel" icon. This icon can be replaced
			// by the user's icon theme. If the theme does not have this icon
			// then we fall back to the Tomboy Menu icon named "tomboy".
			var icon = GuiUtils.GetIcon ("tomboy-panel", panel_size) ??
				GuiUtils.GetIcon ("tomboy", panel_size);
			this.image = new Gtk.Image (icon);

			this.CanFocus = true;
			this.ButtonPressEvent += ButtonPress;
			this.Add (image);
			this.ShowAll ();

			string tip_text = TomboyTrayUtils.GetToolTipText ();

			tips = new Gtk.Tooltips ();
			tips.SetTip (this, tip_text, null);
			tips.Enable ();
			tips.Sink ();

			SetupDragAndDrop ();
		}
        protected internal virtual Gtk.ToolItem CreateToolItem(CommandManager manager)
        {
            if (cmdId == Command.Separator)
                return new Gtk.SeparatorToolItem ();

            Command cmd = manager.GetCommand (cmdId);
            if (cmd is CustomCommand) {
                Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType);
                Gtk.ToolItem ti = new Gtk.ToolItem ();
                ti.Child = child;
                if (cmd.Text != null && cmd.Text.Length > 0) {
                    Gtk.Tooltips tips = new Gtk.Tooltips ();
                    ti.SetTooltip (tips, cmd.Text, cmd.Text);
                    tips.Enable ();
                }
                return ti;
            }

            ActionCommand acmd = cmd as ActionCommand;
            if (acmd == null)
                throw new InvalidOperationException ("Unknown cmd type.");

            if (acmd.CommandArray) {
                CommandMenu menu = new CommandMenu (manager);
                menu.Append (CreateMenuItem (manager));
                return new MenuToolButton (menu, acmd.Icon);
            }
            else if (acmd.ActionType == ActionType.Normal)
                return new CommandToolButton (cmdId, manager);
            else
                return new CommandToggleToolButton (cmdId, manager);
        }