Exemple #1
0
 private Category create_new_temporary_category()
 {
     MetaLabel label = new MetaLabel();
     label.parent_db_id = -1;
     label.label = Mono.Unix.Catalog.GetString("New Category");
     Category cat = new Category(label);
     cat.search_func = search_func;
     categories.Add(cat);
     return cat;
 }
Exemple #2
0
        public CategoryDrawer(Category cat)
        {
            category = cat;

            // create representation
            representation = new Gtk.VBox();
            representation.PackStart(create_category_button(cat), false, false, 6);
            representation.Name = category.metalabel.label;

            foreach (UserLabel label in cat.labels)
                representation.PackStart(create_button(label), false, false, 0);
        }
Exemple #3
0
        private void header_click(ButtonPressEventArgs args, Category cat)
        {
            if (args.Event.Button == 3) {
             	Menu popupMenu = new Menu();

                MenuItem create_label = new MenuItem(Mono.Unix.Catalog.GetString("Create a new label"));
                create_label.Activated += delegate { add_new_label(); };
                popupMenu.Add(create_label);

                MenuItem rename_item = new MenuItem(Mono.Unix.Catalog.GetString("Rename category"));
                rename_item.Activated += delegate { rename_category(false); };
                popupMenu.Add(rename_item);

                if (!category.initial) {
                    MenuItem delete_item = new MenuItem(Mono.Unix.Catalog.GetString("Delete category"));
                    delete_item.Activated += delegate { remove_category_callback(cat.metalabel.db_id); };
                    popupMenu.Add(delete_item);
                }

                popupMenu.Add(new Gtk.SeparatorMenuItem());

                MenuItem create_item = new MenuItem(Mono.Unix.Catalog.GetString("Create a new category"));
                create_item.Activated += delegate { add_new_category_to_ui_callback(); };
                popupMenu.Add(create_item);

                popupMenu.ShowAll();
              			popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
            }
        }
Exemple #4
0
        private Gtk.EventBox create_category_button(Category cat)
        {
            Gtk.EventBox header_wrapper = new Gtk.EventBox();
            Gtk.Alignment header_alignment = new Gtk.Alignment(0, 0, 0, 0);

            Gtk.HBox header = new Gtk.HBox();
            header.Add(CairoDrawing.create_empty_image(22, 16));
            header.Add(new Gtk.Label(" " + cat.metalabel.label));

            header_alignment.Add(header);
            header_wrapper.Name = cat.metalabel.label;
            header_wrapper.Add(header_alignment);
            header_wrapper.ButtonPressEvent += delegate (object sender, ButtonPressEventArgs args) {
                header_click(args, cat);
            };
            return header_wrapper;
        }
Exemple #5
0
        private void got_labels(List<MetaLabel> labels)
        {
            System.Console.WriteLine("got labels in categories {0}", labels.Count);

            categories.Clear();

            foreach (MetaLabel l in labels)
            {
                if (l.parent_db_id == -1)
                {
                    Category cat = new Category(l);
                    cat.search_func = search_func;
                    categories.Add(cat);
                }
                else
                {
                    foreach (Category c in categories)
                        if (c.metalabel.db_id == l.parent_db_id)
                            c.add_label(l);
                }
            }

            System.Console.WriteLine("categories {0}", categories.Count);

            drawer.set_categories(categories);
        }