コード例 #1
0
ファイル: Settings.cs プロジェクト: quequotion/glippy
        /// <summary>
        /// Constructs options class, adds basic options and reads them from GConfig.
        /// </summary>
        private Settings()
        {
            this.settings = new Dictionary<string, Setting>();

            this.settings.Add(Keys.Core.StartAtLogin, new Setting("/apps/glippy/core/start_at_login", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Core.KeyboardClipboard, new Setting("/apps/glippy/core/keyboard_clipboard", SettingTypes.Boolean, true));
            this.settings.Add(Keys.Core.MouseClipboard, new Setting("/apps/glippy/core/mouse_clipboard", SettingTypes.Boolean, true));
            this.settings.Add(Keys.Core.SynchronizeClipboards, new Setting("/apps/glippy/core/synchronize_clipboards", SettingTypes.Boolean, true));
            this.settings.Add(Keys.Core.SaveHistoryOnExit, new Setting("/apps/glippy/core/save_history_on_exit", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Core.PasteOnSelection, new Setting("/apps/glippy/core/paste_on_selection", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Core.Images, new Setting("/apps/glippy/core/images", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Core.SupportedFilesAsImages, new Setting("/apps/glippy/core/supported_files_as_images", SettingTypes.Boolean, false));

            this.settings.Add(Keys.UI.Size, new Setting("/apps/glippy/ui/size", SettingTypes.Integer, false));
            this.settings.Add(Keys.UI.LabelLength, new Setting("/apps/glippy/ui/label_length", SettingTypes.Integer, false));
            this.settings.Add(Keys.UI.ReverseOrder, new Setting("/apps/glippy/ui/reverse_order", SettingTypes.Boolean, true));
            this.settings.Add(Keys.UI.PasteIcon, new Setting("/apps/glippy/ui/paste_icon", SettingTypes.Boolean, false));
            this.settings.Add(Keys.UI.ShowAbout, new Setting("/apps/glippy/ui/show_about", SettingTypes.Boolean, true));
            this.settings.Add(Keys.UI.ShowEditClipboard, new Setting("/apps/glippy/ui/show_edit_clipboard", SettingTypes.Boolean, true));
            this.settings.Add(Keys.UI.ShowQuit, new Setting("/apps/glippy/ui/show_quit", SettingTypes.Boolean, true));

            this.settings.Add(Keys.Hotkeys.Menu, new Setting("/apps/glippy/hotkeys/menu", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Hotkeys.MenuModifiers, new Setting("/apps/glippy/hotkeys/menu_modifiers", SettingTypes.Integer, false));
            this.settings.Add(Keys.Hotkeys.MenuKey, new Setting("/apps/glippy/hotkeys/menu_key", SettingTypes.Integer, false));
            this.settings.Add(Keys.Hotkeys.CopyMouse, new Setting("/apps/glippy/hotkeys/copy_mouse", SettingTypes.Boolean, false));
            this.settings.Add(Keys.Hotkeys.CopyMouseModifiers, new Setting("/apps/glippy/hotkeys/copy_mouse_modifiers", SettingTypes.Integer, false));
            this.settings.Add(Keys.Hotkeys.CopyMouseKey, new Setting("/apps/glippy/hotkeys/copy_mouse_key", SettingTypes.Integer, false));

            this.settings.Add(Keys.Plugins.List, new Setting("/apps/glippy/plugins/list", SettingTypes.String, false));

            this.client = new Client();
            this.ReadGConfValues();
            this.client.AddNotify("/apps/glippy", this.OnGConfChanged);
        }
コード例 #2
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);
        }
コード例 #3
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            GConf.Client client = new GConf.Client();

            string exec;

            try {
                exec = client.Get("/desktop/gnome/applications/terminal/exec") as string;
            }
            catch {
                exec = "gnome-terminal";
            }

            string hostname;

            if (items.First() is ITextItem)
            {
                ITextItem textitem = items.First() as ITextItem;
                hostname = textitem.Text;
            }
            else
            {
                SSHHostItem hostitem = items.First() as SSHHostItem;
                hostname = hostitem.Host;
            }

            Process term = new Process();

            term.StartInfo.FileName  = exec;
            term.StartInfo.Arguments = "-e 'ssh " + hostname + "'";
            term.Start();
            yield break;
        }
コード例 #4
0
ファイル: Preferences.cs プロジェクト: skyronic/Screenlapse
        public static void Initialize()
        {
            // Initialize the gconf listener.
            client = new Client ();

            ReadFromGConf();
        }
コード例 #5
0
 public override void Revert()
 {
     if (revertIsAvailable){
         client = new GConf.Client();
         client.Set(GConfShowSplashKey,splashWasActive);
         client.Set(GConfSplashImageKey,prevSplash);
         revertIsAvailable=false;
     }
 }
コード例 #6
0
 override public void Revert()
 {
     if (revertIsAvailable)
     {
         client = new GConf.Client();
         client.Set(GConfShowSplashKey, splashWasActive);
         client.Set(GConfSplashImageKey, prevSplash);
         revertIsAvailable = false;
     }
 }
コード例 #7
0
        protected override void PluginInitialize()
        {
            RegisterConfigurationKey("Username");
            RegisterConfigurationKey("Password");

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

            source = new LockerSource(this);
            SourceManager.AddSource(this.source);
        }
コード例 #8
0
		void NotifyCB (IntPtr client_ptr, uint id, IntPtr entry_ptr, IntPtr user_data)
		{
			Client client = new Client (client_ptr);
			_Entry entry = new _Entry (entry_ptr);
			if (entry.ValuePtr == IntPtr.Zero) {
				notify (client, new NotifyEventArgs (entry.Key, null));
				return;
			}
			Value val = new Value (entry.ValuePtr);
			val.Managed = false;
			notify (client, new NotifyEventArgs (entry.Key, val.Get ()));
		}
コード例 #9
0
        static void CheckLockdown()
        {
            GConf.Client client = new GConf.Client();

            try {
                disable_command_line = (bool)client.Get("/desktop/gnome/lockdown/disable_command_line");
            } catch {
                // The key isn't set for some reason
                disable_command_line = false;
            }

            checked_gconf = true;
        }
コード例 #10
0
ファイル: Application.cs プロジェクト: ArsenShnurkov/beagle-1
		static void CheckLockdown ()
		{
			GConf.Client client = new GConf.Client ();

			try {
				disable_command_line = (bool) client.Get ("/desktop/gnome/lockdown/disable_command_line");
			} catch {
				// The key isn't set for some reason
				disable_command_line = false;
			}

			checked_gconf = true;
		}
コード例 #11
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();
        }
コード例 #12
0
        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);
        }
