Ejemplo n.º 1
0
        public EditIconDialog(IProject project, ProjectIconSet iconSet)
        {
            Glade.XML xml = new Glade.XML(null, "stetic.glade", "EditIconDialog", null);
            xml.Autoconnect(this);
            dialog.Response += OnResponse;

            this.project = project;
            this.iconSet = iconSet;

            nameEntry.Text = iconSet.Name;

            if (iconSet.Sources.Count == 0)
            {
                radioSingle.Active = true;
                imageLabel.Text    = "";
            }
            else if (iconSet.Sources.Count == 1 && iconSet.Sources[0].AllWildcarded)
            {
                radioSingle.Active = true;
                singleIcon         = iconSet.Sources[0].Image;
                if (singleIcon != null)
                {
                    imageLabel.Text   = singleIcon.Label;
                    imageImage.Pixbuf = singleIcon.GetThumbnail(project, 16);
                }
                else
                {
                    imageLabel.Text = "";
                }
            }
            else
            {
                radioMultiple.Active = true;
            }

            hboxSingle.Sensitive   = radioSingle.Active;
            hboxMultiple.Sensitive = !radioSingle.Active;

            // Build the tree

            sourceListStore  = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            sourceList.Model = sourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf();
            col.Title = Catalog.GetString("Image");
            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText();
            col.PackStart(crt, true);
            col.AddAttribute(crt, "text", 1);
            sourceList.AppendColumn(col);

            col        = new Gtk.TreeViewColumn();
            col.Expand = true;
            col.Title  = Catalog.GetString("Size");
            CellRendererComboBox crtb = new CellRendererComboBox();

            crtb.Changed += new ComboSelectionChangedHandler(OnSizeComboChanged);
            crtb.Values   = sizes;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 2);
            sourceList.AppendColumn(col);

            col           = new Gtk.TreeViewColumn();
            col.Expand    = true;
            col.Title     = Catalog.GetString("State");
            crtb          = new CellRendererComboBox();
            crtb.Changed += new ComboSelectionChangedHandler(OnStateComboChanged);
            crtb.Values   = states;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 3);
            sourceList.AppendColumn(col);

            col           = new Gtk.TreeViewColumn();
            col.Expand    = true;
            col.Title     = Catalog.GetString("Direction");
            crtb          = new CellRendererComboBox();
            crtb.Changed += new ComboSelectionChangedHandler(OnDirComboChanged);
            crtb.Values   = directions;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 4);
            sourceList.AppendColumn(col);

            foreach (ProjectIconSource source in iconSet.Sources)
            {
                AddSource(source);
            }

            UpdateButtons();
        }
Ejemplo n.º 2
0
        public EditIconDialog(IProject project, ProjectIconSet iconSet)
        {
            Glade.XML xml = new Glade.XML (null, "stetic.glade", "EditIconDialog", null);
            xml.Autoconnect (this);
            dialog.Response += OnResponse;

            this.project = project;
            this.iconSet = iconSet;

            nameEntry.Text = iconSet.Name;

            if (iconSet.Sources.Count == 0) {
                radioSingle.Active = true;
                imageLabel.Text = "";
            }
            else if (iconSet.Sources.Count == 1 && iconSet.Sources[0].AllWildcarded) {
                radioSingle.Active = true;
                singleIcon = iconSet.Sources[0].Image;
                if (singleIcon != null) {
                    imageLabel.Text = singleIcon.Label;
                    imageImage.Pixbuf = singleIcon.GetThumbnail (project, 16);
                } else
                    imageLabel.Text = "";
            } else {
                radioMultiple.Active = true;
            }

            hboxSingle.Sensitive = radioSingle.Active;
            hboxMultiple.Sensitive = !radioSingle.Active;

            // Build the tree

            sourceListStore = new Gtk.ListStore (typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            sourceList.Model = sourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf ();
            col.Title = Catalog.GetString ("Image");
            col.PackStart (pr, false);
            col.AddAttribute (pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText ();
            col.PackStart (crt, true);
            col.AddAttribute (crt, "text", 1);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("Size");
            CellRendererComboBox crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnSizeComboChanged);
            crtb.Values = sizes;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 2);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("State");
            crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnStateComboChanged);
            crtb.Values = states;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 3);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("Direction");
            crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnDirComboChanged);
            crtb.Values = directions;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 4);
            sourceList.AppendColumn (col);

            foreach (ProjectIconSource source in iconSet.Sources)
                AddSource (source);

            UpdateButtons ();
        }