Skip to content

Commit

Permalink
fix: yumex notification icon launch fails if no yumex.conf
Browse files Browse the repository at this point in the history
(RhBug: 1217165)
  • Loading branch information
Tim Lauridsen committed Apr 30, 2015
1 parent 114affe commit 5c395e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/yumex/__init__.py
Expand Up @@ -1215,7 +1215,7 @@ def do_command_line(self, args):
self.status = yumex.status.StatusIcon(self)
if not self.status.is_started:
msg = _('Yum Extender will close' + '\n' + self.status.last_err)
dialogs.show_information(_('Error in starting notification icon'),
dialogs.show_information(None, _('Error in starting notification icon'),
msg)
sys.exit(0)
self.status.Start() # Show the icon
Expand Down
10 changes: 6 additions & 4 deletions src/yumex/misc.py
Expand Up @@ -234,16 +234,18 @@ def __init__(self):
self.read()

def read(self):
first_read = False
if not os.path.exists(self.conf_file):
logger.info("creating default config file : %s" % self.conf_file)
fh = open(self.conf_file, "w")
print('[yumex]\n', file=fh)
fh.close()
self.parser.read_file(open(self.conf_file, "r"))
first_read = True
else:
self.parser.read_file(open(self.conf_file, "r"))
if not self.parser.has_section('yumex'):
self.parser.add_section('yumex')
self.conf.populate(self.parser, 'yumex')
self.session.populate(self.parser, 'yumex')
if first_read:
self.write()

def write(self):
fp = open(self.conf_file, "w")
Expand Down

0 comments on commit 5c395e8

Please sign in to comment.