Commit acec7725 authored by Philipp Hörist's avatar Philipp Hörist

GroupChatSettings: Move ScrolledWindow into .ui file

Fixes #10276
parent 5ca5eb88
Pipeline #6480 passed with stages
in 4 minutes and 36 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkBox" id="drop_area">
......@@ -1953,12 +1953,10 @@
<property name="name">settings_grid</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">18</property>
<property name="row_spacing">6</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkBox">
......@@ -1985,11 +1983,61 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Settings for This Chat</property>
<style>
<class name="bold16"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="overlay_scrolling">False</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="settings_scrolled_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<style>
<class name="padding-18"/>
</style>
</object>
</child>
</object>
</child>
<style>
<class name="scrolled-no-border"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
......
......@@ -72,7 +72,7 @@
from gajim.gtk.dataform import DataFormWidget
from gajim.gtk.groupchat_info import GroupChatInfoScrolled
from gajim.gtk.groupchat_invite import GroupChatInvite
from gajim.gtk.groupchat_settings import GroupChatSettingsScrolled
from gajim.gtk.groupchat_settings import GroupChatSettings
from gajim.gtk.groupchat_roster import GroupchatRoster
from gajim.gtk.util import NickCompletionGenerator
from gajim.gtk.util import get_app_window
......@@ -177,10 +177,9 @@ def __init__(self, parent_win, contact, muc_data, acct):
self.xml.info_grid.attach(self._muc_info_box, 0, 0, 1, 1)
# Groupchat settings
self._groupchat_settings_box = GroupChatSettingsScrolled(
self._groupchat_settings_box = GroupChatSettings(
self.account, self.room_jid, self.context)
self.xml.settings_grid.attach(self._groupchat_settings_box, 0, 0, 1, 1)
self.xml.settings_scrolled_box.add(self._groupchat_settings_box)
# Groupchat invite
self.xml.quick_invite_button.set_action_name(
......
......@@ -23,43 +23,14 @@
from gajim.gtk.settings import SettingsBox
class GroupChatSettingsScrolled(Gtk.ScrolledWindow):
class GroupChatSettings(SettingsBox):
def __init__(self, account, jid, context):
Gtk.ScrolledWindow.__init__(self)
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.set_max_content_height(400)
self.set_propagate_natural_height(True)
self.set_hexpand(True)
self.set_vexpand(True)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=18)
box.set_valign(Gtk.Align.CENTER)
label = Gtk.Label(label=_('Settings For This Chat'))
label.get_style_context().add_class('bold16')
label.set_halign(Gtk.Align.CENTER)
box.add(label)
chat_settings = ChatSettings(account, jid, context)
box.add(chat_settings)
self.add(box)
self.show_all()
class GroupchatSettingsBox(SettingsBox):
def __init__(self, account, jid, settings):
SettingsBox.__init__(self, account, jid)
self.get_style_context().add_class('settings-border')
self.set_selection_mode(Gtk.SelectionMode.NONE)
for setting in settings:
self.add_setting(setting)
self.update_states()
class ChatSettings(GroupchatSettingsBox):
def __init__(self, account, jid, context):
self.set_valign(Gtk.Align.START)
self.set_halign(Gtk.Align.CENTER)
chat_state = {
'disabled': _('Disabled'),
......@@ -106,6 +77,9 @@ def __init__(self, account, jid, context):
'sync_threshold',
context=context,
props={'entries': THRESHOLD_OPTIONS}),
]
GroupchatSettingsBox.__init__(self, account, jid, settings)
for setting in settings:
self.add_setting(setting)
self.update_states()
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