From 6e41699297988f77d6aa636d4080d1ece84cc16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 3 Nov 2018 13:43:35 +0100 Subject: [PATCH] GroupchatConfig: Tidy up some rough edges --- gajim/data/gui/groupchat_config.ui | 3 ++- gajim/data/style/gajim.css | 1 + gajim/gtk/groupchat_config.py | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gajim/data/gui/groupchat_config.ui b/gajim/data/gui/groupchat_config.ui index e6ae6ff5d..b00687ccd 100644 --- a/gajim/data/gui/groupchat_config.ui +++ b/gajim/data/gui/groupchat_config.ui @@ -323,6 +323,7 @@ 1 + Name @@ -442,7 +443,7 @@ 1 - spam + Spam diff --git a/gajim/data/style/gajim.css b/gajim/data/style/gajim.css index 43bdb03ce..026246cba 100644 --- a/gajim/data/style/gajim.css +++ b/gajim/data/style/gajim.css @@ -153,6 +153,7 @@ list.settings > row > box { background-color:@theme_base_color; border-bottom: 1px solid; border-color: @borders;} +#GroupchatConfig treeview { padding: 5px; } /* Popover Treeview */ .popover_treeview { border-radius: 3px; background-color: @theme_bg_color; } diff --git a/gajim/gtk/groupchat_config.py b/gajim/gtk/groupchat_config.py index 2d7a2f5ba..cc2426206 100644 --- a/gajim/gtk/groupchat_config.py +++ b/gajim/gtk/groupchat_config.py @@ -75,6 +75,7 @@ class GroupchatConfig(Gtk.ApplicationWindow): self._ui.stack.set_visible_child_name('affiliation') self._ui.connect_signals(self) + self.connect('delete-event', self._cancel) self.show_all() self._ui.stack.notify('visible-child-name') @@ -94,19 +95,19 @@ class GroupchatConfig(Gtk.ApplicationWindow): affiliation = 'member' treeview = self._get_current_treeview() - treeview.get_model().append([None, - None, - None, - affiliation, - text, - affiliation_edit, - jid_edit]) + iter_ = treeview.get_model().append([None, + None, + None, + affiliation, + text, + affiliation_edit, + jid_edit]) # Scroll to added row - row = treeview.get_model()[-1] - treeview.scroll_to_cell(row.path, None, False, 0, 0) + path = treeview.get_model().get_path(iter_) + treeview.scroll_to_cell(path, None, False, 0, 0) treeview.get_selection().unselect_all() - treeview.get_selection().select_path(row.path) + treeview.get_selection().select_path(path) def _on_remove(self, *args): treeview = self._get_current_treeview() @@ -286,10 +287,13 @@ class GroupchatConfig(Gtk.ApplicationWindow): return add, remove, modified def _on_cancel(self, *args): + self._cancel() + self.destroy() + + def _cancel(self, *args): if self._form and self._own_affiliation == 'owner': con = app.connections[self.account] con.get_module('MUC').cancel_config(self.jid) - self.destroy() def _set_affiliations(self): add, remove, modified = self._get_diff()