コード例 #13
0
ファイル: Main.cs プロジェクト: indrora/FoxTerm
    FoxTerm(string[] args)
    {
        program = new Program ("FoxTerm", "0.1", Modules.UI, args);
        app = new App ("FoxTerm", "Terminal");
        app.SetDefaultSize (600, 450);
        app.DeleteEvent += new DeleteEventHandler (OnAppDelete);

        GConf.Client gc_client = new GConf.Client();

        app.IconName = "terminal";

        Terminal term = new Terminal ();
        term.EncodingChanged += new EventHandler (OnEncodingChanged);
        term.CursorBlinks = true;
        term.MouseAutohide = true;
        term.ScrollOnKeystroke = true;
        term.ScrollbackLines = int.MaxValue;
        term.DeleteBinding = TerminalEraseBinding.Auto;
        term.BackspaceBinding = TerminalEraseBinding.Auto;
        term.Encoding = "UTF-8";

        term.FontFromString = (string)gc_client.Get("/desktop/gnome/interface/monospace_font_name");
        term.ChildExited += new EventHandler (OnChildExited);
        term.WindowTitleChanged += OnTitleChanged;

        ScrolledWindow scroll = new ScrolledWindow(null,term.Adjustment);
        scroll.Add(term);
        scroll.HscrollbarPolicy = PolicyType.Automatic;
        scroll.HScrollbar.Hide();

        string[] argv = Environment.GetCommandLineArgs ();
        // wants an array of "variable=value"
        string[] envv = new string[Environment.GetEnvironmentVariables ().Count];
        int i = 0;
        foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ()) {
            if ((string)(e.Key) == "" || (string)(e.Value) == "")
                continue;
            string tmp = String.Format ("{0}={1}", e.Key, e.Value);
            envv[i] = tmp;
            i++;
        }

        int pid = term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), argv, envv, Environment.CurrentDirectory, false, true, true);

        app.Contents = scroll;
        app.ShowAll ();
        program.Run ();
    }
