Move Preferences into own module
- Port Preferences to Gtk.ApplicationWindow
This commit is contained in:
parent
42adff1b1b
commit
c778ed6917
|
@ -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
|
||||||
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):
|
||||||
|
|
||||||
|
|
||||||
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):
|
||||||
|
|
1139
gajim/config.py
1139
gajim/config.py
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.22.0 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.12"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<object class="GtkAdjustment" id="adjustment1">
|
<object class="GtkAdjustment" id="adjustment1">
|
||||||
<property name="lower">1</property>
|
<property name="lower">1</property>
|
||||||
<property name="upper">1440</property>
|
<property name="upper">1440</property>
|
||||||
|
@ -179,14 +179,6 @@
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkWindow" id="preferences_window">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="title" translatable="yes">Preferences</property>
|
|
||||||
<property name="role">preferences</property>
|
|
||||||
<property name="type_hint">dialog</property>
|
|
||||||
<signal name="destroy" handler="on_preferences_window_destroy" swapped="no"/>
|
|
||||||
<signal name="key-press-event" handler="on_preferences_window_key_press_event" swapped="no"/>
|
|
||||||
<child>
|
|
||||||
<object class="GtkNotebook" id="preferences_notebook">
|
<object class="GtkNotebook" id="preferences_notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
@ -2959,9 +2951,4 @@ to discover one from server.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
|
||||||
<child type="titlebar">
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -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:
|
||||||
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):
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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:
|
||||||
_('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:
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue