コード例 #1
0
ファイル: ConfigBase.cs プロジェクト: iverson0423/legacy
        public ConfigBase(String baseName, String Name)
        {
            noGconfLoad  = false;
            client       = new GConf.Client();
            keyBase      = baseName.TrimEnd('/');
            keyName      = Name.TrimEnd('/').TrimStart('/');
            keyFullName  = keyBase + "/" + keyName;
            keyFullName_ = keyFullName + "/";
            string[] sa;
            try{
                sa = (string[])client.Get(AppBase + "/objects");
            }catch {
                sa = new string[0];
                client.Set(AppBase + "/objects", sa);
            }

            if (Array.FindIndex(sa, Name.Equals) == -1)
            {
                Array.Resize(ref sa, sa.Length + 1);
                sa[sa.Length - 1] = Name;
                client.Set(AppBase + "/objects", sa);
            }
            client.AddNotify(keyFullName,
                             new NotifyEventHandler(OnGConf_Changed));
            // client.AddNotify(keyFullName,
            //      new NotifyEventHandler(beep));
            System.Console.WriteLine("Listening on " + keyFullName);
        }
コード例 #2
0
        protected override void PluginInitialize()
        {
            RegisterConfigurationKey("Username");
            RegisterConfigurationKey("Password");

            gconf = Globals.Configuration;
            gconf.AddNotify(ConfigurationBase, GConfNotifier);

            source = new LockerSource(this);
            SourceManager.AddSource(this.source);
        }
コード例 #3
0
        // Plugin initializer
        public override void Initialize(IPlayer player)
        {
            // Initialize gettext
            Catalog.Init("muine", Defines.GNOME_LOCALE_DIR);

            GConf.Client gconf_client = new GConf.Client();
            gconf_client.AddNotify(GConfKeyShowNotifications,
                                   new GConf.NotifyEventHandler(OnShowNotificationsChanged));
            showNotifications = (bool)gconf_client.Get(GConfKeyShowNotifications);

            // Load stock icons
            InitStockIcons();

            // Connect to player
            this.player = player;

            player.SongChangedEvent  += OnSongChangedEvent;
            player.StateChangedEvent += OnStateChangedEvent;

            // Install "Hide Window" menu item
            player.UIManager.AddUi(player.UIManager.NewMergeId(),
                                   "/MenuBar/FileMenu/ExtraFileActions", "ToggleVisibleMenuItem",
                                   "ToggleVisible", UIManagerItemType.Menuitem, false);

            // Build menu
            player.UIManager.AddUiFromResource("TrayIcon.xml");

            // Setup GConf
            gconf_client = new GConf.Client();
            gconf_client.AddNotify(old_behaviour_key, BehaviourNotify);
            try {
                old_mouse_behaviour = (bool)gconf_client.Get(old_behaviour_key);
            } catch {
                old_mouse_behaviour = false;
                gconf_client.Set(old_behaviour_key, false);
            }

            // Maybe prevent 'delete' event from closing window by intercepting it
            player.Window.WidgetEvent += new WidgetEventHandler(OnWindowEvent);

            menu              = (Menu)player.UIManager.GetWidget("/Menu");
            menu.Deactivated += OnMenuDeactivated;

            // Init tooltips -- we init into "not playing" state
            tooltips = new Tooltips();
            tooltips.Disable();

            // init icon
            Init();
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            conf    = new GConf.Client();
            portcfg = new serialportcfg[2];
            ports   = new SerialPort[2];
            Application.Init();
            readconfig();
            conf.AddNotify(KEY_BASE.TrimEnd(new char[] { '/', '\\' }), new GConf.NotifyEventHandler(GConf_Changed));
            win = new MainWindow();
            win.Show();

            while (!terminate)
            {
                if (connected)
                {
                    win.serialpoll();
                }
                Application.RunIteration();
            }
            //	Application.Run ();
        }
コード例 #5
0
        protected override void PluginInitialize()
        {
            RegisterConfigurationKey("Username");
            RegisterConfigurationKey("Password");

            gconf = Globals.Configuration;
            gconf.AddNotify(ConfigurationBase, GConfNotifier);

            source = new LockerSource(this);
            SourceManager.AddSource(this.source);
        }
コード例 #6
0
 public void AddListener(string path, NotifyEventHandler handler)
 {
     client.AddNotify(path, handler);
 }