コード例 #14
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);
        }
コード例 #15
0
		private bool GConfReady ()
		{
			lock (lock_obj) {
				if (gconf_client == null)
					gconf_client = new GConf.Client ();

				try {
					this.data = gconf_client.Get (this.path);
				} catch (Exception ex) {
					this.ex = ex;
				}

				this.finished = true;
				Monitor.Pulse (lock_obj);
			}

			return false;
		}
コード例 #16
0
    public static WebResponse GetURI(string uri)
    {
        GConf.Client client = new GConf.Client ();
        bool use_proxy = false;
        bool use_auth = false;
        string user = null;
        string password = null;
        string host = null;
        int port = 80;

        // TODO: handle proxy exceptions properly, it doesn't look like the format
        // used by GConf is the same as the format expected by the .NET exclusions
        // list. e.g. 127.0.0.1/8 needs to be translated to 127.*
        try {
            use_proxy = (bool) client.Get (KEY_PROXY_USE);

            if (use_proxy) {
                host = (string) client.Get (KEY_PROXY_HOST);
                port = (int) client.Get (KEY_PROXY_PORT);
                use_auth = (bool) client.Get (KEY_PROXY_AUTH);
                if (use_auth) {
                    user = (string) client.Get (KEY_PROXY_AUTH_USER);
                    password = (string) client.Get (KEY_PROXY_AUTH_PASSWORD);
                }
            }
        } catch (Exception e) {
            System.Console.WriteLine ("Error reading proxy preferences: {0}",
                e.Message);
        }

        HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
        if (use_proxy) {
            string proxyuri = String.Format ("http://{0}:{1}",
                host, port);
            if (! use_auth) {
                req.Proxy = new WebProxy (proxyuri, true);
            } else {
                req.Proxy = new WebProxy (proxyuri, true, new string[] {},
                    (ICredentials) new NetworkCredential (user, password));
            }
        }
        req.UserAgent = "Monopod";
        return req.GetResponse ();
    }
コード例 #17
0
        void IExtensionService.Initialize()
        {
            artwork_manager_service = ServiceManager.Get <ArtworkManager> ();

            ThreadAssist.AssertInMainThread();

            ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent,
                                                     PlayerEvent.StartOfStream |
                                                     PlayerEvent.TrackInfoUpdated);

            // capture the current wallpaper to reestablish when exiting or in albums with no art
            gClient = new GConf.Client();
            try {
                userWallpaper = (string)gClient.Get(GCONF_BACKGROUND_PATH);
            } catch (GConf.NoSuchKeyException ex) {
                Log.Error(ex.Message);
                //TODO: handle this exception (shouldn't happen though)
            }
        }
コード例 #18
0
 override protected void PreInstallation(CStatusWindow sw)
 {
     InstallThemeFile = config.SplashInstallPath + Path.GetFileName(DownloadUrl);
     //Neuer GConfClient
     client = new GConf.Client();
     //Sicherung
     sw.Mainlabel    = CConfiguration.txtSavingForRestore;
     splashWasActive = (bool)client.Get(GConfShowSplashKey);
     prevSplash      = (string)client.Get(GConfSplashImageKey);
     sw.SetProgress("1/" + installationSteps);
     sw.Mainlabel = CConfiguration.txtDownloadTheme;
     //Herunterladen
     if (!File.Exists(InstallThemeFile))
     {
         GetThemeFile(sw);
         File.Copy(LocalThemeFile, InstallThemeFile);
     }
     sw.SetProgress("2/" + installationSteps);
 }
コード例 #19
0
ファイル: ProfileItem.cs プロジェクト: jrudolph/do-plugins
        public ProfileItem(string profilePath)
        {
            Client client = new Client ();

            name = description = null;
            try {
                name = (string) client.Get (profilePath + "/visible_name");
                description = (string) client.Get (profilePath + "/custom_command");
                if (!string.IsNullOrEmpty (description))
                    description = string.Format ("{0} - {1}", description, DefaultDescription);
            } catch {
                name = description = null;
            } finally {
                if (string.IsNullOrEmpty (name))
                    name = DefaultName;
                if (string.IsNullOrEmpty (description))
                    description = DefaultDescription;
            }
        }
