Commit c778ed69 authored by Philipp Hörist's avatar Philipp Hörist Committed by Philipp Hörist

Move Preferences into own module

- Port Preferences to Gtk.ApplicationWindow
parent 42adff1b
...@@ -69,11 +69,10 @@ def tree_model_pre_order(model, treeiter): ...@@ -69,11 +69,10 @@ def tree_model_pre_order(model, treeiter):
class AdvancedConfigurationWindow(object): class AdvancedConfigurationWindow(object):
def __init__(self): def __init__(self, transient):
self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui') self.xml = gtkgui_helpers.get_gtk_builder('advanced_configuration_window.ui')
self.window = self.xml.get_object('advanced_configuration_window') self.window = self.xml.get_object('advanced_configuration_window')
self.window.set_transient_for( self.window.set_transient_for(transient)
app.interface.instances['preferences'].window)
self.entry = self.xml.get_object('advanced_entry') self.entry = self.xml.get_object('advanced_entry')
self.desc_label = self.xml.get_object('advanced_desc_label') self.desc_label = self.xml.get_object('advanced_desc_label')
self.restart_box = self.xml.get_object('restart_box') self.restart_box = self.xml.get_object('restart_box')
......
...@@ -28,6 +28,7 @@ from gajim import disco ...@@ -28,6 +28,7 @@ from gajim import disco
from gajim.gtk.history_sync import HistorySyncAssistant from gajim.gtk.history_sync import HistorySyncAssistant
from gajim.gtk.server_info import ServerInfoDialog from gajim.gtk.server_info import ServerInfoDialog
from gajim.gtk.mam_preferences import MamPreferences from gajim.gtk.mam_preferences import MamPreferences
from gajim.gtk.preferences import Preferences
from gajim.gtk import JoinGroupchatWindow from gajim.gtk import JoinGroupchatWindow
from gajim.gtk import StartChatDialog from gajim.gtk import StartChatDialog
from gajim.gtk import AddNewContactWindow from gajim.gtk import AddNewContactWindow
...@@ -50,11 +51,11 @@ def on_add_contact_jid(action, param): ...@@ -50,11 +51,11 @@ def on_add_contact_jid(action, param):
def on_preferences(action, param): def on_preferences(action, param):
if 'preferences' in interface.instances: window = app.get_app_window(Preferences)
interface.instances['preferences'].window.present() if window is None:
Preferences()
else: else:
interface.instances['preferences'] = \ window.present()
config.PreferencesWindow()
def on_plugins(action, param): def on_plugins(action, param):
......
This diff is collapsed.
This diff is collapsed.
...@@ -34,11 +34,10 @@ from gajim.gtk.util import get_builder ...@@ -34,11 +34,10 @@ from gajim.gtk.util import get_builder
class GajimThemesWindow: class GajimThemesWindow:
def __init__(self): def __init__(self, transient):
self.xml = get_builder('gajim_themes_window.ui') self.xml = get_builder('gajim_themes_window.ui')
self.window = self.xml.get_object('gajim_themes_window') self.window = self.xml.get_object('gajim_themes_window')
self.window.set_transient_for(app.interface.instances[ self.window.set_transient_for(transient)
'preferences'].window)
self.options = ['account', 'group', 'contact', 'banner'] self.options = ['account', 'group', 'contact', 'banner']
self.options_combobox = self.xml.get_object('options_combobox') self.options_combobox = self.xml.get_object('options_combobox')
...@@ -85,8 +84,9 @@ class GajimThemesWindow: ...@@ -85,8 +84,9 @@ class GajimThemesWindow:
return True # do NOT destroy the window return True # do NOT destroy the window
def on_close_button_clicked(self, widget): def on_close_button_clicked(self, widget):
if 'preferences' in app.interface.instances: window = app.get_app_window('Preferences')
app.interface.instances['preferences'].update_theme_list() if window is not None:
window.update_theme_list()
self.window.hide() self.window.hide()
def on_theme_cell_edited(self, cell, row, new_name): def on_theme_cell_edited(self, cell, row, new_name):
......
This diff is collapsed.
...@@ -1916,10 +1916,6 @@ class Interface: ...@@ -1916,10 +1916,6 @@ class Interface:
if not emot_theme: if not emot_theme:
return return
transient_for = None
if 'preferences' in app.interface.instances:
transient_for = app.interface.instances['preferences'].window
themes = helpers.get_available_emoticon_themes() themes = helpers.get_available_emoticon_themes()
if emot_theme not in themes: if emot_theme not in themes:
if 'font-emoticons' in themes: if 'font-emoticons' in themes:
...@@ -1935,7 +1931,7 @@ class Interface: ...@@ -1935,7 +1931,7 @@ class Interface:
_('Emoticons disabled'), _('Emoticons disabled'),
_('Your configured emoticons theme could not be loaded.' _('Your configured emoticons theme could not be loaded.'
' See the log for more details.'), ' See the log for more details.'),
transient_for=transient_for) transient_for=app.get_app_window('Preferences'))
app.config.set('emoticons_theme', '') app.config.set('emoticons_theme', '')
return return
......
...@@ -365,10 +365,12 @@ class StatusIcon: ...@@ -365,10 +365,12 @@ class StatusIcon:
win.hide() win.hide()
def on_preferences_menuitem_activate(self, widget): def on_preferences_menuitem_activate(self, widget):
if 'preferences' in app.interface.instances: from gajim.gtk.preferences import Preferences
app.interface.instances['preferences'].window.present() window = app.get_app_window(Preferences)
if window is None:
Preferences()
else: else:
app.interface.instances['preferences'] = config.PreferencesWindow() window.present()
def on_quit_menuitem_activate(self, widget): def on_quit_menuitem_activate(self, widget):
app.interface.roster.on_quit_request() app.interface.roster.on_quit_request()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment