118
118
self.notebook_main.set_current_page(int(options.open_tab))
121
self.settings = Gio.Settings("com.ubuntu.update-notifier")
122
# we need this for reverting
123
self.initial_auto_launch = self.settings.get_int("regular-auto-launch-interval")
121
all_schemas = Gio.Settings.list_schemas()
122
if "com.ubuntu.update-notifier" in all_schemas:
123
self.settings = Gio.Settings("com.ubuntu.update-notifier")
124
# we need this for reverting
125
self.initial_auto_launch = self.settings.get_int("regular-auto-launch-interval")
128
self.initial_auto_launch = 0
129
self.combobox_other_updates.set_sensitive(False)
125
131
# get the dbus backend
126
132
bus = dbus.SystemBus()
134
140
"KeysModified", self.on_keys_modified)
135
141
self.backend.connect_to_signal(
136
142
"AuthFailed", self.on_auth_failed)
143
self.backend.connect_to_signal(
144
"CdromScanFailed", self.on_cdrom_scan_failed)
138
146
# Show what we have early
139
147
self.window_main.show()
254
262
self.combobox_security_updates.set_active(2) # Download and install automatically
257
level_other = self.settings.get_int("regular-auto-launch-interval")
258
model = self.combobox_other_updates.get_model()
259
for (i, row) in enumerate(model):
260
level = model.get_value(row.iter, 1)
261
if level_other == level:
262
self.combobox_other_updates.set_active(i)
266
level_other = self.settings.get_int("regular-auto-launch-interval")
267
model = self.combobox_other_updates.get_model()
268
for (i, row) in enumerate(model):
269
level = model.get_value(row.iter, 1)
270
if level_other == level:
271
self.combobox_other_updates.set_active(i)
265
274
def init_distro(self):
266
275
"""Setup the user interface elements to represent the distro"""
694
703
def on_button_revert_clicked(self, button):
695
704
"""Restore the source list from the startup of the dialog"""
696
705
self.backend.Revert()
697
self.settings.set_int("regular-auto-launch-interval", self.initial_auto_launch)
707
self.settings.set_int("regular-auto-launch-interval", self.initial_auto_launch)
698
708
self.show_auto_update_level()
699
709
self.button_revert.set_sensitive(False)
700
710
self.modified_sourceslist = False
724
734
self.on_config_modified()
725
735
self.on_keys_modified()
737
def on_cdrom_scan_failed(self):
738
error(self.window_main,
739
_("Error scanning the CD"),
740
_("Could not find a suitable CD."))
728
743
def show_isv_sources(self):
729
744
""" Show the repositories of independent software vendors in the
880
# FIXME: add to the new dbus backend
881
895
def on_button_add_cdrom_clicked(self, widget):
882
'''Show a dialog that allows to add a repository located on a CDROM
885
#apt_pkg.Config.Set("APT::CDROM::Rename","true")
887
saved_entry = apt_pkg.config.find("Dir::Etc::sourcelist")
888
tmp = tempfile.NamedTemporaryFile()
889
apt_pkg.config.set("Dir::Etc::sourcelist",tmp.name)
890
progress = CdromProgress(self.datadir,self.window_main)
891
cdrom = apt_pkg.Cdrom()
892
# if nothing was found just return
894
res = cdrom.add(progress)
895
except SystemError, msg:
896
error(self.window_main, _("Error scanning the CD"), msg)
899
apt_pkg.config.set("Dir::Etc::sourcelist",saved_entry)
900
progress.dialog_cdrom_progress.hide()
904
# read tmp file with source name (read only last line)
906
for x in open(tmp.name):
909
full_path = "%s%s" % (apt_pkg.config.find_dir("Dir::Etc"),saved_entry)
910
# insert cdrom source first, so that it has precedence over network sources
911
self.sourceslist.list.insert(0, SourceEntry(line,full_path))
912
self.set_modified_sourceslist()
896
""" when a cdrom is requested for adding """
897
self.backend.AddCdromSource()