コード例 #20
0
        private bool GConfReady()
        {
            lock (lock_obj) {
                if (gconf_client == null)
                {
                    gconf_client = new GConf.Client();
                }

                try {
                    this.data = gconf_client.Get(this.path);
                } catch (Exception ex) {
                    this.ex = ex;
                }

                this.finished = true;
                Monitor.Pulse(lock_obj);
            }

            return(false);
        }
        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);
            }
        }
コード例 #22
0
 public MainWindow() : base(Gtk.WindowType.Toplevel)
 {
     Build();
     ports                = new SerPort[0];
     taggers              = new Tagger[0];
     prng                 = new Random();
     configTreeStore      = new TreeStore(typeof(string));
     configTreeView.Model = configTreeStore;
     configTreeColumn     = new TreeViewColumn("Object", new CellRendererText(), "text", 0);
     configTreeView.AppendColumn(configTreeColumn);
     treeIters = new TreeIter[objNames.Length];
     gcclient  = new GConf.Client();
     for (int i = 0; i < objNames.Length; ++i)
     {
         treeIters[i] = configTreeStore.AppendValues(objNames[i]);
     }
     try{
         string[] sa;
         sa = (string[])(gcclient.Get(AppBase + "/objects"));
         foreach (string s in sa)
         {
             System.Console.WriteLine("found object: " + s);
             if (s.StartsWith("serialport-"))
             {
                 try{
                     AddSerialPort(s, false);
                 }catch {
                 }
             }
             if (s.StartsWith("tagger-"))
             {
                 try{
                     AddTagger(s, false);
                 }catch {
                 }
             }
         }
     }catch {
         System.Console.WriteLine("Ooops, no objects found");
     }
 }
コード例 #23
0
 public GnomeHttpProxy( string domainUrl )
 {
     client = new GConf.Client();
        this.domainUrl = domainUrl.ToLower();
        try
        {
     string[] bypassHosts = (string[]) client.Get( GCONF_IGNORE_HOSTS );
     foreach( string host in bypassHosts )
     {
      string normalizedHost = host.Replace( '/', ':' ).ToLower();
      if ( normalizedHost == this.domainUrl )
      {
       this.bypass = true;
       break;
      }
     }
        }
        catch( Exception)
        {
        }
 }
コード例 #24
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 ();
        }
コード例 #25
0
        public T Get <T> (string @namespace, string key, T fallback)
        {
            if (DisableGConf || key == null)
            {
                return(fallback);
            }

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

            try {
                return((T)client.Get(CreateKey(@namespace, key)));
            } catch (GConf.NoSuchKeyException) {
                return(fallback);
            } catch (Exception e) {
                Log.Exception(String.Format("Could no read GConf key {0}.{1}", @namespace, key), e);
                return(fallback);
            }
        }
コード例 #26
0
ファイル: GnomeHttpProxy.cs プロジェクト: lulzzz/ifolder
        /// <summary>
        /// Constructor - constains the target url
        /// which is checked against the bypass list
        /// If the target url exists in the bypass list
        /// proxy settings are ignored.
        /// </summary>
        public GnomeHttpProxy(string domainUrl)
        {
            client         = new GConf.Client();
            this.domainUrl = domainUrl.ToLower();

            try
            {
                string[] bypassHosts = (string[])client.Get(GCONF_IGNORE_HOSTS);
                foreach (string host in bypassHosts)
                {
                    string normalizedHost = host.Replace('/', ':').ToLower();
                    if (normalizedHost == this.domainUrl)
                    {
                        this.bypass = true;
                        break;
                    }
                }
            }
            catch (Exception)
            {
                //Debug.PrintLine( e.Message );
            }
        }
コード例 #27
0
        public bool TryGet <T> (string @namespace, string key, out T result)
        {
            if (DisableGConf || key == null)
            {
                result = default(T);
                return(false);
            }

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

            try {
                result = (T)client.Get(CreateKey(@namespace, key));
                return(true);
            } catch (GConf.NoSuchKeyException) {
            } catch (Exception e) {
                Log.Exception(String.Format("Could no read GConf key {0}.{1}", @namespace, key), e);
            }

            result = default(T);
            return(false);
        }
