Beispiel #1
0
 public GroupWindowMenuItem(GroupWindow groupWindow) :
     base(groupWindow.SelectedGroup == null ?
          Catalog.GetString("Everyone") :
          groupWindow.SelectedGroup.DisplayName)
 {
     this.groupWindow = groupWindow;
 }
Beispiel #2
0
        private void OnPeople(object o, System.EventArgs args)
        {
            GroupWindow gw = new GroupWindow();

            groupWindows [gw] = gw;
            gw.DeleteEvent   += OnGroupWindowDeleted;
            gw.ShowAll();
        }
Beispiel #3
0
        private void OnGroupWindowDeleted(object sender, DeleteEventArgs args)
        {
            Logger.Debug("Application.OnGroupWindowDeleted");
            GroupWindow gw = sender as GroupWindow;

            gw.Hide();

            if (groupWindows.ContainsKey(gw))
            {
                groupWindows.Remove(gw);
            }

            gw.Destroy();
        }
Beispiel #4
0
        private bool OpenSavedGroupWindows()
        {
            GroupWindow gw;

            try {
                string[] groupWindowIds = null;
                try {
                    // Use a try/catch here because gconf can puke on zero-length string[] settings.
                    groupWindowIds = Preferences.Get(Preferences.GroupWindows) as String[];
                } catch {}
                if (groupWindowIds == null || groupWindowIds.Length == 0)
                {
                    // Create a new Group Window with Everyone selected
                    gw = new GroupWindow();
                    groupWindows [gw] = gw;
                    gw.DeleteEvent   += OnGroupWindowDeleted;
                    gw.ShowAll();
                }
                else
                {
                    foreach (string id in groupWindowIds)
                    {
                        gw = new GroupWindow(id);

                        groupWindows [gw] = gw;
                        gw.DeleteEvent   += OnGroupWindowDeleted;
                        gw.ShowAll();
                    }
                }
            } catch (Exception osgw) {
                Logger.Debug(osgw.Message);
                Logger.Debug(osgw.StackTrace);
            }

            return(false);            // Prevent GLib.Idle from calling this method again
        }
Beispiel #5
0
        private void OnImageClick(object o, ButtonPressEventArgs args)          // handler for mouse click
        {
            if (!initialized)
            {
                return;
            }

            if (args.Event.Button == 1)
            {
                if (groupWindows.Count <= 0)
                {
                    GroupWindow gw = new GroupWindow();
                    groupWindows [gw] = gw;
                    gw.DeleteEvent   += OnGroupWindowDeleted;
                    gw.ShowAll();
                }
                else
                {
                    foreach (GroupWindow gw in groupWindows.Values)
                    {
                        gw.Present();
                    }
                }
            }
            else if (args.Event.Button == 3)               //right click
            {
                // FIXME: Eventually get all these into UIManagerLayout.xml file
                Menu popupMenu = new Menu();

                if (groupWindows.Count > 0)
                {
                    // List all the opened GroupWindows here
                    foreach (GroupWindow groupWindow in groupWindows.Values)
                    {
                        GroupWindowMenuItem item = new GroupWindowMenuItem(
                            groupWindow);
                        item.Activated += OnGroupWindowMenuItem;
                        popupMenu.Add(item);
                    }

                    popupMenu.Add(new SeparatorMenuItem());
                }

                ImageMenuItem people = new ImageMenuItem(
                    Catalog.GetString("New Group Window ..."));
                people.Activated += OnPeople;
                popupMenu.Add(people);

//                  ImageMenuItem everyone = new ImageMenuItem ("Everyone");
//                  everyone.Activated += OnEveryone;
//                  popupMenu.Add (everyone);


                SeparatorMenuItem separator = new SeparatorMenuItem();
                popupMenu.Add(separator);

                ImageMenuItem preferences = new ImageMenuItem(Gtk.Stock.Preferences, null);
                preferences.Activated += OnPreferences;
                popupMenu.Add(preferences);

                separator = new SeparatorMenuItem();
                popupMenu.Add(separator);

                ImageMenuItem quit = new ImageMenuItem(
                    Catalog.GetString("Quit"));
                quit.Activated += OnQuit;
                popupMenu.Add(quit);

                popupMenu.ShowAll();                 // shows everything
                //popupMenu.Popup(null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
                popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
            }
        }