[xdg-desktop-portal-gnome/gbsneto/post-restore-screencast-cleanups: 12/19] screencastwidget: Move scrolled window to dialogs




commit ae56f37a9492a3c377fbe5ad84f74235903e33ed
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Nov 13 23:46:51 2021 -0300

    screencastwidget: Move scrolled window to dialogs
    
    This allows one scrollbar for the whole window, and not having
    broken shadows in listboxes.

 src/remotedesktopdialog.ui | 118 +++++++++++++++++++++++++--------------------
 src/screencastdialog.ui    |  40 +++++++++------
 src/screencastwidget.c     |   9 ----
 src/screencastwidget.ui    |  20 +++-----
 4 files changed, 98 insertions(+), 89 deletions(-)
---
diff --git a/src/remotedesktopdialog.ui b/src/remotedesktopdialog.ui
index 7444732..33340ab 100644
--- a/src/remotedesktopdialog.ui
+++ b/src/remotedesktopdialog.ui
@@ -29,69 +29,81 @@
       </object>
     </child>
     <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <property name="margin-top">32</property>
-        <property name="margin-bottom">32</property>
-        <property name="margin-start">32</property>
-        <property name="margin-end">32</property>
-        <property name="spacing">32</property>
-        <property name="hexpand">1</property>
-        <property name="vexpand">1</property>
-        <child>
-          <object class="ScreenCastWidget" id="screen_cast_widget">
-            <property name="visible">False</property>
-            <property name="halign">fill</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkBox">
-            <property name="spacing">6</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkLabel" id="device_heading">
-                <property name="xalign">0.0</property>
-                <property name="margin_bottom">12</property>
-                <attributes>
-                  <attribute name="weight" value="bold"></attribute>
-                </attributes>
-              </object>
-            </child>
-            <child>
-              <object class="GtkFrame">
-                <property name="valign">start</property>
-                <style>
-                  <class name="view"/>
-                </style>
-                <property name="child">
-                  <object class="GtkStack">
-                    <property name="hexpand">1</property>
-                    <property name="vexpand">1</property>
-                    <property name="transition_type">crossfade</property>
+      <object class="GtkScrolledWindow">
+        <property name="hscrollbar-policy">never</property>
+        <property name="propagate-natural-height">1</property>
+        <property name="max-content-height">500</property>
+        <property name="child">
+          <object class="GtkViewport">
+            <property name="scroll-to-focus">True</property>
+            <property name="child">
+              <object class="GtkBox">
+                <property name="orientation">vertical</property>
+                <property name="margin-top">32</property>
+                <property name="margin-bottom">32</property>
+                <property name="margin-start">32</property>
+                <property name="margin-end">32</property>
+                <property name="spacing">32</property>
+                <property name="hexpand">1</property>
+                <property name="vexpand">1</property>
+                <child>
+                  <object class="ScreenCastWidget" id="screen_cast_widget">
+                    <property name="visible">False</property>
+                    <property name="halign">fill</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkBox">
+                    <property name="spacing">6</property>
+                    <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkNotebook" id="notebook_view">
-                        <property name="show_tabs">0</property>
-                        <property name="show_border">0</property>
-                        <child>
-                          <object class="GtkBox" id="box3">
-                            <property name="can_focus">0</property>
-                            <property name="orientation">vertical</property>
+                      <object class="GtkLabel" id="device_heading">
+                        <property name="xalign">0.0</property>
+                        <property name="margin_bottom">12</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"></attribute>
+                        </attributes>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkFrame">
+                        <property name="valign">start</property>
+                        <style>
+                          <class name="view"/>
+                        </style>
+                        <property name="child">
+                          <object class="GtkStack">
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
+                            <property name="transition_type">crossfade</property>
                             <child>
-                              <object class="GtkListBox" id="device_list">
-                                <property name="hexpand">1</property>
-                                <property name="vexpand">1</property>
+                              <object class="GtkNotebook" id="notebook_view">
+                                <property name="show_tabs">0</property>
+                                <property name="show_border">0</property>
+                                <child>
+                                  <object class="GtkBox" id="box3">
+                                    <property name="can_focus">0</property>
+                                    <property name="orientation">vertical</property>
+                                    <child>
+                                      <object class="GtkListBox" id="device_list">
+                                        <property name="hexpand">1</property>
+                                        <property name="vexpand">1</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
-                        </child>
+                        </property>
                       </object>
                     </child>
                   </object>
-                </property>
+                </child>
               </object>
-            </child>
+            </property>
           </object>