コード例 #28
0
ファイル: Config.cs プロジェクト: TweetyHH/Open-Cache-Manager
 public Config()
 {
     m_client = new Client();
 }
コード例 #29
0
ファイル: GConfHelper.cs プロジェクト: pacificIT/mono-upnp
 static GConfHelper ()
 {
     Client = new GConf.Client ();
 }
コード例 #30
0
 /// <summary>
 ///   Construct new GConf storage object using the specified desklet name and instance number.
 /// </summary>
 /// <param name="deskletName">The desklet name</param>
 /// <param name="deskletInstance">The desklet instance number</param>
 /// <remarks>
 ///   If your desklet can exist in several instances, and each of them might have a
 ///   different configuration, you should use different instance number for each copy
 ///   of the desklet, thus separating their configuration storage.
 ///
 ///   You should make sure your desklet name is unique. It might be a good idea to
 ///   use the common desklet name concatenated with a GUID (or UUID) value.
 /// </remarks>
 public GConfConfigStorage(string deskletName, int deskletInstance)
     : base(deskletName, deskletInstance)
 {
     client = new GConf.Client();
 }
コード例 #31
0
 public GconfSettingsStorage()
 {
     client = new GConf.Client();
 }
コード例 #32
0
ファイル: TasqueAction.cs プロジェクト: jrudolph/do-plugins
        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;
        }
コード例 #33
0
			public DirectoryConnections (Client client, string dir)
			{
				handle = client.Raw;
				path = dir;
			}
コード例 #34
0
ファイル: config.cs プロジェクト: dfr0/moon
		/// <summary>
		///   Construct new GConf storage object using the specified desklet name and instance number.
		/// </summary>
		/// <param name="deskletName">The desklet name</param>
		/// <param name="deskletInstance">The desklet instance number</param>
		/// <remarks>
		///   If your desklet can exist in several instances, and each of them might have a
		///   different configuration, you should use different instance number for each copy
		///   of the desklet, thus separating their configuration storage.
		///
		///   You should make sure your desklet name is unique. It might be a good idea to
		///   use the common desklet name concatenated with a GUID (or UUID) value.
		/// </remarks>
		public GConfConfigStorage (string deskletName, int deskletInstance)
			: base (deskletName, deskletInstance)
		{
			client = new GConf.Client ();
		}
