예제 #1
0
        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);
        }
 override protected void Installation(CStatusWindow sw)
 {
     //Installieren
     sw.Mainlabel = CConfiguration.txtInstalling;
     client.Set(GConfShowSplashKey, true);
     client.Set(GConfSplashImageKey, InstallThemeFile);
 }
예제 #3
0
 override protected void Installation(CStatusWindow sw)
 {
     //Installieren
     sw.Mainlabel = CConfiguration.txtInstalling;
     client.Set(GConfBgKey, InstallThemeFile);
     client.Set(GConfISKey, currentStyleString);
 }
예제 #4
0
    /// <summary>
    ///    Stores the named configuration item with the specified value.
    /// </summary>
    /// <param name="name">Item name</param>
    /// <param name="value">Item value</param>
    /// <remarks>
    ///   This method will store the item in the desklet instance config
    ///   storage area. GConf path /apps/mono/desklets/DESKLET_NAME/DESKLET_INSTANCE_NUMBER is
    ///   used as the storage base.
    /// </remarks>
    public override void Store(string name, object value)
    {
        CheckValid();

        string key = String.Format("{0}/{1}", KeyPathInstance, name);

        client.Set(key, value);
    }
 public override void Revert()
 {
     if (revertIsAvailable){
         client = new GConf.Client();
         client.Set(GConfShowSplashKey,splashWasActive);
         client.Set(GConfSplashImageKey,prevSplash);
         revertIsAvailable=false;
     }
 }
 override public void Revert()
 {
     if (revertIsAvailable)
     {
         client = new GConf.Client();
         client.Set(GConfShowSplashKey, splashWasActive);
         client.Set(GConfSplashImageKey, prevSplash);
         revertIsAvailable = false;
     }
 }
예제 #7
0
 private void SetWallpaper(string filename)
 {
     try {
         if (filename != string.Empty)
         {
             gClient.Set(GCONF_BACKGROUND_PATH, filename);
         }
     } catch (Exception ex) {
         Log.Error(ex.Message);
         //TODO: handle this exception
     }
 }
예제 #8
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();
        }
        public void Set <T> (string @namespace, string key, T value)
        {
            if (DisableGConf || key == null)
            {
                return;
            }

            if (client == null)
            {
                client = new GConf.Client();
            }

            client.Set(CreateKey(@namespace, key), value);
        }
예제 #10
0
파일: Config.cs 프로젝트: retahc/old-code
        void Save(string name, string keywords, string spanto, string color, string weight, string sdelim, string edelim, string signore)
        {
            gconf.Set(GCONF_PATH + name + "/keywords", keywords);
            gconf.Set(GCONF_PATH + name + "/color", color);
            gconf.Set(GCONF_PATH + name + "/weight", weight);
            gconf.Set(GCONF_PATH + name + "/sdelim", sdelim);
            gconf.Set(GCONF_PATH + name + "/edelim", edelim);

            if (signore != null)
            {
                gconf.Set(GCONF_PATH + name + "/signore", signore);
            }

            if (spanto != null)
            {
                gconf.Set(GCONF_PATH + name + "/spanto", spanto);
            }

            string style;

            try
            {
                style = (string)gconf.Get(GCONF_PATH + "styles");
            }
            catch (NoSuchKeyException e)
            {
                gconf.Set(GCONF_PATH + "styles", name);
                return;
            }

            foreach (string s in style.Split(' '))
            {
                if (String.Compare(s, name) == 0)
                {
                    return;
                }
            }

            gconf.Set(GCONF_PATH + "styles", style + " " + name);
        }
예제 #11
0
        protected Item[] TextItemPerform(ITextItem item, TasqueCategoryItem category)
        {
            string defaultCategory;

            GConf.Client conf   = new GConf.Client();
            TasqueDBus   tasque = new TasqueDBus();

            try {
                defaultCategory = conf.Get("/apps/gnome-do/plugins/tasque/default_category") as string;
            } catch (GConf.NoSuchKeyException) {
                conf.Set("/apps/gnome-do/plugins/tasque/default_category", "");
                return(null);
            }

            if (category.Name != "")
            {
                tasque.CreateTask(category.Name, item.Text);
            }
            else if (defaultCategory == String.Empty)
            {
                string[] split = item.Text.Split(':');
                if (split [0] == item.Text)
                {
                    IEnumerable <string> categories = tasque.GetCategoryNames();
                    tasque.CreateTask(categories.First(), item.Text);
                }
                else
                {
                    tasque.CreateTask(split [0], split [1]);
                }
            }
            else
            {
                string[] split = item.Text.Split(':');

                if (split [0] == item.Text)
                {
                    tasque.CreateTask(defaultCategory, item.Text);
                }
                else
                {
                    tasque.CreateTask(split [0], split [1]);
                }
            }
            return(null);
        }
        public void Set <T> (string @namespace, string key, T value)
        {
            if (DisableGConf || key == null)
            {
                return;
            }

            if (client == null)
            {
                client = new GConf.Client();
            }

            // We wrap the Set call in a try/catch to work around bgo#659835,
            // which causes Banshee to go haywire (see bgo#659841)
            try {
                client.Set(CreateKey(@namespace, key), value);
            } catch (Exception e) {
                Log.Exception(String.Format("Could not set GConf key {0}.{1}.", @namespace, key), e);
            }
        }
예제 #13
0
 public void Store(string key, object val)
 {
     client.Set(GCONF_APP_PATH + key, val);
 }
예제 #14
0
 public static void autoread(ref uint var, string key, uint def)
 {
     try{
         var = (uint)((int)conf.Get(KEY_BASE + key));
     }
     catch {
         var = def;
         conf.Set(KEY_BASE + key, (int)def);
         System.Console.WriteLine("initial setting of {0} to {1}", key, def);
     }
 }
예제 #15
0
 public void writeconfig(String name, String val)
 {
     client.Set(keyFullName_ + name, val);
 }
예제 #16
0
 private void Save()
 {
     gconf.Set(gconfPath + "width", window.Allocation.width);
     gconf.Set(gconfPath + "height", window.Allocation.height);
     gconf.SuggestSync();
 }
예제 #17
0
        protected Item[] TextItemPerform(ITextItem item, TasqueCategoryItem category)
        {
            string defaultCategory;
            GConf.Client conf = new GConf.Client ();
            TasqueDBus tasque = new TasqueDBus ();

            try {
                defaultCategory = conf.Get ("/apps/gnome-do/plugins/tasque/default_category") as string;
            } catch (GConf.NoSuchKeyException) {
                conf.Set ("/apps/gnome-do/plugins/tasque/default_category", "");
                return null;
            }

            if (category.Name != "" ) {
                tasque.CreateTask(category.Name, item.Text);
            } else if (defaultCategory == String.Empty) {

                string[] split = item.Text.Split (':');
                if (split [0] == item.Text) {
                    IEnumerable<string> categories = tasque.GetCategoryNames ();
                    tasque.CreateTask (categories.First (), item.Text);
                } else {
                    tasque.CreateTask (split [0], split [1]);
                }
            } else {

                string[] split = item.Text.Split (':');

                if (split [0] == item.Text)
                    tasque.CreateTask (defaultCategory, item.Text);
                else
                    tasque.CreateTask (split [0], split [1]);
            }
            return null;
        }
예제 #18
0
 public void Save()
 {
     gconf.Set(gconfPath + "hpaned1position", hPaned1.Position);
     gconf.Set(gconfPath + "hpaned2position", hPaned2.Position);
     gconf.Set(gconfPath + "vpaned1position", Position);
 }