-        </child>
+        </property>
       </object>
     </child>
   </template>
diff --git a/src/screencastdialog.ui b/src/screencastdialog.ui
index 4df7ab7..b0fffb0 100644
--- a/src/screencastdialog.ui
+++ b/src/screencastdialog.ui
@@ -30,21 +30,33 @@
       </object>
     </child>
     <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <property name="margin-top">32</property>
-        <property name="margin-bottom">32</property>
-        <property name="margin-start">32</property>
-        <property name="margin-end">32</property>
-        <property name="hexpand">1</property>
-        <property name="vexpand">1</property>
-        <child>
-          <object class="ScreenCastWidget" id="screen_cast_widget">
-            <property name="visible">True</property>
-            <property name="hexpand">True</property>
-            <property name="halign">fill</property>
+      <object class="GtkScrolledWindow">
+        <property name="hscrollbar-policy">never</property>
+        <property name="propagate-natural-height">1</property>
+        <property name="max-content-height">500</property>
+        <property name="child">
+          <object class="GtkViewport">
+            <property name="scroll-to-focus">True</property>
+            <property name="child">
+              <object class="GtkBox">
+                <property name="orientation">vertical</property>
+                <property name="margin-top">32</property>
+                <property name="margin-bottom">32</property>
+                <property name="margin-start">32</property>
+                <property name="margin-end">32</property>
+                <property name="hexpand">1</property>
+                <property name="vexpand">1</property>
+                <child>
+                  <object class="ScreenCastWidget" id="screen_cast_widget">
+                    <property name="visible">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="halign">fill</property>
+                  </object>
+                </child>
+              </object>
+            </property>
           </object>
-        </child>
+        </property>
       </object>
     </child>
   </template>
diff --git a/src/screencastwidget.c b/src/screencastwidget.c
index ce74e39..6fcc763 100644
--- a/src/screencastwidget.c
+++ b/src/screencastwidget.c
@@ -50,7 +50,6 @@ struct _ScreenCastWidget
 
   GtkWidget *window_heading;
   GtkWidget *window_list;
-  GtkWidget *window_list_scrolled;
 
   GtkWidget *virtual_heading;
   GtkWidget *virtual_switch;
@@ -468,7 +467,6 @@ screen_cast_widget_class_init (ScreenCastWidgetClass *klass)
   gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, monitor_list);
   gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, window_heading);
   gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, window_list);
-  gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, window_list_scrolled);
   gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, virtual_heading);
   gtk_widget_class_bind_template_child (widget_class, ScreenCastWidget, virtual_switch);
 
@@ -479,18 +477,11 @@ screen_cast_widget_class_init (ScreenCastWidgetClass *klass)
 static void
 screen_cast_widget_init (ScreenCastWidget *widget)
 {
-  GtkScrolledWindow *scrolled_window;
-  GtkAdjustment *vadjustment;
-
   gtk_widget_init_template (GTK_WIDGET (widget));
 
   screen_cast_widget_set_app_id (widget, NULL);
   screen_cast_widget_set_allow_multiple (widget, FALSE);
 
-  scrolled_window = GTK_SCROLLED_WINDOW (widget->window_list_scrolled);
-  vadjustment = gtk_scrolled_window_get_vadjustment (scrolled_window);
-  gtk_list_box_set_adjustment (GTK_LIST_BOX (widget->window_list), vadjustment);
-
   g_signal_connect (widget->source_type, "notify::visible-child",
                     G_CALLBACK (on_stack_switch),
                     widget);
diff --git a/src/screencastwidget.ui b/src/screencastwidget.ui
index fe0854b..0be6098 100644
--- a/src/screencastwidget.ui
+++ b/src/screencastwidget.ui
@@ -36,19 +36,13 @@
                 </child>
 
                 <child>
-                  <object class="GtkScrolledWindow" id="window_list_scrolled">
-                    <property name="propagate-natural-height">1</property>
-                    <property name="max-content-height">500</property>
-                    <property name="child">
-                      <object class="GtkListBox" id="window_list">
-                        <property name="hexpand">1</property>
-                        <property name="vexpand">1</property>
-                        <property name="valign">start</property>
-                        <style>
-                          <class name="content" />
-                        </style>
-                      </object>
-                    </property>
+                  <object class="GtkListBox" id="window_list">
+                    <property name="hexpand">1</property>
+                    <property name="vexpand">1</property>
+                    <property name="valign">start</property>
+                    <style>
+                      <class name="content" />
+                    </style>
                   </object>
                 </child>
               </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]