コード例 #35
0
    private PersistentInformation()
    {
        Utils.EnsureDirectoryExists(HOME);
          Utils.EnsureDirectoryExists(THUMBNAIL_DIR);
          Utils.EnsureDirectoryExists(SMALL_IMAGE_DIR);
          // Shard the photos, so they're stored in 37 directories, instead of one.
          for (int i = 0; i < NUM_SHARDS; ++i) {
        string s = String.Format("{0:00}", i);
        Utils.EnsureDirectoryExists(System.IO.Path.Combine(THUMBNAIL_DIR, s));
        Utils.EnsureDirectoryExists(System.IO.Path.Combine(SMALL_IMAGE_DIR, s));
          }

          // Attempt creation of tables. If the table exists, the command
          // execution will throw an exception. Dirty way, but had to be done.
          // The cleaner alternative through sql command using "if not exists"
          // is only available in the latest versions of sqlite; which is
          // currently not ported over to mono.
          if (CreateTable(CREATE_PHOTO_TABLE)) {
        AddIndex("create index iphoto1 on photo(id);");
        AddIndex("create index iphoto2 on photo(isdirty);");
        AddIndex("create index iphoto3 on photo(isdeleted);");
          }
          if (CreateTable(CREATE_ORIGINAL_PHOTO_TABLE)) {
        AddIndex("create index ioriginalphoto1 on originalphoto(id);");
          }
          if (CreateTable(CREATE_COMMENT_TABLE)) {
        AddIndex("create index icomment1 on comment(photoid);");
        AddIndex("create index icomment2 on comment(commentid);");
          }
          if (CreateTable(CREATE_ALBUM_TABLE)) {
        AddIndex("create index ialbum1 on album(setid);");
        AddIndex("create index ialbum2 on album(photoid);");
        AddIndex("create index ialbum3 on album(isdirty);");
          }
          if (CreateTable(CREATE_ALBUM_PHOTO_MAPPING_TABLE)) {
        AddIndex("create index isetphoto1 on setphoto(setid);");
        AddIndex("create index isetphoto2 on setphoto(photoid);");
          }
          if (CreateTable(CREATE_PHOTO_TAG_TABLE)) {
        AddIndex("create index itag1 on tag(photoid);");
        AddIndex("create index itag2 on tag(tag);");
          }
          if (CreateTable(CREATE_POOL_TABLE)) {
        AddIndex("create index ipool1 on pool(groupid);");
          }
          if (CreateTable(CREATE_POOL_PHOTO_TABLE)) {
        AddIndex("create index ipoolphoto1 on poolphoto(groupid);");
        AddIndex("create index ipoolphoto2 on poolphoto(photoid);");
          }
          if (CreateTable(CREATE_BLOG_TABLE)) {
        AddIndex("create index iblog1 on blog(blogid);");
          }
          if (CreateTable(CREATE_BLOG_PHOTO_TABLE)) {
        AddIndex("create index iblogphoto1 on blogphoto(blogid);");
        AddIndex("create index iblogphoto2 on blogphoto(photoid);");
          }
          CreateTable(CREATE_DOWNLOAD_TABLE);
          CreateTable(CREATE_UPLOAD_TABLE);

          client = new GConf.Client();
          _photolock = new object();
          _commentlock = new object();
          _albumlock = new object();
          _setphotolock = new object();
          _taglock = new object();
          _poollock = new object();
          _poolphotolock = new object();
          _bloglock = new object();
          _blogphotolock = new object();
          _downloadlock = new object();
          _uploadlock = new object();
          _writelock = new object();

          _thumbnailbuffer = new System.Collections.Generic.Dictionary<string, Gdk.Pixbuf>();
          _smallimagebuffer = new System.Collections.Generic.Dictionary<string, Gdk.Pixbuf>();
    }
コード例 #36
0
 private GconfSettingsStorage()
 {
     client = new GConf.Client();
 }
コード例 #37
0
		public GconfSettingsStorage()
		{
			client = new GConf.Client();
		}
コード例 #38
0
ファイル: Conf.cs プロジェクト: MonoBrasil/historico
 private static void EnsureClient()
 {
     if (GConfClient == null) {
         GConfClient = new GConf.Client();
     }
 }
コード例 #39
0
        void IExtensionService.Initialize()
        {
            artwork_manager_service = ServiceManager.Get<ArtworkManager> ();

            Banshee.Base.ThreadAssist.AssertInMainThread ();

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
               PlayerEvent.StartOfStream |
               PlayerEvent.TrackInfoUpdated);

            // capture the current wallpaper to reestablish when exiting or in albums with no art
            gClient = new GConf.Client();
            try {
                userWallpaper = (string) gClient.Get(GCONF_BACKGROUND_PATH);
            } catch (GConf.NoSuchKeyException ex) {
                Hyena.Log.Error(ex.Message);
                //TODO: handle this exception (shouldn't happen though)
            }
        }
