Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_filebrowser_root(self):
base = u'/apps/gedit-2/plugins/filebrowser/on_load'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'virtual_root')
val = client.get(path)
if val is not None:
return gnomevfs.get_local_path_from_uri(val.get_string())
else:
return ''
def __init__(self, prefs_key):
self.client = gconf.client_get_default()
self.prefs_key = prefs_key
self.client.add_dir(self.prefs_key, gconf.CLIENT_PRELOAD_NONE)
def get_filebrowser_root(self):
base = u'/apps/gedit-2/plugins/filebrowser/on_load'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'virtual_root')
val = client.get(path)
if val is not None:
base = u'/apps/gedit-2/plugins/filebrowser'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'filter_mode')
fbfilter = client.get(path).get_string()
return val.get_string()
self.verbose = False
self.autocollapse = True
self.jumpToTagOnMiddleClick = False
self.colours = {
"class" : gtk.gdk.Color(50000,20000,20000),
"define": gtk.gdk.Color(60000,0,0),
"enumerator": gtk.gdk.Color(0,0,0),
"member" : gtk.gdk.Color(0,0,60000),
"function" : gtk.gdk.Color(50000,0,60000),
"namespace" : gtk.gdk.Color(0,20000,0),
}
# create gconf directory if not set yet
client = gconf.client_get_default()
if not client.dir_exists(self.__gconfDir):
client.add_dir(self.__gconfDir,gconf.CLIENT_PRELOAD_NONE)
# get the gconf keys, or stay with default if key not set
try:
self.verbose = client.get_bool(self.__gconfDir+"/verbose") \
or self.verbose
self.autocollapse = client.get_bool(self.__gconfDir+"/autocollapse") \
or self.autocollapse
self.jumpToTagOnMiddleClick = client.get_bool(self.__gconfDir+"/jumpToTagOnMiddleClick") \
or self.jumpToTagOnMiddleClick
for i in self.colours:
col = client.get_string(self.__gconfDir+"/colour_"+i)
if col: self.colours[i] = gtk.gdk.color_parse(col)
self.transient_for = None
if options.transient_for:
self.transient_for = gtk.gdk.window_foreign_new(options.transient_for)
if self.transient_for:
self.window_main.realize()
self.window_main.window.set_transient_for(self.transient_for)
# sensitive stuff
self.button_ok.set_sensitive(False)
# are we sorting by popcon
self.sort_by_ranking = False
# setup the gconf backend
self.config = gconf.client_get_default()
self.config.add_dir ("/apps/gnome-app-install", gconf.CLIENT_PRELOAD_NONE)
# Tooltips
self.tooltips = gtk.Tooltips()
self.tipmap = {}
# Sexy search entry
self.search_entry = SearchEntry(self.icons)
self.search_hbox.add(self.search_entry)
self.search_entry.connect("terms-changed", self._perform_search)
self.search_entry.show()
self.treeview_packages = AppListView(self.icons)
self.scrolled_window.add(self.treeview_packages)
self.treeview_packages.show()
self.textview_description = AppDescView()
self.attempt_connection()
# Start handling keys
self.key_handler.start()
self.key_handler.action_listeners.append(self)
self.key_handler.action_listeners.append(self.service.macro_handler)
self.key_handler.key_handlers.append(self)
self.key_handler.key_handlers.append(self.service.macro_handler)
# This is just here for backwards compatibility and may be removed at some point
self.action_listeners = self.key_handler.action_listeners
# Monitor gconf
screen_key = "/apps/gnome15/%s" % self.device.uid
logger.info("Watching GConf settings in %s" % screen_key)
self.conf_client.add_dir(screen_key, gconf.CLIENT_PRELOAD_NONE)
self.notify_handles.append(self.conf_client.notify_add("%s/cycle_screens" % screen_key, self.resched_cycle))
self.notify_handles.append(self.conf_client.notify_add("%s/active_profile" % screen_key, self.active_profile_changed))
self.notify_handles.append(self.conf_client.notify_add("%s/driver" % screen_key, self.driver_changed))
for control in self.driver.get_controls():
self.notify_handles.append(self.conf_client.notify_add("%s/%s" % (screen_key, control.id), self._control_changed))
logger.info("Starting for %s is complete." % self.device.uid)
g15profile.profile_listeners.append(self._profile_changed)
# Start watching for network changes
self.service.network_manager.listeners.append(self._network_state_change)
def get_eddt_root(self):
base = u'/apps/gedit-2/plugins/eddt'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'repository')
val = client.get(path)
if val is not None:
return val.get_string()
def get_filebrowser_root(self):
base = u'/apps/gedit-2/plugins/filebrowser/on_load'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'virtual_root')
val = client.get(path)
if val is not None:
#also read hidden files setting
base = u'/apps/gedit-2/plugins/filebrowser'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'filter_mode')
try:
fbfilter = client.get(path).get_string()
except AttributeError:
fbfilter = "hidden"
if fbfilter.find("hidden") == -1:
self._show_hidden = True
else:
self._show_hidden = False
return val.get_string()
def get_filebrowser_root(self):
base = u'/apps/gedit-2/plugins/filebrowser/on_load'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'virtual_root')
val = client.get(path)
if val is not None:
#also read hidden files setting
base = u'/apps/gedit-2/plugins/filebrowser'
client = gconf.client_get_default()
client.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
path = os.path.join(base, u'filter_mode')
try:
fbfilter = client.get(path).get_string()
except AttributeError:
fbfilter = "hidden"
if fbfilter.find("hidden") == -1:
self._show_hidden = True
else:
self._show_hidden = False
def __init__(self, key=None, default=None, type=None):
self.__key = key
self.__type = type
self.__default = default
if default and self.get_value() is None:
self.set_value(default)
if self.get_dir():
self.get_client().add_dir(self.get_dir(), gconf.CLIENT_PRELOAD_NONE)