示例#1
0
        private void OnCelltoggled(object sender, ToggledArgs args)
        {
            TreeIter iter;

            if (store.GetIterFromString(out iter, args.Path))
            {
                int item_index = int.Parse(args.Path);
                //if it's checked, remove the check index
                //else, add it
                bool new_value = (checked_items.IndexOf(item_index) != -1);
                if (new_value)
                {
                    checked_items.Remove(item_index);
                }
                else
                {
                    checked_items.Add(item_index);
                }
                //raise itemcheck event
                if (ItemCheck != null)
                {
                    ItemCheck(this, new ListItemCheckEventArgs(item_index, new_value));
                }
            }
        }
示例#2
0
        // we need to manually set the toggle when selected otherwise
        // it won't show in the gui.
        public void toggle_it(object o, Gtk.ToggledArgs args)
        {
            store.GetIterFromString(out iter, args.Path);
            bool tog = (bool)store.GetValue(iter, 0);

            store.SetValue(iter, 0, !tog);
        }
示例#3
0
 public static void SaveList(ListStore list, string path)
 {
     path = path + "streams.list";
     File.Delete(path);
     for (int i = 0; i < list.IterNChildren(); i++) {
         TreeIter iter;
         list.GetIterFromString (out iter, i.ToString ());
         File.AppendAllText(path, list.GetValue(iter, 0).ToString());
         File.AppendAllText(path, " ");
         File.AppendAllText(path, list.GetValue(iter, 1).ToString());
         File.AppendAllText(path, "\n");
     }
 }
示例#4
0
        }        // OnOmitCBToggled

        public BranchSelectionDialog(ICollection <string> branchLocations, string defaultLocation, string localDirectory, bool enableLocalPathSelection, bool enableRemember, bool enableOverwrite, bool enableOmitHistory)
        {
            this.Build();

            Parent = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();
            textRenderer.Editable = true;
            textRenderer.Edited  += delegate(object o, EditedArgs args) {
                try {
                    Gtk.TreeIter eiter;
                    branchStore.GetIterFromString(out eiter, args.Path);
                    branchStore.SetValue(eiter, 0, args.NewText);
                } catch {}
            };

            branchTreeView.Model          = branchStore;
            branchTreeView.HeadersVisible = false;
            branchTreeView.AppendColumn("Branch", textRenderer, "text", 0);

            Gtk.TreeIter iter,
                         defaultIter = default(Gtk.TreeIter);
            bool found = false;

            foreach (string location in branchLocations)
            {
                iter = branchStore.AppendValues(location);
                if (location == defaultLocation)
                {
                    defaultIter = iter;
                    found       = true;
                }
            }
            iter = branchStore.AppendValues(string.Empty);

            if (1 == branchLocations.Count)
            {
                branchStore.GetIterFirst(out iter);
            }            // when only one branch is known, default to it

            branchTreeView.Selection.SelectIter(found? defaultIter: iter);

            if (!string.IsNullOrEmpty(localDirectory))
            {
                localPathButton.SetCurrentFolder(localDirectory);
            }
            localPathButton.Sensitive = enableLocalPathSelection;
            omitCB.Visible            = enableOmitHistory;
            defaultCB.Sensitive       = enableRemember;
            overwriteCB.Sensitive     = enableOverwrite;
        }        // constructor
示例#5
0
        public MainWindow()
        {
            XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade",
                "mainVBox", null);
            gxml.Toplevel = this;
            gxml.Autoconnect(this);

            XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade",
                "instContextMenu", null);
            gxml2.Autoconnect(this);

            /*
             * HACK: the nested menu isn't picked up by the first gxml object. It is probably a GTK# bug.
             * This is the fix - manually asking for the menu and connecting it.
             */
            XML gxml3 = new XML(null, "MultiMC.GTKGUI.MainWindow.glade",
                "menunew", null);
            gxml3.Autoconnect(this);
            newInstButton.Menu = menunew;

            this.Add(mainVBox);

            ShowAll();

            this.WidthRequest = 620;
            this.HeightRequest = 380;

            DeleteEvent += (o, args) => Application.Quit();

            // Set up the instance icon view
            instListStore = new ListStore(
                typeof(string), typeof(Gdk.Pixbuf), typeof(Instance));

            instView.Model = instListStore;
            instView.TextColumn = 0;
            instView.PixbufColumn = 1;
            instView.ItemWidth = -1;

            Gtk.CellRendererText crt = instView.Cells[0] as CellRendererText;
            crt.Editable = true;
            crt.Edited += (object o, EditedArgs args) =>
            {
                int EditedIndex = int.Parse(args.Path);
                TreeIter iter;
                // don't allow bad names
                if(!Instance.NameIsValid(args.NewText))
                    return;
                System.Console.WriteLine("Path: " + args.Path + " New text: " + args.NewText);
                if(instListStore.GetIterFromString(out iter,args.Path))
                {
                    instListStore.SetValue(iter, 0, args.NewText);
                    Instance inst = instListStore.GetValue(iter, 2) as Instance;
                    inst.Name = args.NewText;
                }

            };

            instView.Orientation = Orientation.Vertical;
            instView.ButtonPressEvent += (o, args) =>
                {
                    if (args.Event.Button == 3 &&
                        instView.GetPathAtPos((int)args.Event.X,
                                              (int)args.Event.Y) != null)
                    {
                        instView.SelectPath(instView.GetPathAtPos(
                            (int)args.Event.X, (int)args.Event.Y));
                        instContextMenu.Popup();
                    }
                };
            instView.KeyPressEvent += (object o, KeyPressEventArgs args) =>
                {
                    if(args.Event.Key == Gdk.Key.F2)
                    {
                        if(instView.SelectedItems.Count() != 0)
                            instView.SetCursor(instView.SelectedItems[0], instView.Cells[0], true);
                    }
                    else if(args.Event.Key == Gdk.Key.Escape)
                    {
                        if(EscPressed != null)
                            EscPressed(this, EventArgs.Empty);
                    }
                };

            // Set up the task list
            EventfulList<Task> tList = new EventfulList<Task>();
            tList.Added += TaskAdded;
            tList.Removed += TaskRemoved;

            TaskList = tList;
            taskProgBars = new Dictionary<int, Box>();

            // Set up the instance list
            EventfulList<Instance> iList = new EventfulList<Instance>();
            iList.Added += InstAdded;
            iList.Removed += InstRemoved;

            InstanceList = iList;

            helpButton.Sensitive = false;
            if(OSUtils.OS == OSEnum.Linux)
            {
                Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem;
                openalRemoveItem.Visible = true;
            }
        }