コード例 #40
0
        override protected void PreInstallation(CStatusWindow sw)
        {
            InstallThemeFile = config.SplashInstallPath + Path.GetFileName(Image.URL);
            //Set the localPreviewFile to the downloaded file to fasten the preview
            localPreviewFile = LocalThemeFile;

            Console.WriteLine(LocalPreviewFile);

            sw.Mainlabel = CConfiguration.txtSavingForRestore;
            //Sichern
            client         = new GConf.Client();
            prevBackground = (string)client.Get(GConfBgKey);
            prevStyle      = (string)client.Get(GConfISKey);
            sw.SetProgress("1/" + installationSteps);

            //Index und Type wurden vorher schon gwählt
            sw.Mainlabel = CConfiguration.txtDownloadTheme;

            if (!File.Exists(LocalThemeFile))
            {
                if (!File.Exists(LocalPreviewFile))
                {
                    GetThemeFile(sw);
                }
                else
                {
                    File.Copy(LocalPreviewFile, LocalThemeFile);
                    Console.Out.WriteLine(LocalPreviewFile + " --- " + LocalThemeFile);
                }
            }
            try{ File.Copy(LocalThemeFile, InstallThemeFile); } catch {}

            ///home/.../.gnome2/backgrounds.xml einlesen und Background anhängen...
            //Just a hack...TODO:paste in XMLDoc
            if (!File.Exists(config.HomePath + ".gnome2/backgrounds.xml"))
            {
                StreamWriter locFile = new StreamWriter(config.HomePath + ".gnome2/backgrounds.xml");
                locFile.WriteLine("<?xml version=\"1.0\"?>");
                locFile.WriteLine("<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\"[]>");
                locFile.WriteLine("  <wallpapers>");
                locFile.WriteLine("  </wallpapers>");
                locFile.Close();
            }

            XmlDocument doc = new XmlDocument();

            doc.Load(config.HomePath + ".gnome2/backgrounds.xml");

            //Nach schon vorhandenem Eintrag in Backgrounds suchen
            XmlNode foundNode = doc.SelectSingleNode("wallpapers/wallpaper[filename='" + InstallThemeFile + "']");

            if (foundNode != null)
            {
                XmlNodeList list = foundNode.ChildNodes;
                //Console.WriteLine("Count:"+list.Count);
                foreach (XmlNode node in list)
                {
                    if (node.Name == "options")
                    {
                        Console.WriteLine(node.InnerText);
                        node.InnerText = currentStyleString;
                        break;
                    }
                }
            }
            else
            {
                XmlNode newElem;
                XmlNode wallpaper = doc.CreateNode(XmlNodeType.Element, "wallpaper", "");
                ((XmlElement)wallpaper).SetAttribute("deleted", "false");

                newElem           = doc.CreateNode(XmlNodeType.Element, "name", "");
                newElem.InnerText = Path.GetFileName(InstallThemeFile);
                wallpaper.AppendChild(newElem);
                newElem           = doc.CreateNode(XmlNodeType.Element, "filename", "");
                newElem.InnerText = InstallThemeFile;
                wallpaper.AppendChild(newElem);
                newElem           = doc.CreateNode(XmlNodeType.Element, "options", "");
                newElem.InnerText = currentStyleString;
                wallpaper.AppendChild(newElem);
                newElem           = doc.CreateNode(XmlNodeType.Element, "shade_type", "");
                newElem.InnerText = "solid";
                wallpaper.AppendChild(newElem);
                newElem           = doc.CreateNode(XmlNodeType.Element, "pcolor", "");
                newElem.InnerText = "#dadab0b08282";
                wallpaper.AppendChild(newElem);
                newElem           = doc.CreateNode(XmlNodeType.Element, "scolor", "");
                newElem.InnerText = "#dadab0b08282";
                wallpaper.AppendChild(newElem);
                doc.DocumentElement.AppendChild(wallpaper);
            }
            doc.Save(config.HomePath + ".gnome2/backgrounds.xml");
            sw.SetProgress("2/" + installationSteps);
        }
