Philipp Hörist pushed to branch master at gajim / gajim

Commits:
3e387f52 by Philipp Hörist at 2018-11-04T16:45:27Z
GroupchatConfig: Valid form before sending

- - - - -


2 changed files:

- gajim/data/gui/groupchat_config.ui
- gajim/gtk/groupchat_config.py


Changes:

=====================================
gajim/data/gui/groupchat_config.ui
=====================================
@@ -101,7 +101,7 @@
             <property name="vexpand">False</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkMenuButton">
+              <object class="GtkMenuButton" id="info_button">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -195,7 +195,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton">
+              <object class="GtkButton" id="ok_button">
                 <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>


=====================================
gajim/gtk/groupchat_config.py
=====================================
@@ -51,6 +51,7 @@ class GroupchatConfig(Gtk.ApplicationWindow):
 
         visible = muc_caps_cache.supports(jid, nbxmpp.NS_REGISTER)
         self._ui.reserved_name_column.set_visible(visible)
+        self._ui.info_button.set_sensitive(False)
 
         self._form = form
         self._affiliations = {}
@@ -67,8 +68,9 @@ class GroupchatConfig(Gtk.ApplicationWindow):
         if form is not None:
             self._ui.stack.set_visible_child_name('config')
             self._data_form_widget = DataFormWidget(form)
+            self._data_form_widget.connect('is-valid', self._on_is_valid)
+            self._data_form_widget.validate()
             self._ui.config_grid.add(self._data_form_widget)
-            # self._ui.stack.set_visible_child_name('affiliation')
         else:
             self._ui.stack.get_child_by_name('config').hide()
             self._ui.stack.get_child_by_name('config').set_no_show_all(True)
@@ -79,6 +81,9 @@ class GroupchatConfig(Gtk.ApplicationWindow):
         self.show_all()
         self._ui.stack.notify('visible-child-name')
 
+    def _on_is_valid(self, _widget, is_valid):
+        self._ui.ok_button.set_sensitive(is_valid)
+
     def _get_current_treeview(self):
         page_name = self._ui.stack.get_visible_child_name()
         return getattr(self._ui, '%s_treeview' % page_name)
@@ -208,6 +213,7 @@ class GroupchatConfig(Gtk.ApplicationWindow):
         affiliation = self._own_affiliation in ('admin', 'owner')
         page = page_name != 'config'
         self._ui.treeview_buttonbox.set_visible(affiliation and page)
+        self._ui.info_button.set_sensitive(page_name == 'outcast')
 
     def _set_remove_button_state(self, sensitive, selected_affiliations):
         if self._own_affiliation not in ('admin', 'owner'):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/3e387f521502c650a81cef644bf901276299a3b2

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/3e387f521502c650a81cef644bf901276299a3b2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to