static Metacity.Theme GetTheme() { if (theme == null) { try { GConf.Client client = new GConf.Client(); // client.AddNotify ("/apps/metacity/general", GConfNotify); string themeName = (string)client.Get("/apps/metacity/general/theme"); theme = Metacity.Theme.Load(themeName); } catch { // Don't crash if metacity is not available return(null); } } return(theme); }
static Theme GetTheme () { if (theme == null) { try { Assembly assm = Assembly.LoadWithPartialName ("gconf-sharp"); Type client_type = assm.GetType ("GConf.Client"); MethodInfo method = client_type.GetMethod ("Get", BindingFlags.Instance | BindingFlags.Public); object client = Activator.CreateInstance (client_type, new object[] { }); string themeName = (string)method.Invoke (client, new object[] { "/apps/metacity/general/theme" }); theme = Metacity.Theme.Load (themeName); } catch { // Set theme error flag - in case of a theme error a solid background needs to be drawn. ThemeError = true; // Don't crash if metacity is not available return null; } } return theme; }
static Metacity.Theme GetTheme() { if (theme == null) { try { GConf.Client client = new GConf.Client (); // client.AddNotify ("/apps/metacity/general", GConfNotify); string themeName = (string)client.Get ("/apps/metacity/general/theme"); theme = Metacity.Theme.Load (themeName); } catch { // Don't crash if metacity is not available return null; } } return theme; }