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


Commits:
5de07c8c by Philipp Hörist at 2024-10-03T18:06:31+02:00
refactor: Fix preferences dialog

- - - - -


4 changed files:

- gajim/data/gui/preferences.ui
- gajim/gtk/preferences.py
- gajim/gtk/sidebar_switcher.py
- gajim/gtk/video_preview.py


Changes:

=====================================
gajim/data/gui/preferences.ui
=====================================
@@ -585,10 +585,9 @@
                                 <property 
name="message-type">warning</property>
                                 <signal name="response" 
handler="_on_features_clicked" swapped="no"/>
                                 <child internal-child="action_area">
-                                  <object class="GtkButtonBox">
+                                  <object class="GtkBox">
                                     <property name="can-focus">False</property>
                                     <property name="spacing">6</property>
-                                    <property 
name="layout-style">end</property>
                                     <child>
                                       <object class="GtkButton" id="button1">
                                         <property name="label" 
translatable="1">Show _Features</property>
@@ -596,24 +595,8 @@
                                         <property 
name="receives-default">1</property>
                                         <property 
name="use-underline">1</property>
                                       </object>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
-                                      <placeholder/>
                                     </child>
                                   </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
                                 </child>
                                 <child internal-child="content_area">
                                   <object class="GtkBox">


=====================================
gajim/gtk/preferences.py
=====================================
@@ -87,11 +87,12 @@ def __init__(self) -> None:
         self._add_prefs(prefs)
         self._add_video_preview()
 
-        self._ui.av_info_bar.set_revealed(
-            not app.is_installed('AV') or sys.platform == 'win32')
-        if sys.platform == 'win32':
-            self._ui.av_info_bar_label.set_text(
-                _('Video calls are not available on Windows'))
+        # TODO GTK4
+        # self._ui.av_info_bar.set_revealed(
+        #     not app.is_installed('AV') or sys.platform == 'win32')
+        # if sys.platform == 'win32':
+        #     self._ui.av_info_bar_label.set_text(
+        #         _('Video calls are not available on Windows'))
 
         controller = Gtk.EventControllerKey()
         controller.connect('key-pressed', self._on_key_pressed)
@@ -106,7 +107,7 @@ def _add_prefs(self, prefs: list[tuple[str, 
type[PreferenceBox]]]):
         for ui_name, klass in prefs:
             pref_box = getattr(self._ui, ui_name)
             pref = klass(self)  # pyright: ignore
-            pref_box.append(pref)
+            pref_box.attach(pref, 0, 0, 1, 1)
             self._prefs[ui_name] = pref
 
     def _add_video_preview(self) -> None:


=====================================
gajim/gtk/sidebar_switcher.py
=====================================
@@ -27,7 +27,7 @@ def __init__(self, width: int | None = None) -> None:
 
     def set_stack(self, stack: Gtk.Stack, rows_visible: bool = True) -> None:
         self._stack = stack
-        for page in iterate_children(self._stack):
+        for page in self._stack.get_pages():
             page = cast(Gtk.StackPage, page)
             name = page.get_name()
             if name is None:


=====================================
gajim/gtk/video_preview.py
=====================================
@@ -39,8 +39,7 @@ def __init__(self) -> None:
         self._av_widget: Gtk.Widget | None = None
 
         self._ui = get_builder('video_preview.ui', self)
-        self.add(self._ui.video_preview_box)
-        self.show_all()
+        self.append(self._ui.video_preview_box)
 
         self.connect('destroy', self._on_destroy)
 
@@ -89,7 +88,7 @@ def _enable_preview(self) -> None:
             self._ui.video_preview_box.remove(self._av_widget)
 
         self._ui.video_preview_placeholder.set_visible(False)
-        self._ui.video_preview_box.pack_end(widget, True, True, 0)
+        self._ui.video_preview_box.append(widget)
         self._av_widget = widget
 
         assert self._av_src is not None



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5de07c8c0b996117bb7f9240a1e81f1bde55f78c

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5de07c8c0b996117bb7f9240a1e81f1bde55f78c
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- commits@gajim.org
To unsubscribe send an email to commits-le...@gajim.org

Reply via email to