コード例 #41
0
        protected override void PreInstallation(CStatusWindow sw)
        {
            InstallThemeFile = config.SplashInstallPath+Path.GetFileName(Image.URL);
            //Set the localPreviewFile to the downloaded file to fasten the preview
            localPreviewFile = LocalThemeFile;

            Console.WriteLine(LocalPreviewFile);

            sw.Mainlabel=CConfiguration.txtSavingForRestore;
            //Sichern
            client = new GConf.Client();
            prevBackground=(string)client.Get(GConfBgKey);
            prevStyle = (string)client.Get(GConfISKey);
            sw.SetProgress("1/"+installationSteps);

            //Index und Type wurden vorher schon gwählt
            sw.Mainlabel=CConfiguration.txtDownloadTheme;

            if (!File.Exists(LocalThemeFile)) {
                if (!File.Exists(LocalPreviewFile)) {
                    GetThemeFile(sw);
                } else {
                    File.Copy(LocalPreviewFile,LocalThemeFile);
                    Console.Out.WriteLine(LocalPreviewFile + " --- " + LocalThemeFile);
                }
            }
            try{File.Copy(LocalThemeFile,InstallThemeFile);} catch{}

            ///home/.../.gnome2/backgrounds.xml einlesen und Background anhängen...
            //Just a hack...TODO:paste in XMLDoc
            if (!File.Exists(config.HomePath+".gnome2/backgrounds.xml")){
                StreamWriter locFile = new StreamWriter(config.HomePath+".gnome2/backgrounds.xml");
                locFile.WriteLine("<?xml version=\"1.0\"?>");
                locFile.WriteLine("<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\"[]>");
                locFile.WriteLine("  <wallpapers>");
                locFile.WriteLine("  </wallpapers>");
                locFile.Close();
            }

            XmlDocument doc = new XmlDocument();
            doc.Load(config.HomePath+".gnome2/backgrounds.xml");

            //Nach schon vorhandenem Eintrag in Backgrounds suchen
            XmlNode foundNode = doc.SelectSingleNode("wallpapers/wallpaper[filename='"+InstallThemeFile+"']");
            if (foundNode != null){
                XmlNodeList list = foundNode.ChildNodes;
                //Console.WriteLine("Count:"+list.Count);
                foreach (XmlNode node in list){
                    if (node.Name=="options"){
                        Console.WriteLine(node.InnerText);
                        node.InnerText=currentStyleString;
                        break;
                    }
                }

            }
            else {
                XmlNode newElem;
                XmlNode wallpaper = doc.CreateNode(XmlNodeType.Element,"wallpaper","");
                ((XmlElement)wallpaper).SetAttribute("deleted","false");

                newElem = doc.CreateNode(XmlNodeType.Element, "name", "");
                newElem.InnerText = Path.GetFileName(InstallThemeFile);
                wallpaper.AppendChild(newElem);
                newElem = doc.CreateNode(XmlNodeType.Element, "filename", "");
                newElem.InnerText = InstallThemeFile;
                wallpaper.AppendChild(newElem);
                newElem = doc.CreateNode(XmlNodeType.Element, "options", "");
                newElem.InnerText = currentStyleString;
                wallpaper.AppendChild(newElem);
                newElem = doc.CreateNode(XmlNodeType.Element, "shade_type", "");
                newElem.InnerText = "solid";
                wallpaper.AppendChild(newElem);
                newElem = doc.CreateNode(XmlNodeType.Element, "pcolor", "");
                newElem.InnerText = "#dadab0b08282";
                wallpaper.AppendChild(newElem);
                newElem = doc.CreateNode(XmlNodeType.Element, "scolor", "");
                newElem.InnerText = "#dadab0b08282";
                wallpaper.AppendChild(newElem);
                doc.DocumentElement.AppendChild(wallpaper);
            }
            doc.Save(config.HomePath+".gnome2/backgrounds.xml");
            sw.SetProgress("2/"+installationSteps);
        }
コード例 #42
0
ファイル: GConfHelper.cs プロジェクト: kobeyoung81/JBServer
 static GConfHelper()
 {
     Client = new GConf.Client();
 }
コード例 #43
0
        protected override void PluginInitialize()
        {
            RegisterConfigurationKey("Username");
            RegisterConfigurationKey("Password");

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

            source = new LockerSource(this);
            SourceManager.AddSource(this.source);
        }
コード例 #44
0
 protected override void PreInstallation(CStatusWindow sw)
 {
     InstallThemeFile=config.SplashInstallPath+Path.GetFileName(DownloadUrl);
     //Neuer GConfClient
     client = new GConf.Client();
     //Sicherung
     sw.Mainlabel=CConfiguration.txtSavingForRestore;
     splashWasActive = (bool)client.Get(GConfShowSplashKey);
     prevSplash = (string)client.Get(GConfSplashImageKey);
     sw.SetProgress("1/"+installationSteps);
     sw.Mainlabel=CConfiguration.txtDownloadTheme;
     //Herunterladen
     if (!File.Exists(InstallThemeFile)){
         GetThemeFile(sw);
         File.Copy(LocalThemeFile,InstallThemeFile);
     }
     sw.SetProgress("2/"+installationSteps);
 }
コード例 #45
0
 private GconfSettingsStorage()
 {
     client = new GConf.Client();
 }