#!/usr/bin/env python

import os
import os.path

import sys

try:
	import psyco
	psyco.full()
except:
	pass

try:
 	import pygtk
  	pygtk.require("2.0")
except:
  	pass
try:
	import gtk
  	import gtk.glade
except:
	sys.exit(1)


import locale
import gettext

import gconf

IMGPATH = "/usr/share/gnomeprefs-ng/glade-xml/"

GCONF_CLIENT = gconf.client_get_default()

_ = gettext.gettext
APP_NAME = "gnomeprefs-ng"

class GP4:

	def __init__(self):

	        langs = []
		lc, encoding = locale.getdefaultlocale()
		if (lc):
			langs = [lc]
		language = os.environ.get('LANGUAGE', None)
		if (language):
			langs += language.split(":")
		langs += ["de_DE"]

		gettext.bindtextdomain(APP_NAME)
		gettext.textdomain(APP_NAME)
		self.lang = gettext.translation(APP_NAME, languages=langs, fallback = True)
		global _
		_ = self.lang.gettext
		gtk.glade.bindtextdomain(APP_NAME)
		gtk.glade.textdomain(APP_NAME)

		self.gladefile = "/usr/share/gnomeprefs-ng/glade-xml/gnomeprefs4.glade"
	        self.wTree = gtk.glade.XML(self.gladefile)

	        dic = { "on_checkbutton1_toggled" : self.cb1a,
	        	"on_filechooserbutton1_file_set" : self.fcb1a,
	        	"on_checkbutton2_toggled" : self.cb2a,
	        	"on_checkbutton3_toggled" : self.cb3a,
	        	"on_checkbutton4_toggled" : self.cb4a,
	        	"on_checkbutton5_toggled" : self.cb5a,
	        	"on_checkbutton6_toggled" : self.cb6a,
	        	"on_checkbutton7_toggled" : self.cb7a,
	        	"on_combobox2_changed" : self.cmb2a,
	        	"on_checkbutton8_toggled" : self.cb8a,
	        	"on_checkbutton9_toggled" : self.cb9a,
	        	"on_combobox3_changed" : self.cmb3a,
	        	"on_combobox4_changed" : self.cmb4a,
	        	"on_checkbutton10_toggled" : self.cb10a,
	        	"on_checkbutton11_toggled" : self.cb11a,
	        	"on_checkbutton12_toggled" : self.cb12a,
	        	"on_checkbutton13_toggled" : self.cb13a,
	        	"on_checkbutton15_toggled" : self.cb15a,
	        	"on_checkbutton16_toggled" : self.cb16a,
	        	"on_combobox5_changed" : self.cmb5a,
	        	"on_combobox6_changed" : self.cmb6a,
	        	"on_combobox7_changed" : self.cmb7a,
	        	"on_checkbutton17_toggled" : self.cb17a,
	        	"on_checkbutton18_toggled" : self.cb18a,
	        	"on_checkbutton19_toggled" : self.cb19a,
	        	"on_checkbutton20_toggled" : self.cb20a,
	        	"on_checkbutton21_toggled" : self.cb21a,
	        	"on_entry1_changed" : self.e1a,
	        	"on_entry2_changed" : self.e2a,
	        	"on_entry3_changed" : self.e3a,
	        	"on_entry4_changed" : self.e4a,
	        	"on_checkbutton22_toggled" : self.cb22a,
	        	"on_checkbutton23_toggled" : self.cb23a,
	        	"on_checkbutton24_toggled" : self.cb24a,
	        	"on_entry5_changed" : self.e5a,
	        	"on_entry6_changed" : self.e6a,
	        	"on_checkbutton26_toggled" : self.cb26a,
	        	"on_checkbutton27_toggled" : self.cb27a,
	        	"on_spinbutton1_change_value" : self.spb1a,
	        	"on_combobox8_changed" : self.cmb8a,
	        	"on_checkbutton29_toggled" : self.cb29a,
	        	"on_combobox9_changed" : self.cmb9a,
	        	"on_entry7_changed" : self.e7a,
	        	"on_checkbutton30_toggled" : self.cb30a,
	        	"on_checkbutton31_toggled" : self.cb31a,
	        	"on_checkbutton32_toggled" : self.cb32a,
	        	"on_entry8_changed" : self.e8a,
	        	"on_checkbutton14_toggled" : self.cb14a,
	        	"on_button1_clicked" : self.b1a,
	        	"on_checkbutton25_toggled" : self.cb25a,
	        	"on_treeview1_cursor_changed" : self.tv1a,
	        	"on_combobox1_changed" : self.cmb1a,
	        	"on_checkbutton28_toggled" : self.cb28a,
	        	"on_entry9_changed" : self.e9a,
	        	"on_combobox10_changed" : self.cmb10a,
	        	"on_checkbutton33_toggled" : self.cb33a,
	        	"on_checkbutton34_toggled" : self.cb34a,
	        	"on_checkbutton35_toggled" : self.cb35a,
	        	"on_checkbutton36_toggled" : self.cb36a,
	        	"on_MainWindow_destroy" : gtk.main_quit }
		self.wTree.signal_autoconnect(dic)

		# The TreeView

		self.liststore = gtk.ListStore(gtk.gdk.Pixbuf,str)
		self.treeview = self.wTree.get_widget("treeview1")
		self.treeview.set_model(self.liststore)

		self.imagecell = gtk.CellRendererPixbuf()
		self.imagecolumn = gtk.TreeViewColumn("")
		self.imagecolumn.pack_start(self.imagecell, True)
		self.imagecolumn.add_attribute(self.imagecell, "pixbuf",0)

		self.treeview.append_column(self.imagecolumn)
		self.textcell = gtk.CellRendererText()
		self.textcolumn = gtk.TreeViewColumn("")
   		self.textcolumn.pack_start(self.textcell, True)
   		self.textcolumn.add_attribute(self.textcell, "text", 1)
   		self.textcolumn.set_attributes(self.textcell, markup=1)
		self.treeview.append_column(self.textcolumn)

		self.imagesession=gtk.gdk.pixbuf_new_from_file( IMGPATH + "session.png")
		self.liststore.append([self.imagesession, "<b>Session</b>"])

		self.imagepanel=gtk.gdk.pixbuf_new_from_file( IMGPATH + "panel.png")
		self.liststore.append([self.imagepanel, "<b>Panel</b>"])

		self.imagegksu=gtk.gdk.pixbuf_new_from_file( IMGPATH + "gksu.png")
		self.liststore.append([self.imagegksu, "<b>GkSu</b>"])

		self.imagefr=gtk.gdk.pixbuf_new_from_file( IMGPATH + "fileroller.png")
		self.liststore.append([self.imagefr, "<b>FileRoller</b>"])

		self.imageterm=gtk.gdk.pixbuf_new_from_file( IMGPATH + "terminal.png")
		self.liststore.append([self.imageterm, "<b>Terminal</b>"])

		self.imagemcity=gtk.gdk.pixbuf_new_from_file( IMGPATH + "mcity.png")
		self.liststore.append([self.imagemcity, "<b>Metacity</b>"])

		self.imagenauti=gtk.gdk.pixbuf_new_from_file( IMGPATH + "nautilus.png")
		self.liststore.append([self.imagenauti, "<b>Nautilus</b>"])

		self.imagebb=gtk.gdk.pixbuf_new_from_file( IMGPATH + "bugbuddy.png")
		self.liststore.append([self.imagebb, "<b>Bug-Buddy</b>"])

		self.imagencd=gtk.gdk.pixbuf_new_from_file( IMGPATH + "ncd.png")
		self.liststore.append([self.imagencd, "<b>CD Burner</b>"])

		self.imagemisc=gtk.gdk.pixbuf_new_from_file( IMGPATH + "misc.png")
		self.liststore.append([self.imagemisc, "<b>Misc.</b>"])

		# The Notebook (Invisible to User)

		self.notebook1 = self.wTree.get_widget("notebook1")
		self.notebook1.set_show_tabs(0)

		# Gnome Session Properties

		self.checkbutton1 = self.wTree.get_widget("checkbutton1")
		self.use_splash = GCONF_CLIENT.get_bool("/apps/gnome-session/options/show_splash_screen")
		if self.use_splash == True:
			self.checkbutton1.set_active(1)
		else:
			self.checkbutton1.set_label(_("Session Splash Screen Disabled"))

		self.checkbutton14 = self.wTree.get_widget("checkbutton14")
		self.lgprompt = GCONF_CLIENT.get_bool("/apps/gnome-session/options/logout_prompt")
		if self.lgprompt == True:
			self.checkbutton14.set_active(1)
		elif self.lgprompt == False:
			self.checkbutton14.set_label(_("Logout Prompt Disabled"))

		self.filechooserbutton1 = self.wTree.get_widget("filechooserbutton1")

		self.combobox10 = self.wTree.get_widget("combobox10")
		self.combobox10.set_active(0)

		self.checkbutton33 = self.wTree.get_widget("checkbutton33")
		self.allow_tcp = GCONF_CLIENT.get_bool("/apps/gnome-session/options/allow_tcp_connections")
		if self.allow_tcp == True:
			self.checkbutton33.set_active()
		else:
			self.checkbutton33.set_label(_("Disallowing TCP Connections"))

		# Gnome Panel Properties

		self.checkbutton2 = self.wTree.get_widget("checkbutton2")
		self.show_applist = GCONF_CLIENT.get_bool("/apps/panel/general/enable_program_list")
		if self.show_applist == True:
			self.checkbutton2.set_active(1)
		else:
			self.checkbutton2.set_label(_("Application List is Disabled"))

		self.checkbutton3 = self.wTree.get_widget("checkbutton3")
		self.use_acomp = GCONF_CLIENT.get_bool("/apps/panel/general/enable_autocompletion")
		if self.use_acomp == True:
			self.checkbutton3.set_active(1)
		else:
			self.checkbutton3.set_label(_("Rundialog Autocompletion Disabled"))

		self.checkbutton4 = self.wTree.get_widget("checkbutton4")
		self.show_tooltip = GCONF_CLIENT.get_bool("/apps/panel/global/tooltips_enabled")
		if self.show_tooltip == True:
			self.checkbutton4.set_active(1)
		else:
			self.checkbutton4.set_label(_("Tooltips are Disabled"))

		self.checkbutton25 = self.wTree.get_widget("checkbutton25")
		if os.path.isdir(os.path.expanduser("~/.recently-used.xbel")):
			self.checkbutton25.set_active(1)
		else:
			self.checkbutton25.set_label(_("Recently-Used Menu Enabled"))

		self.checkbutton34 = self.wTree.get_widget("checkbutton34")
		self.session_dtype = GCONF_CLIENT.get_bool("/apps/panel/global/upstream_session")
		if self.session_dtype == True:
			self.checkbutton34.set_active(1)
		else:
			self.checkbutton34.set_label(_("Using GnomeSession's Session-Dialog"))

		self.checkbutton35 = self.wTree.get_widget("checkbutton35")
		self.highlight_effect = GCONF_CLIENT.get_bool("/apps/panel/global/highlight_launchers_on_mouseover")
		if self.highlight_effect == True:
			self.checkbutton35.set_active(1)
		else:
			self.checkbutton35.set_label(_("Launcher effect disabled"))

		self.checkbutton36 = self.wTree.get_widget("checkbutton36")
		self.animation = GCONF_CLIENT.get_bool("/apps/panel/global/enable_animations")
		if self.animation == True:
			self.checkbutton36.set_active(1)
		else:
			self.checkbutton36.set_label(_("Animations disabled"))

		# GkSu Settings

		self.checkbutton5 = self.wTree.get_widget("checkbutton5")
		self.use_keyring = GCONF_CLIENT.get_bool("/apps/gksu/save-to-keyring")
		if self.use_keyring == True:
			self.checkbutton5.set_active(1)
		else:
			self.checkbutton5.set_label(_("Password won't be saved in the Keyring"))

		self.checkbutton6 = self.wTree.get_widget("checkbutton6")
		self.session_only = GCONF_CLIENT.get_string("/apps/gksu/save-keyring")
		if self.session_only == "session":
			self.checkbutton6.set_active(1)
		else:
			self.checkbutton6.set_label(_("Saving for: System-pre-defined time"))

		self.checkbutton7 = self.wTree.get_widget("checkbutton7")
		self.sudo_mode = GCONF_CLIENT.get_bool("/apps/gksu/sudo-mode")
		if self.sudo_mode == True:
			self.checkbutton7.set_active(1)
		else:
			self.checkbutton7.set_label(_("Using Su for Authentification"))

		# FileRoller Settings

		self.combobox2 = self.wTree.get_widget("combobox2")
		self.combobox2.set_active(0)

		self.checkbutton8 = self.wTree.get_widget("checkbutton8")
		self.skip_newer = GCONF_CLIENT.get_bool("/apps/file-roller/dialogs/extract/skip_newer")
		if self.skip_newer == True:
			self.checkbutton8.set_active(1)
		else:
			self.checkbutton8.set_label(_("Don't skip newer files"))

		self.checkbutton9 = self.wTree.get_widget("checkbutton9")
		self.view_dest = GCONF_CLIENT.get_bool("/apps/file-roller/dialogs/extract/view_destination_folder")
		if self.view_dest == True:
			self.checkbutton9.set_active(1)
		else:
			self.checkbutton9.set_label(_("Don't open Destination after unpacking"))

		# GnomeTerminal Settings

		self.checkbutton10 = self.wTree.get_widget("checkbutton10")
		self.confirm = GCONF_CLIENT.get_bool("/apps/gnome-terminal/global/confirm_window_close")
		if self.confirm == True:
			self.checkbutton10.set_active(1)
		else:
			self.checkbutton10.set_label(_("Closing without Confirmation"))

		self.checkbutton11 = self.wTree.get_widget("checkbutton11")
		self.bind_f10 = GCONF_CLIENT.get_bool("/apps/gnome-terminal/global/use_menu_accelerators")
		if self.bind_f10 == True:
			self.checkbutton11.set_active(1)
		else:
			self.checkbutton11.set_label(_("F10 unbound from Terminal"))

		self.checkbutton12 = self.wTree.get_widget("checkbutton12")
		self.bind_alt_letter = GCONF_CLIENT.get_bool("/apps/gnome-terminal/global/use_mnemonics")
		if self.bind_alt_letter == True:
			self.checkbutton12.set_active(1)
		else:
			self.checkbutton12.set_label(_("Alt+Letter unbound from Terminal"))

		self.checkbutton29 = self.wTree.get_widget("checkbutton29")
		self.theme_col = GCONF_CLIENT.get_bool("/apps/gnome-terminal/profiles/Default/use_theme_colors")
		if self.theme_col == True:
			self.checkbutton29.set_active(1)
		else:
			self.checkbutton29.set_label(_("Not using Theme Colors"))

		# Metacity Settings

		self.combobox3 = self.wTree.get_widget("combobox3")
		self.combobox3.set_active(0)

		self.combobox4 = self.wTree.get_widget("combobox4")
		self.combobox4.set_active(0)

		self.checkbutton13 = self.wTree.get_widget("checkbutton13")
		self.focus_new = GCONF_CLIENT.get_string("/apps/metacity/general/focus_new_windows")
		if self.focus_new == "smart":
			self.checkbutton13.set_active(1)
		else:
			self.checkbutton13.set_label(_("Will focus new Windows Strict"))

		self.checkbutton15 = self.wTree.get_widget("checkbutton15")
		self.resource = GCONF_CLIENT.get_bool("/apps/metacity/general/reduced_resources")
		if self.resource == True:
			self.checkbutton15.set_active(1)
		else:
			self.checkbutton15.set_label(_("Display full Content on Move"))

		self.checkbutton16 = self.wTree.get_widget("checkbutton16")
		self.workaround = GCONF_CLIENT.get_bool("/apps/metacity/general/disable_workarounds")
		if self.workaround == True:
			self.checkbutton16.set_active(1)
		else:
			self.checkbutton16.set_label(_("Enabling Workarounds"))

		self.combobox5 = self.wTree.get_widget("combobox5")
		self.combobox5.set_active(0)

		self.combobox6 = self.wTree.get_widget("combobox6")
		self.combobox6.set_active(0)

		self.combobox7 = self.wTree.get_widget("combobox7")
		self.combobox7.set_active(0)

		self.checkbutton32 = self.wTree.get_widget("checkbutton32")
		self.enab_compo = GCONF_CLIENT.get_bool("/apps/metacity/general/compositing_manager")
		if self.enab_compo == True:
			self.checkbutton32.set_active(1)
		else:
			self.checkbutton32.set_label(_("Compositor Disabled"))

		# Nautilus Settings

		self.checkbutton17 = self.wTree.get_widget("checkbutton17")
		self.show_pc = GCONF_CLIENT.get_bool("/apps/nautilus/desktop/computer_icon_visible")
		if self.show_pc == True:
			self.checkbutton17.set_active(1)
		else:
			self.checkbutton17.set_label(_("Will hide Computer Icon"))

		self.checkbutton18 = self.wTree.get_widget("checkbutton18")
		self.show_home = GCONF_CLIENT.get_bool("/apps/nautilus/desktop/home_icon_visible")
		if self.show_home == True:
			self.checkbutton18.set_active(1)
		else:
			self.checkbutton18.set_label(_("Will hide Home Icon"))

		self.checkbutton19 = self.wTree.get_widget("checkbutton19")
		self.show_network = GCONF_CLIENT.get_bool("/apps/nautilus/desktop/network_icon_visible")
		if self.show_network == True:
			self.checkbutton19.set_active(1)
		else:
			self.checkbutton19.set_label(_("Will hide Network Icon"))

		self.checkbutton20 = self.wTree.get_widget("checkbutton20")
		self.show_trash = GCONF_CLIENT.get_bool("/apps/nautilus/desktop/trash_icon_visible")
		if self.show_trash == True:
			self.checkbutton20.set_active(1)
		else:
			self.checkbutton20.set_label(_("Will hide Trash Icon"))

		self.checkbutton21 = self.wTree.get_widget("checkbutton21")
		self.show_volumes = GCONF_CLIENT.get_bool("/apps/nautilus/desktop/volumes_visible")
		if self.show_volumes == True:
			self.checkbutton21.set_active(1)
		else:
			self.checkbutton21.set_label(_("Will hide Volume Icons"))

		self.entry1 = self.wTree.get_widget("entry1")
		self.comp_name = GCONF_CLIENT.get_string("/apps/nautilus/desktop/computer_icon_name")
		if self.comp_name != None:
			self.entry1.set_text(self.comp_name)

		self.entry2 = self.wTree.get_widget("entry2")
		self.home_name = GCONF_CLIENT.get_string("/apps/nautilus/desktop/home_icon_name")
		if self.home_name != None:
			self.entry2.set_text(self.home_name)

		self.entry3 = self.wTree.get_widget("entry3")
		self.net_name = GCONF_CLIENT.get_string("/apps/nautilus/desktop/network_icon_name")
		if self.net_name != None:
			self.entry3.set_text(self.net_name)

		self.entry4 = self.wTree.get_widget("entry4")
		self.trash_name = GCONF_CLIENT.get_string("/apps/nautilus/desktop/trash_icon_name")
		if self.trash_name != None:
			self.entry4.set_text(self.trash_name)

		self.checkbutton22 = self.wTree.get_widget("checkbutton22")
		self.draw_desk = GCONF_CLIENT.get_bool("/apps/nautilus/preferences/show_desktop")
		if self.draw_desk == True:
			self.checkbutton22.set_active(1)
		else:
			self.checkbutton22.set_label(_("Don't draw the Desktop"))

		self.checkbutton23 = self.wTree.get_widget("checkbutton23")
		self.show_path = GCONF_CLIENT.get_bool("/apps/nautilus/preferences/location_in_title_bar")
		if self.show_path == True:
			self.checkbutton23.set_active(1)
		else:
			self.checkbutton23.set_label(_("Won't show full path in titlebar"))

		self.checkbutton24 = self.wTree.get_widget("checkbutton24")
		self.show_perms = GCONF_CLIENT.get_bool("/apps/nautilus/preferences/show_advanced_permissions")
		if self.show_perms == True:
			self.checkbutton24.set_active(1)
		else:
			self.checkbutton24.set_label(_("Show simple permissions"))

		# Bug-Buddy Settings

		self.entry5 = self.wTree.get_widget("entry5")
		self.your_name = GCONF_CLIENT.get_string("/apps/bug-buddy/name")
		if self.your_name != None:
			self.entry5.set_text(self.your_name)

		self.entry6 = self.wTree.get_widget("entry6")
		self.your_mail = GCONF_CLIENT.get_string("/apps/bug-buddy/email_address")
		if self.your_mail != None:
			self.entry6.set_text(self.your_mail)

		self.entry7 = self.wTree.get_widget("entry7")
		self.bug_file = GCONF_CLIENT.get_string("/apps/bug-buddy/bugfile")
		if self.bug_file != None:
			self.entry7.set_text(self.bug_file)

		self.checkbutton30 = self.wTree.get_widget("checkbutton30")
		self.run_on_crash = GCONF_CLIENT.get_bool("/apps/bug-buddy/run_on_crash")
		if self.run_on_crash == True:
			self.checkbutton30.set_active(1)
		else:
			self.checkbutton30.set_label(_("Won't run BugBuddy on Crash"))

		# CD Burner Settings

		self.checkbutton26 = self.wTree.get_widget("checkbutton26")
		self.use_bp = GCONF_CLIENT.get_bool("/apps/nautilus-cd-burner/burnproof")
		if self.use_bp == True:
			self.checkbutton26.set_active(1)
		else:
			self.checkbutton26.set_label(_("Disabling Burnproof"))

		self.checkbutton27 = self.wTree.get_widget("checkbutton27")
		self.use_ob = GCONF_CLIENT.get_bool("/apps/nautilus-cd-burner/overburn")
		if self.use_ob == True:
			self.checkbutton27.set_active(1)
		else:
			self.checkbutton27.set_label(_("Disabling Overburn"))

		self.spinbutton1 = self.wTree.get_widget("spinbutton1")
		self.writespeed = GCONF_CLIENT.get_int("/apps/nautilus-cd-burner/default_speed")
		self.spinbutton1.set_value(self.writespeed)

		self.entry8 = self.wTree.get_widget("entry8")
		self.temp_iso_dir = GCONF_CLIENT.get_string("/apps/nautilus-cd-burner/temp_iso_dir")
		if self.temp_iso_dir != None:
			self.entry8.set_text(self.temp_iso_dir)

		self.combobox8 = self.wTree.get_widget("combobox8")
		self.combobox8.set_active(0)

		# Misc Settings

		self.combobox9 = self.wTree.get_widget("combobox9")
		self.combobox9.set_active(0)

		self.checkbutton31 = self.wTree.get_widget("checkbutton31")
		self.ov_res = GCONF_CLIENT.get_bool("/apps/evince/override_restrictions")
		if self.ov_res == True:
			self.checkbutton31.set_active(1)
		else:
			self.checkbutton31.set_label(_("Not overriding Restrictions"))

		self.combobox1 = self.wTree.get_widget("combobox1")
		self.combobox1.set_active(0)

		self.checkbutton28 = self.wTree.get_widget("checkbutton28")
		self.access = GCONF_CLIENT.get_bool("/desktop/gnome/interface/accessibility")
		if self.access == True:
			self.checkbutton28.set_active(1)
		else:
			self.checkbutton28.set_label(_("Accessibility Disabled"))

		self.entry9 = self.wTree.get_widget("entry9")
		self.wm = GCONF_CLIENT.get_string("/desktop/gnome/applications/window_manager/default")
		if self.wm != None:
			self.entry9.set_text(self.wm)

	# The TreeView

	def tv1a(self, treeview, *args):
		self.selection = self.treeview.get_selection()
      		(Model, Iter) = self.selection.get_selected()
      		self.position = int(self.selection.get_selected_rows()[1][0][0])
		if self.position == 0:
			self.notebook1.set_current_page(0)
		elif self.position == 1:
			self.notebook1.set_current_page(1)
		elif self.position == 2:
			self.notebook1.set_current_page(2)
		elif self.position == 3:
			self.notebook1.set_current_page(3)
		elif self.position == 4:
			self.notebook1.set_current_page(4)
		elif self.position == 5:
			self.notebook1.set_current_page(5)
		elif self.position == 6:
			self.notebook1.set_current_page(6)
		elif self.position == 7:
			self.notebook1.set_current_page(7)
		elif self.position == 8:
			self.notebook1.set_current_page(8)
		elif self.position == 9:
			self.notebook1.set_current_page(9)

	# Gnome Session Properties

	def cb1a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-session/options/show_splash_screen", self.checkbutton1.get_active())
		if self.checkbutton1.get_active() == True:
			self.checkbutton1.set_label(_("Session Splash Screen Enabled"))
		else:
			self.checkbutton1.set_label(_("Session Splash Screen Disabled"))

	def cb14a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-session/options/logout_prompt", self.checkbutton14.get_active())
		if self.checkbutton14.get_active() == True:
			self.checkbutton14.set_label(_("Logout Prompt Enabled"))
		else:
			self.checkbutton14.set_label(_("Logout Prompt Disabled"))

	def fcb1a(self, command):
		GCONF_CLIENT.set_string("/apps/gnome-session/options/splash_image", self.filechooserbutton1.get_filename())

	def cmb10a(self, command):
		if self.combobox10.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/gnome-session/options/logout_option", "logout")
		elif self.combobox10.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/gnome-session/options/logout_option", "shutdown")
		elif self.combobox10.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/gnome-session/options/logout_option", "restart")

	def cb33a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-session/options/allow_tcp_connections", self.checkbutton33.get_active())
		if self.checkbutton33.get_active() == True:
			self.checkbutton33.set_label(_("Allowing TCP Connections"))
		else:
			self.checkbutton33.set_label(_("Disallowing TCP Connections"))

	# GnomePanel Properties

	def cb2a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/general/enable_program_list", self.checkbutton2.get_active())
		if self.checkbutton2.get_active() == True:
			self.checkbutton2.set_label(_("Application List Is Enabled"))
		else:
			self.checkbutton2.set_label(_("Application List Is Disabled"))

	def cb3a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/general/enable_autocompletion", self.checkbutton3.get_active())
		if self.checkbutton3.get_active() == True:
			self.checkbutton3.set_label(_("Rundialog Autocompletion Enabled"))
		else:
			self.checkbutton3.set_label(_("Rundialog Autocompletion Disabled"))

	def cb4a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/global/tooltips_enabled", self.checkbutton4.get_active())
		if self.checkbutton4.get_active() == True:
			self.checkbutton4.set_label(_("Tooltips Are Enabled"))
		else:
			self.checkbutton4.set_label(_("Tooltips Are Disabled"))

	def cb25a(self, toggle):
		if self.checkbutton25.get_active() == 1:
			self.checkbutton25.set_label(_("Recently-Used Menu Disabled"))
			if os.path.isfile(os.path.expanduser("~/.recently-used.xbel")):
				os.remove(os.path.expanduser("~/.recently-used.xbel"))
				os.mkdir(os.path.expanduser("~/.recently-used.xbel"))
		else:
			self.checkbutton25.set_label(_("Recently-Used Menu Enabled"))
			if os.path.isdir(os.path.expanduser("~/.recently-used.xbel")):
				os.rmdir(os.path.expanduser("~/.recently-used.xbel"))

	def cb34a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/global/upstream_session", self.checkbutton34.get_active())
		if self.checkbutton34.get_active() == 1:
			self.checkbutton34.set_label(_("Using GnomePanel's Session-Dialog"))
		else:
			self.checkbutton34.set_label(_("Using GnomeSession's Session-Dialog"))

	def cb35a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/global/highlight_launchers_on_mouseover", self.checkbutton35.get_active())
		if self.checkbutton35.get_active() == 1:
			self.checkbutton35.set_label(_("Launcher effect enabled"))
		else:
			self.checkbutton35.set_label(_("Launcher effect disabled"))

	def cb36a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/panel/global/enable_animations", self.checkbutton36.get_active())
		GCONF_CLIENT.set_bool("/desktop/gnome/interface/enable_animations", self.checkbutton36.get_active())
		if self.checkbutton36.get_active() == 1:
			self.checkbutton36.set_label(_("Animations enabled"))
		else:
			self.checkbutton36.set_label(_("Animations disabled"))

	# GkSu Settings

	def cb5a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gksu/save-to-keyring", self.checkbutton5.get_active())
		if self.checkbutton5.get_active() == True:
			self.checkbutton5.set_label(_("Password will be saved in the Keyring"))
		else:
			self.checkbutton5.set_label(_("Password won't be saved in the Keyring"))

	def cb6a(self, toggle):
		if self.checkbutton6.get_active():
			GCONF_CLIENT.set_string("/apps/gksu/save-keyring", "session")
			self.checkbutton6.set_label(_("Saving for: The whole session"))
		else:
			GCONF_CLIENT.set_string("/apps/gksu/save-keyring", "default")
			self.checkbutton6.set_label(_("Saving for: System-pre-defined time"))

	def cb7a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gksu/sudo-mode", self.checkbutton7.get_active())
		if self.checkbutton7.get_active() == True:
			self.checkbutton7.set_label(_("Using Sudo for Authentification"))
		else:
			self.checkbutton7.set_label(_("Using Su for Authentification"))

	# FileRoller Settings

	def cmb2a(self, command):
		if self.combobox2.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/file-roller/general/compression_level", "very_fast")
		elif self.combobox2.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/file-roller/general/compression_level", "fast")
		elif self.combobox2.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/file-roller/general/compression_level", "normal")
		elif self.combobox2.get_active() == 4:
			GCONF_CLIENT.set_string("/apps/file-roller/general/compression_level", "maximum")

	def cb8a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/file-roller/dialogs/extract/skip_newer", self.checkbutton8.get_active())
		if self.checkbutton8.get_active() == True:
			self.checkbutton8.set_label(_("Skip newer files"))
		else:
			self.checkbutton8.set_label(_("Don't skip newer files"))

	def cb9a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/file-roller/dialogs/extract/view_destination_folder", self.checkbutton9.get_active())
		if self.checkbutton9.get_active() == True:
			self.checkbutton9.set_label(_("Open Destination after unpacking"))
		else:
			self.checkbutton9.set_label(_("Don't open Destination after unpacking"))

	# GnomeTerminal Settings

	def cb10a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-terminal/global/confirm_window_close", self.checkbutton10.get_active())
		if self.checkbutton10.get_active() == True:
			self.checkbutton10.set_label(_("Closing with Confirmation"))
		else:
			self.checkbutton10.set_label(_("Closing without Confirmation"))

	def cb11a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-terminal/global/use_menu_accelerators", self.checkbutton11.get_active())
		if self.checkbutton11.get_active() == True:
			self.checkbutton11.set_label(_("F10 bound to the Terminal"))
		else:
			self.checkbutton11.set_label(_("F10 unbound from Terminal"))

	def cb12a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-terminal/global/use_mnemonics", self.checkbutton12.get_active())
		if self.checkbutton12.get_active() == True:
			self.checkbutton12.set_label(_("Alt+Letter bound to the Terminal"))
		else:
			self.checkbutton12.set_label(_("Alt+Letter unbound from Terminal"))

	def cb29a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/gnome-terminal/profiles/Default/use_theme_colors", self.checkbutton29.get_active())
		if self.checkbutton29.get_active() == True:
			self.checkbutton29.set_label(_("Using Theme Colors"))
		else:
			self.checkbutton29.set_label(_("Not using Theme Colors"))

	# Metacity Settings

	def cmb3a(self, command):
		if self.combobox3.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/focus_mode", "sloppy")
		elif self.combobox3.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/focus_mode", "click")
		elif self.combobox3.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/focus_mode", "mouse")

	def cmb4a(self, command):
		if self.combobox4.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "close,maximize,minimize:")
		elif self.combobox4.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "close,maximize,minimize:menu")
		elif self.combobox4.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "close:minimize,maximize,menu")
		elif self.combobox4.get_active() == 4:
			GCONF_CLIENT.set_string("apps/metacity/general/button_layout", "minimize:close")
		elif self.combobox4.get_active() == 5:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "menu:minimize,maximize,close")
		elif self.combobox4.get_active() == 6:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "menu:shade,above,stick,minimize,maximize,close")
		elif self.combobox4.get_active() == 7:
			GCONF_CLIENT.set_string("/apps/metacity/general/button_layout", "close,maximize,minimize,stick,above,shade:menu")

	def cb13a(self, toggle):
		if self.checkbutton13.get_active():
			GCONF_CLIENT.set_string("/apps/metacity/general/focus_new_windows", "smart")
			self.checkbutton13.set_label(_("Will focus new Windows Smart"))
		else:
			GCONF_CLIENT.set_string("/apps/metacity/general/focus_new_windows", "strict")
			self.checkbutton13.set_label(_("Will focus new Windows Strict"))

	def cb15a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/metacity/general/reduced_resources", self.checkbutton15.get_active())
		if self.checkbutton15.get_active() == True:
			self.checkbutton15.set_label(_("Display Wireframemodell on Move"))
		else:
			self.checkbutton15.set_label(_("Display full Content on Move"))

	def cb16a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/metacity/general/disable_workarounds", self.checkbutton16.get_active())
		if self.checkbutton16.get_active() == True:
			self.checkbutton16.set_label(_("Disabling Workarounds"))
		else:
			self.checkbutton16.set_label(_("Enabling Workarounds"))

	def cmb5a(self, command):
		if self.combobox5.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "toggle_shade")
		elif self.combobox5.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "lower")
		elif self.combobox5.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "toggle_maximize")
		elif self.combobox5.get_active() == 4:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "toggle_maximize_horizontally")
		elif self.combobox5.get_active() == 5:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "toggle_maximize_vertically")
		elif self.combobox5.get_active() == 6:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "minimize")
		elif self.combobox5.get_active() == 7:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "menu")
		elif self.combobox5.get_active() == 8:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_double_click_titlebar", "none")

	def cmb6a(self, command):
		if self.combobox6.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "toggle_shade")
		elif self.combobox6.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "lower")
		elif self.combobox6.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "toggle_maximize")
		elif self.combobox6.get_active() == 4:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "toggle_maximize_horizontally")
		elif self.combobox6.get_active() == 5:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "toggle_maximize_vertically")
		elif self.combobox6.get_active() == 6:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "minimize")
		elif self.combobox6.get_active() == 7:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "menu")
		elif self.combobox6.get_active() == 8:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_middle_click_titlebar", "none")

	def cmb7a(self, command):
		if self.combobox7.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "toggle_shade")
		elif self.combobox7.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "lower")
		elif self.combobox7.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "toggle_maximize")
		elif self.combobox7.get_active() == 4:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "toggle_maximize_horizontally")
		elif self.combobox7.get_active() == 5:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "toggle_maximize_vertically")
		elif self.combobox7.get_active() == 6:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "minimize")
		elif self.combobox7.get_active() == 7:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "menu")
		elif self.combobox7.get_active() == 8:
			GCONF_CLIENT.set_string("/apps/metacity/general/action_right_click_titlebar", "none")


	def cb32a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/metacity/general/compositing_manager", self.checkbutton32.get_active())
		if self.checkbutton32.get_active() == True:
			self.checkbutton32.set_label(_("Compositor Enabled"))
		else:
			self.checkbutton32.set_label(_("Compositor Disabled"))

	def cmb9a(self, command):
		if self.combobox9.get_active() == 1:
			GCONF_CLIENT.set_string("/apps/metacity/general/mouse_button_modifier", "<Alt>")
		elif self.combobox9.get_active() == 2:
			GCONF_CLIENT.set_string("/apps/metacity/general/mouse_button_modifier", "<Super>")
		elif self.combobox9.get_active() == 3:
			GCONF_CLIENT.set_string("/apps/metacity/general/mouse_button_modifier", "<Ctrl>")
		elif self.combobox9.get_active() == 4:
			GCONF_CLIENT.set_string("/apps/metacity/general/mouse_button_modifier", "<Shift>")
		elif self.combobox9.get_active() == 5:
			GCONF_CLIENT.set_string("/apps/metacity/general/mouse_button_modifier", "<Mod5>")

	# Nautilus Settings

	def cb17a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/desktop/computer_icon_visible", self.checkbutton17.get_active())
		if self.checkbutton17.get_active() == True:
			self.checkbutton17.set_label(_("Will show Computer Icon"))
		else:
			self.checkbutton17.set_label(_("Will hide Computer Icon"))

	def cb18a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/desktop/home_icon_visible", self.checkbutton18.get_active())
		if self.checkbutton18.get_active() == True:
			self.checkbutton18.set_label(_("Will show Home Icon"))
		else:
			self.checkbutton18.set_label(_("Will hide Home Icon"))

	def cb19a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/desktop/network_icon_visible", self.checkbutton19.get_active())
		if self.checkbutton19.get_active() == True:
			self.checkbutton19.set_label(_("Will show Network Icon"))
		else:
			self.checkbutton19.set_label(_("Will hide Network Icon"))

	def cb20a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/desktop/trash_icon_visible", self.checkbutton20.get_active())
		if self.checkbutton20.get_active() == True:
			self.checkbutton20.set_label(_("Will show Trash Icon"))
		else:
			self.checkbutton20.set_label(_("Will hide Trash Icon"))

	def cb21a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/desktop/volumes_visible", self.checkbutton21.get_active())
		if self.checkbutton21.get_active() == True:
			self.checkbutton21.set_label(_("Will show Volume Icons"))
		else:
			self.checkbutton21.set_label(_("Will hide Volume Icons"))

	def e1a(self, command):
		GCONF_CLIENT.set_string("/apps/nautilus/desktop/computer_icon_name", self.entry1.get_text())

	def e2a(self, command):
		GCONF_CLIENT.set_string("/apps/nautilus/desktop/home_icon_name", self.entry2.get_text())

	def e3a(self, command):
		GCONF_CLIENT.set_string("/apps/nautilus/desktop/network_icon_name", self.entry3.get_text())

	def e4a(self, command):
		GCONF_CLIENT.set_string("/apps/nautilus/desktop/trash_icon_name", self.entry4.get_text())

	def cb22a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/preferences/show_desktop", self.checkbutton22.get_active())
		if self.checkbutton22.get_active() == True:
			self.checkbutton22.set_label(_("Draw the Desktop"))
		else:
			self.checkbutton22.set_label(_("Don't draw the Desktop"))

	def cb23a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/preferences/location_in_title_bar", self.checkbutton23.get_active())
		if self.checkbutton23.get_active() == True:
			self.checkbutton23.set_label(_("Show full path in titlebar"))
		else:
			self.checkbutton23.set_label(_("Won't show full path in titlebar"))

	def cb24a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus/preferences/show_advanced_permissions", self.checkbutton24.get_active())
		if self.checkbutton24.get_active() == True:
			self.checkbutton24.set_label(_("Show advanced permissions"))
		else:
			self.checkbutton24.set_label(_("Show simple permissions"))

	# Bud-Buddy Settings

	def e5a(self, command):
		GCONF_CLIENT.set_string("/apps/bug-buddy/name", self.entry5.get_text())

	def e7a(self, command):
		GCONF_CLIENT.set_string("/apps/bug-buddy/bugfile", self.entry7.get_text())

	def cb30a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/bug-buddy/run_on_crash", self.checkbutton30.get_active())
		if self.checkbutton30.get_active() == True:
			self.checkbutton30.set_label(_("Will run BugBuddy on Crash"))
		else:
			self.checkbutton30.set_label(_("Won't run BugBuddy on Crash"))

	def e6a(self, command):
		GCONF_CLIENT.set_string("/apps/bug-buddy/email_address", self.entry6.get_text())

	# CD Burner Settings

	def cb26a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus-cd-burner/burnproof", self.checkbutton26.get_active())
		if self.checkbutton26.get_active() == True:
			self.checkbutton26.set_label(_("Enabling Burnproof"))
		else:
			self.checkbutton26.set_label(_("Disabling Burnproof"))

	def cb27a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/nautilus-cd-burner/overburn", self.checkbutton27.get_active())
		if self.checkbutton27.get_active() == True:
			self.checkbutton27.set_label(_("Enabling Overburn"))
		else:
			self.checkbutton27.set_label(_("Disabling Overburn"))

	def spb1a(self, command):
		GCONF_CLIENT.set_int("/apps/nautilus-cd-burner/default_speed", self.entry7.get_value_as_int())

	def e8a(self, command):
		GCONF_CLIENT.set_string("/apps/nautilus-cd-burner/temp_iso_dir", self.entry8.get_text())

	# Misc. Settings

	def cmb8a(self, command):
		if self.combobox8.get_active() == 1:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "0")
		elif self.combobox8.get_active() == 2:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "2")
		elif self.combobox8.get_active() == 3:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "4")
		elif self.combobox8.get_active() == 4:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "8")
		elif self.combobox8.get_active() == 5:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "16")
		elif self.combobox8.get_active() == 6:
			GCONF_CLIENT.set_int("/apps/sound-juicer/paranoia", "255")

	def cb31a(self, toggle):
		GCONF_CLIENT.set_bool("/apps/evince/override_restrictions", self.checkbutton31.get_active())
		if self.checkbutton31.get_active() == True:
			self.checkbutton31.set_label(_("Overriding Restrictions"))
		else:
			self.checkbutton31.set_label(_("Not overriding Restrictions"))

	def cmb1a(self, command):
		if self.combobox1.get_active() == 1:
			GCONF_CLIENT.set_string("/desktop/gnome/interface/file_chooser_backend", "gtk+")
		elif self.combobox1.get_active() == 2:
			GCONF_CLIENT.set_string("/desktop/gnome/interface/file_chooser_backend", "gnome-vfs")
		elif self.combobox1.get_active() == 3:
			GCONF_CLIENT.set_string("/desktop/gnome/interface/file_chooser_backend", "gio")
		elif self.combobox1.get_active() == 4:
			GCONF_CLIENT.set_string("/desktop/gnome/interface/file_chooser_backend", "gvfs")

	def cb28a(self, command):
		GCONF_CLIENT.set_bool("/desktop/gnome/interface/accessibility", self.checkbutton28.get_active())
		if self.checkbutton28.get_active() == True:
			self.checkbutton28.set_label(_("Accessibility Enabled"))
		else:
			self.checkbutton28.set_label(_("Accessibility Disabled"))

	def e9a(self, command):
		GCONF_CLIENT.set_string("/desktop/gnome/applications/window_manager/default", self.entry9.get_text())
		GCONF_CLIENT.set_string("/desktop/gnome/applications/window_manager/current", self.entry9.get_text())

	# Clear History

	def b1a(self, command):
		self.history = []
		GCONF_CLIENT.set_list("/apps/gnome-settings/gnome-panel/history-gnome-run", "string", self.history)
		GCONF_CLIENT.set_list("/apps/gnome-settings/gnome-desktop-item-edit/history-desktop-icon", "string", self.history)
		GCONF_CLIENT.set_list("/apps/gnome-settings/gedit/history-gedit2_search_for_entry", "string", self.history)
		GCONF_CLIENT.set_list("/apps/gnome-settings/gedit/history-gedit2_replace_with_entry", "string", self.history)
		if os.access(os.path.expanduser("~/.recently-used"), os.F_OK):
			os.system("rm -f $HOME/.recently-used")

if __name__ == "__main__":
	hwg = GP4()
	gtk.main()
