Example #1
0
 void HandleActivate(object obj, EventArgs args)
 {
     if (TagSelected != null)
     {
         TagMenu.TagMenuItem t = obj as TagMenu.TagMenuItem;
         if (t != null)
         {
             TagSelected(t.Value);
         }
         else
         {
             Log.Debug("Item was not a TagMenuItem");
         }
     }
 }
Example #2
0
    public void Populate(IPhoto [] photos)
    {
        Dictionary <uint, Tag> dict = new Dictionary <uint, Tag> ();

        if (photos != null)
        {
            foreach (IPhoto p in photos)
            {
                foreach (Tag t in p.Tags)
                {
                    if (!dict.ContainsKey(t.Id))
                    {
                        dict.Add(t.Id, t);
                    }
                }
            }
        }

        foreach (Widget w in this.Children)
        {
            w.Destroy();
        }

        if (dict.Count == 0)
        {
            /* Fixme this should really set parent menu
             * items insensitve */
            MenuItem item = new MenuItem(Mono.Unix.Catalog.GetString("(No Tags)"));
            this.Append(item);
            item.Sensitive = false;
            item.ShowAll();
            return;
        }

        foreach (Tag t in dict.Values)
        {
            MenuItem item = new TagMenu.TagMenuItem(t);
            this.Append(item);
            item.ShowAll();
            item.Activated += HandleActivate;
        }
    }
Example #3
0
    public void Populate(IPhoto [] photos)
    {
        Dictionary<uint, Tag> dict = new Dictionary<uint, Tag> ();
        if (photos != null) {
            foreach (IPhoto p in photos) {
                foreach (Tag t in p.Tags) {
                    if (!dict.ContainsKey (t.Id)) {
                        dict.Add (t.Id, t);
                    }
                }
            }
        }

        foreach (Widget w in this.Children) {
            w.Destroy ();
        }

        if (dict.Count == 0) {
            /* Fixme this should really set parent menu
               items insensitve */
            MenuItem item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Tags)"));
            this.Append (item);
            item.Sensitive = false;
            item.ShowAll ();
            return;
        }

        foreach (Tag t in dict.Values) {
            MenuItem item = new TagMenu.TagMenuItem (t);
            this.Append (item);
            item.ShowAll ();
            item.Activated += HandleActivate;
        }
    }