[alacarte] Make item editors modal on top of the main window
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte] Make item editors modal on top of the main window
- Date: Fri, 11 Jan 2013 06:40:34 +0000 (UTC)
commit bf776b3d1768e48632c98cb69b94a7c05d060ed6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jan 11 01:35:19 2013 -0500
Make item editors modal on top of the main window
Alacarte/ItemEditor.py | 6 ++++--
Alacarte/MainWindow.py | 10 ++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/Alacarte/ItemEditor.py b/Alacarte/ItemEditor.py
index be725fd..5374c53 100644
--- a/Alacarte/ItemEditor.py
+++ b/Alacarte/ItemEditor.py
@@ -141,11 +141,12 @@ class ItemEditor(object):
self.dialog.destroy()
class LauncherEditor(ItemEditor):
- def __init__(self, item_path):
+ def __init__(self, parent, item_path):
self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(config.pkgdatadir, 'launcher-editor.ui'))
self.dialog = self.builder.get_object('launcher-editor')
+ self.dialog.set_transient_for(parent)
self.dialog.connect('response', self.on_response)
self.icon_picker = IconPicker(self.dialog,
@@ -194,11 +195,12 @@ class LauncherEditor(ItemEditor):
chooser.destroy()
class DirectoryEditor(ItemEditor):
- def __init__(self, item_path):
+ def __init__(self, parent, item_path):
self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(config.pkgdatadir, 'directory-editor.ui'))
self.dialog = self.builder.get_object('directory-editor')
+ self.dialog.set_transient_for(parent)
self.dialog.connect('response', self.on_response)
self.icon_picker = IconPicker(self.dialog,
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index bff2137..e4418f0 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -52,7 +52,9 @@ class MainWindow(object):
accelgroup = Gtk.AccelGroup()
keyval, modifier = Gtk.accelerator_parse('F1')
accelgroup.connect(keyval, modifier, Gtk.AccelFlags.VISIBLE, self.on_help_button_clicked)
- self.tree.get_object('mainwindow').add_accel_group(accelgroup)
+
+ self.main_window = self.tree.get_object('mainwindow')
+ self.main_window.add_accel_group(accelgroup)
self.editor = None
@@ -244,7 +246,7 @@ class MainWindow(object):
parent = menus[iter][2]
file_path = os.path.join(util.getUserDirectoryPath(), util.getUniqueFileId('alacarte-made', '.directory'))
- editor = DirectoryEditor(file_path)
+ editor = DirectoryEditor(self.main_window, file_path)
editor.run()
def on_new_item_button_clicked(self, button):
@@ -258,7 +260,7 @@ class MainWindow(object):
parent = menus[iter][2]
file_path = os.path.join(util.getUserItemPath(), util.getUniqueFileId('alacarte-made', '.desktop'))
- editor = LauncherEditor(file_path)
+ editor = LauncherEditor(self.main_window, file_path)
editor.run()
def on_new_separator_button_clicked(self, button):
@@ -307,7 +309,7 @@ class MainWindow(object):
if not os.path.isfile(file_path):
shutil.copy(item.get_desktop_file_path(), file_path)
- editor = Editor(file_path)
+ editor = Editor(self.main_window, file_path)
editor.run()
def on_menu_tree_cursor_changed(self, treeview):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]