[gnome-control-center/gbsneto/gtk4: 27/38] sharing: Port to GTK4




commit 829804ca16c7657624ba92766fd57efb1ceee665
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 21 20:03:06 2021 -0300

    sharing: Port to GTK4
    
    Again, it was easier to just switch some of the code to use
    AdwActionRow, and that's what I've done in this commit.

 panels/meson.build                    |   2 +-
 panels/sharing/cc-sharing-networks.c  | 104 ++-----
 panels/sharing/cc-sharing-networks.h  |   4 +-
 panels/sharing/cc-sharing-networks.ui |  28 +-
 panels/sharing/cc-sharing-panel.c     | 263 +++++++---------
 panels/sharing/cc-sharing-panel.ui    | 567 ++++++++++------------------------
 panels/sharing/cc-sharing-switch.c    | 135 --------
 panels/sharing/cc-sharing-switch.h    |  31 --
 panels/sharing/meson.build            |   1 -
 shell/cc-panel-loader.c               |   4 +-
 10 files changed, 304 insertions(+), 835 deletions(-)
---
diff --git a/panels/meson.build b/panels/meson.build
index af5d9a68c..b49f25655 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -23,7 +23,7 @@ panels = [
 #  'region',
   'removable-media',
   'search',
-#  'sharing',
+  'sharing',
   'sound',
   'universal-access',
   'usage',
diff --git a/panels/sharing/cc-sharing-networks.c b/panels/sharing/cc-sharing-networks.c
index 39ebf7678..c7beac1fb 100644
--- a/panels/sharing/cc-sharing-networks.c
+++ b/panels/sharing/cc-sharing-networks.c
@@ -19,22 +19,20 @@
 
 #include "config.h"
 
-#include <gtk/gtk.h>
+#include <adwaita.h>
 #include <gio/gio.h>
 #include <glib/gi18n.h>
 
 #include "cc-sharing-networks.h"
 #include "org.gnome.SettingsDaemon.Sharing.h"
 #include "gsd-sharing-enums.h"
-#include "list-box-helper.h"
 
 struct _CcSharingNetworks {
-  GtkGrid parent_instance;
+  GtkBox parent_instance;
 
   GtkWidget *listbox;
 
   GtkWidget *current_row;
-  GtkWidget *current_label;
   GtkWidget *current_icon;
   GtkWidget *current_switch;
 
@@ -48,7 +46,7 @@ struct _CcSharingNetworks {
 };
 
 
-G_DEFINE_TYPE (CcSharingNetworks, cc_sharing_networks, GTK_TYPE_GRID)
+G_DEFINE_TYPE (CcSharingNetworks, cc_sharing_networks, GTK_TYPE_BOX)
 
 enum {
   PROP_0,
@@ -115,7 +113,6 @@ cc_sharing_update_networks (CcSharingNetworks *self)
     g_dbus_proxy_set_cached_property (G_DBUS_PROXY (self->proxy),
                                      "SharingStatus",
                                      g_variant_new_uint32 (GSD_SHARING_STATUS_OFFLINE));
-    cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
     return;
   }
 
@@ -130,7 +127,6 @@ cc_sharing_update_networks (CcSharingNetworks *self)
     self->networks = g_list_prepend (self->networks, net);
   }
   self->networks = g_list_reverse (self->networks);
-  cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
 }
 
 static void
@@ -203,15 +199,10 @@ cc_sharing_networks_new_row (const char        *uuid,
                             const char        *carrier_type,
                             CcSharingNetworks *self)
 {
-  GtkWidget *row, *box, *w;
+  GtkWidget *row, *w;
   const char *icon_name;
 
-  row = gtk_list_box_row_new ();
-  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_widget_show (box);
-  gtk_container_set_border_width (GTK_CONTAINER (box), 3);
-  gtk_widget_set_margin_start (box, 6);
-  gtk_container_add (GTK_CONTAINER (row), box);
+  row = adw_action_row_new ();
 
   if (g_strcmp0 (carrier_type, "802-11-wireless") == 0) {
     icon_name = "network-wireless-offline-symbolic";
@@ -221,26 +212,14 @@ cc_sharing_networks_new_row (const char        *uuid,
     icon_name = "network-wired-symbolic";
   }
 
-  w = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
-  gtk_widget_show (w);
-  gtk_widget_set_margin_end (w, 12);
-  gtk_container_add (GTK_CONTAINER (box), w);
-
-  /* Label */
-  w = gtk_label_new (network_name);
-  gtk_widget_show (w);
-  gtk_widget_set_margin_end (w, 12);
-  gtk_container_add (GTK_CONTAINER (box), w);
+  adw_action_row_set_icon_name (ADW_ACTION_ROW (row), icon_name);
+  adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->current_row), network_name);
 
   /* Remove button */
-  w = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
-  gtk_widget_show (w);
-  gtk_button_set_relief (GTK_BUTTON (w), GTK_RELIEF_NONE);
-  gtk_widget_set_margin_top (w, 3);
-  gtk_widget_set_margin_bottom (w, 3);
-  gtk_widget_set_margin_end (w, 12);
+  w = gtk_button_new_from_icon_name ("window-close-symbolic");
+  gtk_widget_add_css_class (w, "flat");
   gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
-  gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
+  adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
   g_signal_connect_object (G_OBJECT (w), "clicked",
                            G_CALLBACK (cc_sharing_networks_remove_network), self, G_CONNECT_SWAPPED);
   g_object_set_data (G_OBJECT (w), "row", row);
@@ -253,36 +232,18 @@ cc_sharing_networks_new_row (const char        *uuid,
 static GtkWidget *
 cc_sharing_networks_new_current_row (CcSharingNetworks *self)
 {
-  GtkWidget *row, *box, *w;
+  GtkWidget *row, *w;
 
-  row = gtk_list_box_row_new ();
-  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_widget_show (box);
-  gtk_container_set_border_width (GTK_CONTAINER (box), 3);
-  gtk_widget_set_margin_start (box, 6);
-  gtk_container_add (GTK_CONTAINER (row), box);
+  row = adw_action_row_new ();
 
   /* Icon */
-  w = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (w);
-  gtk_widget_set_margin_end (w, 12);
-  gtk_container_add (GTK_CONTAINER (box), w);
+  w = gtk_image_new_from_icon_name ("image-missing");
+  adw_action_row_add_prefix (ADW_ACTION_ROW (row), w);
   self->current_icon = w;
 
-  /* Label */
-  w = gtk_label_new ("");
-  gtk_widget_show (w);
-  gtk_container_add (GTK_CONTAINER (box), w);
-  gtk_widget_set_margin_end (w, 12);
-  self->current_label = w;
-
   w = gtk_switch_new ();
-  gtk_widget_show (w);
-  gtk_widget_set_margin_top (w, 3);
-  gtk_widget_set_margin_bottom (w, 3);
-  gtk_widget_set_margin_end (w, 12);
   gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
-  gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
+  adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
   g_signal_connect_object (G_OBJECT (w), "state-set",
                            G_CALLBACK (cc_sharing_networks_enable_network), self, G_CONNECT_SWAPPED);
   self->current_switch = w;
@@ -298,17 +259,14 @@ cc_sharing_networks_new_no_network_row (CcSharingNetworks *self)
 
   row = gtk_list_box_row_new ();
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_widget_show (box);
-  gtk_container_set_border_width (GTK_CONTAINER (box), 12);
-  gtk_container_add (GTK_CONTAINER (row), box);
+  gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
 
   /* Label */
   w = gtk_label_new (_("No networks selected for sharing"));
-  gtk_widget_show (w);
   gtk_widget_set_hexpand (w, TRUE);
   gtk_widget_set_halign (w, GTK_ALIGN_CENTER);
   gtk_style_context_add_class (gtk_widget_get_style_context (w), "dim-label");
-  gtk_container_add (GTK_CONTAINER (box), w);
+  gtk_box_append (GTK_BOX (box), w);
 
   return row;
 }
@@ -316,18 +274,17 @@ cc_sharing_networks_new_no_network_row (CcSharingNetworks *self)
 static void
 cc_sharing_update_networks_box (CcSharingNetworks *self)
 {
+  GtkWidget *child;
   gboolean current_visible;
   const char *current_network;
-  g_autoptr(GList) children = NULL;
   GList *l;
 
-  children = gtk_container_get_children (GTK_CONTAINER (self->listbox));
-  for (l = children; l != NULL; l = l->next) {
-    GtkWidget *row = l->data;
-
-    if (row != self->current_row &&
-       row != self->no_network_row)
-      gtk_widget_destroy (row);
+  child = gtk_widget_get_first_child (self->listbox);
+  while (child) {
+    GtkWidget *next = gtk_widget_get_next_sibling (child);
+    if (child != self->current_row && child != self->no_network_row)
+      gtk_list_box_remove (GTK_LIST_BOX (self->listbox), child);
+    child = next;
   }
 
   current_network = gsd_sharing_get_current_network (self->proxy);
@@ -344,7 +301,8 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
     g_object_set_data_full (G_OBJECT (self->current_row),
                            "uuid", g_strdup (current_network), g_free);
     current_network_name = gsd_sharing_get_current_network_name (self->proxy);
-    gtk_label_set_label (GTK_LABEL (self->current_label), current_network_name);
+    if (ADW_IS_PREFERENCES_ROW (self->current_row))
+      adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->current_row), current_network_name);
 
     /* Icon */
     carrier_type = gsd_sharing_get_carrier_type (self->proxy);
@@ -355,7 +313,7 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
     } else {
       icon_name = "network-wired-symbolic";
     }
-    gtk_image_set_from_icon_name (GTK_IMAGE (self->current_icon), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
+    gtk_image_set_from_icon_name (GTK_IMAGE (self->current_icon), icon_name);
 
     /* State */
     available = gsd_sharing_get_sharing_status (self->proxy) == GSD_SHARING_STATUS_AVAILABLE;
@@ -395,8 +353,6 @@ cc_sharing_update_networks_box (CcSharingNetworks *self)
   }
 
   cc_sharing_networks_update_status (self);
-
-  cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->listbox));
 }
 
 static void
@@ -415,12 +371,6 @@ cc_sharing_networks_constructed (GObject *object)
 
   self = CC_SHARING_NETWORKS (object);
 
-  gtk_list_box_set_header_func (GTK_LIST_BOX (self->listbox),
-                               cc_list_box_update_header_func, NULL,
-                               NULL);
-
-  cc_list_box_setup_scrolling (GTK_LIST_BOX (self->listbox), 3);
-
   self->current_row = cc_sharing_networks_new_current_row (self);
   gtk_list_box_insert (GTK_LIST_BOX (self->listbox), self->current_row, -1);
   g_object_set_data (G_OBJECT (self), "switch", self->current_switch);
diff --git a/panels/sharing/cc-sharing-networks.h b/panels/sharing/cc-sharing-networks.h
index 03918ab04..f44567ebf 100644
--- a/panels/sharing/cc-sharing-networks.h
+++ b/panels/sharing/cc-sharing-networks.h
@@ -19,12 +19,12 @@
 
 #pragma once
 
-#include <gtk/gtkgrid.h>
+#include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
 #define CC_TYPE_SHARING_NETWORKS (cc_sharing_networks_get_type ())
-G_DECLARE_FINAL_TYPE (CcSharingNetworks, cc_sharing_networks, CC, SHARING_NETWORKS, GtkGrid)
+G_DECLARE_FINAL_TYPE (CcSharingNetworks, cc_sharing_networks, CC, SHARING_NETWORKS, GtkBox)
 
 typedef enum {
   CC_SHARING_STATUS_UNSET,
diff --git a/panels/sharing/cc-sharing-networks.ui b/panels/sharing/cc-sharing-networks.ui
index d646d322d..5703441df 100644
--- a/panels/sharing/cc-sharing-networks.ui
+++ b/panels/sharing/cc-sharing-networks.ui
@@ -2,52 +2,30 @@
 <!-- Generated with glade 3.18.1 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
-  <template class="CcSharingNetworks" parent="GtkGrid">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
+  <template class="CcSharingNetworks" parent="GtkBox">
     <property name="margin_start">0</property>
     <property name="margin_end">0</property>
     <property name="margin_top">12</property>
     <property name="margin_bottom">12</property>
-    <property name="row_spacing">12</property>
-    <property name="column_spacing">6</property>
+    <property name="spacing">12</property>
+    <property name="orientation">vertical</property>
     <child>
       <object class="GtkLabel" id="label15">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="xalign">0</property>
         <property name="label" translatable="yes">Networks</property>
         <attributes>
           <attribute name="weight" value="bold"/>
         </attributes>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-        <property name="width">2</property>
-      </packing>
     </child>
     <child>
       <object class="GtkFrame" id="shared-networks-frame">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
         <property name="hexpand">True</property>
-        <property name="shadow_type">in</property>
         <child>
           <object class="GtkListBox" id="listbox">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
           </object>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
-      <placeholder/>
     </child>
   </template>
 </interface>
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index 0cdafe654..274ba754f 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -21,19 +21,18 @@
 
 #include "cc-sharing-panel.h"
 #include "cc-hostname-entry.h"
+#include "cc-list-row.h"
 
-#include "list-box-helper.h"
 #include "cc-sharing-resources.h"
 #include "cc-remote-login.h"
 #include "file-share-properties.h"
 #include "cc-media-sharing.h"
 #include "cc-sharing-networks.h"
-#include "cc-sharing-switch.h"
 #include "cc-gnome-remote-desktop.h"
 #include "org.gnome.SettingsDaemon.Sharing.h"
 
 #ifdef GDK_WINDOWING_WAYLAND
-#include <gdk/gdkwayland.h>
+#include <gdk/wayland/gdkwayland.h>
 #endif
 #include <glib/gi18n.h>
 #include <config.h>
@@ -145,25 +144,25 @@ cc_sharing_panel_dispose (GObject *object)
 
   if (self->media_sharing_dialog)
     {
-      gtk_widget_destroy (self->media_sharing_dialog);
+      gtk_window_destroy (GTK_WINDOW (self->media_sharing_dialog));
       self->media_sharing_dialog = NULL;
     }
 
   if (self->personal_file_sharing_dialog)
     {
-      gtk_widget_destroy (self->personal_file_sharing_dialog);
+      gtk_window_destroy (GTK_WINDOW (self->personal_file_sharing_dialog));
       self->personal_file_sharing_dialog = NULL;
     }
 
   if (self->remote_login_dialog)
     {
-      gtk_widget_destroy (self->remote_login_dialog);
+      gtk_window_destroy (GTK_WINDOW (self->remote_login_dialog));
       self->remote_login_dialog = NULL;
     }
 
   if (self->screen_sharing_dialog)
     {
-      gtk_widget_destroy (self->screen_sharing_dialog);
+      gtk_window_destroy (GTK_WINDOW (self->screen_sharing_dialog));
       self->screen_sharing_dialog = NULL;
     }
 
@@ -224,6 +223,7 @@ cc_sharing_panel_class_init (CcSharingPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, shared_folders_listbox);
   gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, show_password_checkbutton);
 
+  g_type_ensure (CC_TYPE_LIST_ROW);
   g_type_ensure (CC_TYPE_HOSTNAME_ENTRY);
 }
 
@@ -244,7 +244,7 @@ cc_sharing_panel_run_dialog (CcSharingPanel *self,
   parent = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)));
 
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
-  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_window_present (GTK_WINDOW (dialog));
 }
 
 static void
@@ -379,42 +379,33 @@ cc_sharing_panel_bind_switch_to_widgets (GtkWidget *gtkswitch,
 }
 
 static void
-cc_sharing_panel_add_folder (CcSharingPanel *self,
-                             GtkListBoxRow  *row)
+on_add_folder_dialog_response_cb (GtkDialog      *dialog,
+                                  gint            response,
+                                  CcSharingPanel *self)
 {
-  GtkWidget *dialog;
   g_autofree gchar *folder = NULL;
+  g_autoptr(GFile) file = NULL;
+  GtkWidget *child;
   gboolean matching = FALSE;
-  GList *rows, *l;
+  gint n_rows = 0;
 
-  if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-add")))
-    return;
-
-  dialog = gtk_file_chooser_dialog_new (_("Choose a Folder"),
-                                        GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET 
(self->shared_folders_listbox))),
-                                        GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
-                                        _("_Open"), GTK_RESPONSE_ACCEPT,
-                                        NULL);
-  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
-  if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
+  if (response != GTK_RESPONSE_ACCEPT)
     goto bail;
 
-  gtk_widget_hide (dialog);
-
-  rows = gtk_container_get_children (GTK_CONTAINER (self->shared_folders_listbox));
-
-  folder = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+  file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+  folder = g_file_get_uri (file);
   if (!folder || g_str_equal (folder, ""))
     goto bail;
 
   g_debug ("Trying to add %s", folder);
 
-  for (l = rows; l != NULL; l = l->next)
+  for (child = gtk_widget_get_first_child (self->shared_folders_listbox);
+       child;
+       child = gtk_widget_get_next_sibling (child))
     {
       const char *string;
 
-      string = g_object_get_data (G_OBJECT (l->data), "path");
+      string = g_object_get_data (G_OBJECT (child), "path");
       matching = (g_strcmp0 (string, folder) == 0);
 
       if (matching)
@@ -422,22 +413,45 @@ cc_sharing_panel_add_folder (CcSharingPanel *self,
           g_debug ("Found a duplicate for %s", folder);
           break;
         }
+
+      n_rows++;
     }
 
   if (!matching)
     {
-      GtkWidget *row;
-      int i;
+      GtkWidget *row = cc_sharing_panel_new_media_sharing_row (folder, self);
 
-      row = cc_sharing_panel_new_media_sharing_row (folder, self);
-      i = g_list_length (rows);
-      gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox), row, i - 1);
-      gtk_widget_set_visible (row, TRUE);
+      gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox),
+                           row,
+                           n_rows - 1);
     }
-  cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->shared_folders_listbox));
 
 bail:
-  gtk_widget_destroy (dialog);
+  gtk_window_destroy (GTK_WINDOW (dialog));
+}
+
+static void
+cc_sharing_panel_add_folder (CcSharingPanel *self,
+                             GtkListBoxRow  *row)
+{
+  GtkWidget *dialog;
+
+  if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-add")))
+    return;
+
+  dialog = gtk_file_chooser_dialog_new (_("Choose a Folder"),
+                                        GTK_WINDOW (self->media_sharing_dialog),
+                                        GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+                                        _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                        _("_Open"), GTK_RESPONSE_ACCEPT,
+                                        NULL);
+
+  g_signal_connect_object (dialog,
+                           "response",
+                           G_CALLBACK (on_add_folder_dialog_response_cb),
+                           self,
+                           0);
+  gtk_window_present (GTK_WINDOW (dialog));
 }
 
 static void
@@ -447,8 +461,7 @@ cc_sharing_panel_remove_folder (CcSharingPanel *self,
   GtkWidget *row;
 
   row = g_object_get_data (G_OBJECT (button), "row");
-  gtk_widget_destroy (row);
-  cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->shared_folders_listbox));
+  gtk_list_box_remove (GTK_LIST_BOX (self->shared_folders_listbox), row);
 }
 
 static void
@@ -456,18 +469,17 @@ cc_sharing_panel_media_sharing_dialog_response (CcSharingPanel *self,
                                                 gint            reponse_id)
 {
   g_autoptr(GPtrArray) folders = NULL;
-  GtkWidget *box;
-  GList *rows, *l;
+  GtkWidget *child;
 
-  box = self->shared_folders_listbox;
-  rows = gtk_container_get_children (GTK_CONTAINER (box));
   folders = g_ptr_array_new_with_free_func (g_free);
 
-  for (l = rows; l != NULL; l = l->next)
+  for (child = gtk_widget_get_first_child (self->shared_folders_listbox);
+       child;
+       child = gtk_widget_get_next_sibling (child))
     {
       const char *folder;
 
-      folder = g_object_get_data (G_OBJECT (l->data), "path");
+      folder = g_object_get_data (G_OBJECT (child), "path");
       if (folder == NULL)
         continue;
       g_ptr_array_add (folders, g_strdup (folder));
@@ -518,7 +530,7 @@ static GtkWidget *
 cc_sharing_panel_new_media_sharing_row (const char     *uri_or_path,
                                         CcSharingPanel *self)
 {
-  GtkWidget *row, *box, *w;
+  GtkWidget *row, *w;
   GUserDirectory dir = G_USER_N_DIRECTORIES;
   g_autoptr(GIcon) icon = NULL;
   guint i;
@@ -529,12 +541,7 @@ cc_sharing_panel_new_media_sharing_row (const char     *uri_or_path,
   file = g_file_new_for_commandline_arg (uri_or_path);
   path = g_file_get_path (file);
 
-  row = gtk_list_box_row_new ();
-  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_widget_show (box);
-  gtk_container_set_border_width (GTK_CONTAINER (box), 3);
-  gtk_widget_set_margin_start (box, 6);
-  gtk_container_add (GTK_CONTAINER (row), box);
+  row = adw_action_row_new ();
 
   /* Find the icon and create it */
   for (i = 0; i < G_USER_N_DIRECTORIES; i++)
@@ -547,26 +554,18 @@ cc_sharing_panel_new_media_sharing_row (const char     *uri_or_path,
     }
 
   icon = special_directory_get_gicon (dir);
-  w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
-  gtk_widget_show (w);
-  gtk_widget_set_margin_end (w, 12);
-  gtk_container_add (GTK_CONTAINER (box), w);
+  adw_action_row_add_prefix (ADW_ACTION_ROW (row),
+                             gtk_image_new_from_gicon (icon));
 
   /* Label */
   basename = g_filename_display_basename (path);
-  w = gtk_label_new (basename);
-  gtk_widget_show (w);
-  gtk_container_add (GTK_CONTAINER (box), w);
+  adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), basename);
 
   /* Remove button */
-  w = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
-  gtk_widget_show (w);
-  gtk_button_set_relief (GTK_BUTTON (w), GTK_RELIEF_NONE);
-  gtk_widget_set_margin_top (w, 3);
-  gtk_widget_set_margin_bottom (w, 3);
-  gtk_widget_set_margin_end (w, 12);
+  w = gtk_button_new_from_icon_name ("window-close-symbolic");
+  gtk_widget_add_css_class (w, "flat");
   gtk_widget_set_valign (w, GTK_ALIGN_CENTER);
-  gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);
+  adw_action_row_add_suffix (ADW_ACTION_ROW (row), w);
   g_signal_connect_object (G_OBJECT (w), "clicked",
                            G_CALLBACK (cc_sharing_panel_remove_folder), self, G_CONNECT_SWAPPED);
   g_object_set_data (G_OBJECT (w), "row", row);
@@ -583,16 +582,13 @@ cc_sharing_panel_new_add_media_sharing_row (CcSharingPanel *self)
 
   row = gtk_list_box_row_new ();
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_widget_show (box);
-  gtk_container_set_border_width (GTK_CONTAINER (box), 3);
-  gtk_container_add (GTK_CONTAINER (row), box);
+  gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
 
-  w = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR);
-  gtk_widget_show (w);
-  gtk_container_add (GTK_CONTAINER (box), w);
+  w = gtk_image_new_from_icon_name ("list-add-symbolic");
   gtk_widget_set_hexpand (w, TRUE);
-  gtk_widget_set_margin_top (w, 6);
-  gtk_widget_set_margin_bottom (w, 6);
+  gtk_widget_set_margin_top (w, 12);
+  gtk_widget_set_margin_bottom (w, 12);
+  gtk_box_append (GTK_BOX (box), w);
 
   g_object_set_data (G_OBJECT (w), "row", row);
 
@@ -601,6 +597,19 @@ cc_sharing_panel_new_add_media_sharing_row (CcSharingPanel *self)
   return row;
 }
 
+static GtkWidget *
+create_switch_with_bindings (GtkSwitch *from)
+{
+  GtkWidget *new_switch = gtk_switch_new ();
+
+  g_object_bind_property (from, "visible", new_switch, "visible", G_BINDING_SYNC_CREATE | 
G_BINDING_BIDIRECTIONAL);
+  g_object_bind_property (from, "state", new_switch, "state", G_BINDING_SYNC_CREATE | 
G_BINDING_BIDIRECTIONAL);
+  g_object_bind_property (from, "active", new_switch, "active", G_BINDING_SYNC_CREATE | 
G_BINDING_BIDIRECTIONAL);
+  g_object_bind_property (from, "sensitive", new_switch, "sensitive", G_BINDING_SYNC_CREATE | 
G_BINDING_BIDIRECTIONAL);
+
+  return new_switch;
+}
+
 static void
 cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
 {
@@ -622,34 +631,24 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
 
   cc_media_sharing_get_preferences (&folders);
 
-  gtk_list_box_set_header_func (GTK_LIST_BOX (self->shared_folders_listbox),
-                                cc_list_box_update_header_func, NULL,
-                                NULL);
-  cc_list_box_setup_scrolling (GTK_LIST_BOX (self->shared_folders_listbox), 3);
-
   list = folders;
   while (list && *list)
     {
       row = cc_sharing_panel_new_media_sharing_row (*list, self);
-      gtk_widget_show (row);
       gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox), row, -1);
       list++;
     }
 
   row = cc_sharing_panel_new_add_media_sharing_row (self);
-  gtk_widget_show (row);
-  gtk_list_box_insert (GTK_LIST_BOX (self->shared_folders_listbox), row, -1);
-
-  cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->shared_folders_listbox));
+  gtk_list_box_append (GTK_LIST_BOX (self->shared_folders_listbox), row);
 
   g_signal_connect_object (self->shared_folders_listbox, "row-activated",
                            G_CALLBACK (cc_sharing_panel_add_folder), self, G_CONNECT_SWAPPED);
 
   networks = cc_sharing_networks_new (self->sharing_proxy, "rygel");
   gtk_grid_attach (GTK_GRID (self->shared_folders_grid), networks, 0, 4, 2, 1);
-  gtk_widget_show (networks);
 
-  w = cc_sharing_switch_new (networks);
+  w = create_switch_with_bindings (GTK_SWITCH (g_object_get_data (G_OBJECT (networks), "switch")));
   gtk_header_bar_pack_start (GTK_HEADER_BAR (self->media_sharing_headerbar), w);
   self->media_sharing_switch = w;
 
@@ -657,31 +656,6 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
                                            self->media_sharing_row);
 }
 
-static gboolean
-cc_sharing_panel_label_activate_link (GtkLabel *label,
-                                      gchar    *uri,
-                                      GtkMenu  *menu)
-{
-  gtk_menu_popup_at_pointer (menu, NULL);
-
-  g_object_set_data_full (G_OBJECT (menu), "uri-text", g_strdup (uri), g_free);
-
-  return TRUE;
-}
-
-static void
-copy_uri_to_clipboard (GtkMenuItem *item,
-                       GtkMenu     *menu)
-{
-  GtkClipboard *clipboard;
-  const gchar *text;
-
-  text = g_object_get_data (G_OBJECT (menu), "uri-text");
-
-  clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
-  gtk_clipboard_set_text (clipboard, text, -1);
-}
-
 static void
 cc_sharing_panel_setup_label (CcSharingPanel *self,
                               GtkWidget      *label,
@@ -802,31 +776,10 @@ cc_sharing_panel_bus_ready (GObject         *object,
 static void
 cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self,
                                             GtkWidget      *label)
+
 {
-  GtkWidget *menu;
-  GtkWidget *menu_item;
   GetHostNameData *get_hostname_data;
 
-  /* create the menu */
-  menu = gtk_menu_new ();
-
-  menu_item = gtk_menu_item_new_with_label (_("Copy"));
-  gtk_widget_show (menu_item);
-
-  g_signal_connect (menu_item, "activate", G_CALLBACK (copy_uri_to_clipboard),
-                    menu);
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-
-  /* show the menu when the link is activated */
-  g_signal_connect (label, "activate-link",
-                    G_CALLBACK (cc_sharing_panel_label_activate_link), menu);
-
-  /* destroy the menu when the label is destroyed */
-  g_signal_connect_swapped (label, "destroy", G_CALLBACK (gtk_widget_destroy),
-                            menu);
-
-
   /* set the hostname */
   get_hostname_data = g_new (GetHostNameData, 1);
   get_hostname_data->panel = self;
@@ -864,7 +817,7 @@ file_sharing_set_require_password (const GValue       *value,
 static void
 file_sharing_password_changed (GtkEntry *entry)
 {
-  file_share_write_out_password (gtk_entry_get_text (entry));
+  file_share_write_out_password (gtk_editable_get_text (GTK_EDITABLE (entry)));
 }
 
 static void
@@ -882,8 +835,8 @@ cc_sharing_panel_setup_personal_file_sharing_dialog (CcSharingPanel *self)
                                               self->personal_file_sharing_label);
 
   /* the password cannot be read, so just make sure the entry is not empty */
-  gtk_entry_set_text (GTK_ENTRY (self->personal_file_sharing_password_entry),
-                      "password");
+  gtk_editable_set_text (GTK_EDITABLE (self->personal_file_sharing_password_entry),
+                         "password");
 
   settings = g_settings_new (FILE_SHARING_SCHEMA_ID);
   g_settings_bind_with_mapping (settings, "require-password",
@@ -899,9 +852,8 @@ cc_sharing_panel_setup_personal_file_sharing_dialog (CcSharingPanel *self)
 
   networks = cc_sharing_networks_new (self->sharing_proxy, "gnome-user-share-webdav");
   gtk_grid_attach (GTK_GRID (self->personal_file_sharing_grid), networks, 0, 3, 2, 1);
-  gtk_widget_show (networks);
 
-  w = cc_sharing_switch_new (networks);
+  w = create_switch_with_bindings (GTK_SWITCH (g_object_get_data (G_OBJECT (networks), "switch")));
   gtk_header_bar_pack_start (GTK_HEADER_BAR (self->personal_file_sharing_headerbar), w);
   self->personal_file_sharing_switch = w;
 
@@ -954,23 +906,23 @@ cc_sharing_panel_check_schema_available (CcSharingPanel *self,
 static void
 screen_sharing_show_cb (CcSharingPanel *self)
 {
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_checkbutton),
-                                FALSE);
+  gtk_check_button_set_active (GTK_CHECK_BUTTON (self->show_password_checkbutton),
+                               FALSE);
 }
 
 static void
 screen_sharing_hide_cb (CcSharingPanel *self)
 {
-  GtkToggleButton *ac_radio;
+  GtkCheckButton *ac_radio;
   GtkEntry    *pw_entry;
   const gchar *password;
 
-  ac_radio = GTK_TOGGLE_BUTTON (self->approve_connections_radiobutton);
+  ac_radio = GTK_CHECK_BUTTON (self->approve_connections_radiobutton);
   pw_entry = GTK_ENTRY (self->remote_control_password_entry);
-  password = gtk_entry_get_text (pw_entry);
+  password = gtk_editable_get_text (GTK_EDITABLE (pw_entry));
 
   if (password == NULL || *password == '\0')
-    gtk_toggle_button_set_active (ac_radio, TRUE);
+    gtk_check_button_set_active (ac_radio, TRUE);
 }
 
 #define MAX_PASSWORD_SIZE 8
@@ -1007,7 +959,8 @@ screen_sharing_password_insert_text_cb (CcSharingPanel *self,
 static void
 on_vnc_password_entry_notify_text (CcSharingPanel *self)
 {
-  cc_grd_store_vnc_password (gtk_entry_get_text (GTK_ENTRY (self->remote_control_password_entry)), 
cc_panel_get_cancellable (CC_PANEL (self)));
+  const char *password = gtk_editable_get_text (GTK_EDITABLE (self->remote_control_password_entry));
+  cc_grd_store_vnc_password (password, cc_panel_get_cancellable (CC_PANEL (self)));
 }
 
 static void
@@ -1042,7 +995,7 @@ cc_sharing_panel_setup_screen_sharing_dialog_gnome_remote_desktop (CcSharingPane
 
   password = cc_grd_lookup_vnc_password (cc_panel_get_cancellable (CC_PANEL (self)));
   if (password != NULL)
-    gtk_entry_set_text (GTK_ENTRY (self->remote_control_password_entry), password);
+    gtk_editable_set_text (GTK_EDITABLE (self->remote_control_password_entry), password);
 
   /* accept at most 8 bytes in password entry */
   g_signal_connect_object (self->remote_control_password_entry,
@@ -1087,10 +1040,9 @@ cc_sharing_panel_setup_screen_sharing_dialog_gnome_remote_desktop (CcSharingPane
                            G_CONNECT_SWAPPED);
 
   networks = cc_sharing_networks_new (self->sharing_proxy, "gnome-remote-desktop");
-  gtk_box_pack_end (GTK_BOX (self->remote_control_box), networks, TRUE, TRUE, 0);
-  gtk_widget_show (networks);
+  gtk_box_append (GTK_BOX (self->remote_control_box), networks);
 
-  w = cc_sharing_switch_new (networks);
+  w = create_switch_with_bindings (GTK_SWITCH (g_object_get_data (G_OBJECT (networks), "switch")));
   gtk_header_bar_pack_start (GTK_HEADER_BAR (self->screen_sharing_headerbar), w);
   self->screen_sharing_switch = w;
 
@@ -1190,19 +1142,16 @@ cc_sharing_panel_init (CcSharingPanel *self)
 
   gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (self->main_list_box),
                                              TRUE);
-  gtk_list_box_set_header_func (GTK_LIST_BOX (self->main_list_box),
-                                cc_list_box_update_header_func,
-                                NULL, NULL);
 
   /* create the master switch */
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_widget_show (box);
 
   self->master_switch = gtk_switch_new ();
-  gtk_widget_show (self->master_switch);
-  atk_object_set_name (ATK_OBJECT (gtk_widget_get_accessible (self->master_switch)), _("Sharing"));
   gtk_widget_set_valign (self->master_switch, GTK_ALIGN_CENTER);
-  gtk_box_pack_start (GTK_BOX (box), self->master_switch, FALSE, FALSE, 4);
+  gtk_accessible_update_property (GTK_ACCESSIBLE (self->master_switch),
+                                  GTK_ACCESSIBLE_PROPERTY_LABEL, _("Sharing"),
+                                  -1);
+  gtk_box_append (GTK_BOX (box), self->master_switch);
 
   /* start the panel in the disabled state */
   gtk_switch_set_active (GTK_SWITCH (self->master_switch), FALSE);
diff --git a/panels/sharing/cc-sharing-panel.ui b/panels/sharing/cc-sharing-panel.ui
index 40a112ab3..7381528bd 100644
--- a/panels/sharing/cc-sharing-panel.ui
+++ b/panels/sharing/cc-sharing-panel.ui
@@ -3,126 +3,75 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <template class="CcSharingPanel" parent="CcPanel">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
     <child>
       <object class="GtkScrolledWindow" id="sharing_panel">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
         <property name="hscrollbar-policy">never</property>
         <child>
-          <object class="HdyClamp">
-            <property name="visible">True</property>
+          <object class="AdwClamp">
             <property name="margin_top">32</property>
             <property name="margin_bottom">32</property>
             <property name="margin_start">12</property>
             <property name="margin_end">12</property>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
                 <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="label6">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="margin_bottom">12</property>
                     <property name="xalign">0</property>
                     <property name="label" translatable="yes">_Computer Name</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">hostname_entry</property>
-                    <accessibility>
-                      <relation type="label-for" target="hostname_entry"/>
-                    </accessibility>
                     <attributes>
                      <attribute name="weight" value="bold"/>
                     </attributes>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="CcHostnameEntry" id="hostname_entry">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
                     <property name="margin_bottom">32</property>
                     <property name="invisible_char">●</property>
                     <accessibility>
-                      <relation type="labelled-by" target="label6"/>
+                      <relation name="labelled-by">label6</relation>
                     </accessibility>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
                 <child>
-                  <object class="GtkFrame" id="frame1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">in</property>
+                  <object class="GtkListBox" id="main_list_box">
+                    <property name="selection-mode">none</property>
+                    <style>
+                      <class name="content" />
+                    </style>
                     <child>
-                      <object class="GtkListBox" id="main_list_box">
-                        <property name="visible">True</property>
-                        <property name="selection-mode">none</property>
-                        <child>
-                          <object class="CcListRow" id="personal_file_sharing_row">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
-                            <property name="use-underline">True</property>
-                            <property name="title" translatable="yes">_File Sharing</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="CcListRow" id="screen_sharing_row">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
-                            <property name="use-underline">True</property>
-                            <property name="title" translatable="yes">_Screen Sharing</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="CcListRow" id="media_sharing_row">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
-                            <property name="use-underline">True</property>
-                            <property name="title" translatable="yes">_Media Sharing</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="CcListRow" id="remote_login_row">
-                            <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
-                            <property name="use-underline">True</property>
-                            <property name="title" translatable="yes">_Remote Login</property>
-                          </object>
-                        </child>
+                      <object class="CcListRow" id="personal_file_sharing_row">
+                        <property name="icon-name">go-next-symbolic</property>
+                        <property name="use-underline">True</property>
+                        <property name="title" translatable="yes">_File Sharing</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcListRow" id="screen_sharing_row">
+                        <property name="icon-name">go-next-symbolic</property>
+                        <property name="use-underline">True</property>
+                        <property name="title" translatable="yes">_Screen Sharing</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcListRow" id="media_sharing_row">
+                        <property name="icon-name">go-next-symbolic</property>
+                        <property name="use-underline">True</property>
+                        <property name="title" translatable="yes">_Media Sharing</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="CcListRow" id="remote_login_row">
+                        <property name="icon-name">go-next-symbolic</property>
+                        <property name="use-underline">True</property>
+                        <property name="title" translatable="yes">_Remote Login</property>
                       </object>
                     </child>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label12">
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Some services are disabled because of no 
network access.</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">7</property>
-                  </packing>
                 </child>
               </object>
             </child>
@@ -132,21 +81,20 @@
     </child>
   </template>
   <object class="GtkDialog" id="personal_file_sharing_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
     <property name="title" translatable="yes">File Sharing</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
     <property name="use_header_bar">1</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox5">
-        <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox">
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
+        <property name="spacing">12</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
         <child>
           <object class="GtkGrid" id="personal_file_sharing_grid">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="margin_start">12</property>
             <property name="margin_end">6</property>
             <property name="margin_top">12</property>
@@ -155,193 +103,123 @@
             <property name="column_spacing">6</property>
             <child>
               <object class="GtkLabel" id="personal_file_sharing_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="label">File Sharing allows you to share your Public folder with others on 
your current network using: &lt;a href="dav://%s"&gt;dav://%s&lt;/a&gt;</property>
                 <property name="use_markup">True</property>
                 <property name="wrap">True</property>
                 <property name="max-width-chars">36</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">0</property>
+                  <property name="column-span">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkGrid" id="require_password_grid">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="row_spacing">12</property>
                 <property name="column_spacing">6</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">2</property>
+                  <property name="column-span">2</property>
+                </layout>
                 <child>
                   <object class="GtkLabel" id="label17">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="halign">start</property>
                     <property name="label" translatable="yes">_Require Password</property>
                     <property name="use_markup">True</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">personal_file_sharing_require_password_switch</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">0</property>
+                    </layout>
                   </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="personal_file_sharing_password_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="halign">start</property>
                     <property name="hexpand">True</property>
                     <property name="label" translatable="yes">_Password</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">personal_file_sharing_password_entry</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">1</property>
+                    </layout>
                   </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkSwitch" id="personal_file_sharing_require_password_switch">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
                     <property name="halign">end</property>
+                    <layout>
+                      <property name="column">1</property>
+                      <property name="row">0</property>
+                    </layout>
                   </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkEntry" id="personal_file_sharing_password_entry">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
                     <property name="visibility">False</property>
                     <property name="invisible_char">●</property>
-                    <property name="shadow_type">none</property>
                     <property name="invisible_char_set">True</property>
                     <property name="input_purpose">password</property>
+                    <layout>
+                      <property name="column">1</property>
+                      <property name="row">1</property>
+                    </layout>
                   </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">1</property>
-                    <property name="width">1</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
     <child type="titlebar">
       <object class="GtkHeaderBar" id="personal_file_sharing_headerbar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="title" translatable="yes">File Sharing</property>
-        <property name="show_close_button">True</property>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="show_title_buttons">True</property>
       </object>
     </child>
   </object>
   <object class="GtkDialog" id="remote_login_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
     <property name="title" translatable="yes">Remote Login</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
     <property name="use_header_bar">1</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox4">
-        <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox">
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
+        <property name="spacing">12</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <property name="margin">12</property>
         <child>
-          <object class="GtkBox" id="box9">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <child>
-              <object class="GtkGrid" id="grid5">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_top">12</property>
-                <property name="margin_bottom">12</property>
-                <property name="row_spacing">12</property>
-                <property name="column_spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="remote_login_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label">When remote login is enabled, remote users can connect using the 
Secure Shell command:
+          <object class="GtkLabel" id="remote_login_label">
+            <property name="xalign">0</property>
+            <property name="label">When remote login is enabled, remote users can connect using the Secure 
Shell command:
 &lt;a href="ssh %s"&gt;ssh %s&lt;/a&gt;</property>
-                    <property name="use_markup">True</property>
-                    <property name="wrap">True</property>
-                    <property name="max-width-chars">36</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">2</property>
-                    <property name="height">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
+            <property name="use_markup">True</property>
+            <property name="wrap">True</property>
+            <property name="max-width-chars">36</property>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
         <child>
           <object class="GtkBox">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
             <style>
               <class name="frame"/>
               <class name="view"/>
             </style>
             <child>
               <object class="GtkBox">
-                <property name="visible">True</property>
-                <property name="margin">12</property>
+                <property name="margin-top">12</property>
+                <property name="margin-bottom">12</property>
+                <property name="margin-start">12</property>
+                <property name="margin-end">12</property>
                 <child>
                   <object class="GtkLabel">
-                    <property name="visible">True</property>
                     <property name="label" translatable="yes">Remote Login</property>
                     <property name="hexpand">True</property>
                     <property name="xalign">0</property>
@@ -349,8 +227,6 @@
                 </child>
                 <child>
                   <object class="GtkSwitch" id="remote_login_switch">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="halign">end</property>
                   </object>
                 </child>
@@ -363,26 +239,22 @@
 
   </object>
   <object class="GtkDialog" id="screen_sharing_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
     <property name="title" translatable="yes">Screen Sharing</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
     <property name="use_header_bar">1</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
-        <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox">
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
         <child>
           <object class="GtkBox" id="box8">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkGrid" id="screen_sharing_grid">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="margin_start">12</property>
                 <property name="margin_end">6</property>
                 <property name="margin_bottom">12</property>
@@ -390,236 +262,146 @@
                 <property name="column_spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="screen_sharing_label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
                     <property name="label">Screen sharing allows remote users to view or control your screen 
by connecting to: &lt;a href="vnc://%s"&gt;vnc://%s&lt;/a&gt;</property>
                     <property name="use_markup">True</property>
                     <property name="wrap">True</property>
                     <property name="max-width-chars">36</property>
                     <property name="margin_bottom">6</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">0</property>
+                      <property name="column-span">2</property>
+                    </layout>
                   </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">0</property>
-                    <property name="width">2</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkBox" id="remote_control_box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
+                    <layout>
+                      <property name="column">0</property>
+                      <property name="row">2</property>
+                      <property name="column-span">2</property>
+                    </layout>
                     <child>
                       <object class="GtkCheckButton" id="remote_control_checkbutton">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
                         <property name="use_underline">True</property>
                         <property name="label" translatable="yes">_Allow connections to control the 
screen</property>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
                     </child>
                     <child>
                       <object class="GtkGrid" id="remote_control_grid">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
                         <property name="row_spacing">6</property>
                         <child>
                           <object class="GtkGrid" id="password_grid">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
                             <property name="row_spacing">6</property>
                             <property name="column_spacing">6</property>
+                            <layout>
+                              <property name="column">0</property>
+                              <property name="row">3</property>
+                            </layout>
                             <child>
                               <object class="GtkLabel" id="remote_control_password_label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
                                 <property name="halign">start</property>
-                                <property name="margin_left">12</property>
+                                <property name="margin_start">12</property>
                                 <property name="label" translatable="yes">_Password:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">remote_control_password_entry</property>
+                                <layout>
+                                  <property name="column">0</property>
+                                  <property name="row">0</property>
+                                </layout>
                               </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkEntry" id="remote_control_password_entry">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
                                 <property name="hexpand">True</property>
                                 <property name="visibility">False</property>
                                 <property name="invisible_char">●</property>
-                                <property name="shadow_type">none</property>
                                 <property name="input_purpose">password</property>
+                                <layout>
+                                  <property name="column">1</property>
+                                  <property name="row">0</property>
+                                </layout>
                               </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkCheckButton" id="show_password_checkbutton">
                                 <property name="label" translatable="yes">_Show Password</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="xalign">0</property>
-                                <property name="draw_indicator">True</property>
                                 <property name="use_underline">True</property>
+                                <layout>
+                                  <property name="column">1</property>
+                                  <property name="row">1</property>
+                                </layout>
                               </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">1</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <placeholder/>
                             </child>
                           </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="label2">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">Access Options</property>
+                            <layout>
+                              <property name="column">0</property>
+                              <property name="row">0</property>
+                            </layout>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
                           </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="approve_connections_radiobutton">
+                          <object class="GtkCheckButton" id="approve_connections_radiobutton">
                             <property name="label" translatable="yes">_New connections must ask for 
access</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
                             <property name="group">require_password_radiobutton</property>
                             <property name="use_underline">True</property>
+                            <layout>
+                              <property name="column">0</property>
+                              <property name="row">1</property>
+                            </layout>
                           </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="require_password_radiobutton">
+                          <object class="GtkCheckButton" id="require_password_radiobutton">
                             <property name="label" translatable="yes">_Require a password</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
                             <property name="use_underline">True</property>
+                            <layout>
+                              <property name="column">0</property>
+                              <property name="row">2</property>
+                            </layout>
                           </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
-                  <packing>
-                    <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
-                    <property name="width">2</property>
-                    <property name="height">1</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
     <child type="titlebar">
       <object class="GtkHeaderBar" id="screen_sharing_headerbar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="title" translatable="yes">Screen Sharing</property>
-        <property name="show_close_button">True</property>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="show_title_buttons">True</property>
       </object>
     </child>
   </object>
   <object class="GtkDialog" id="media_sharing_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
     <property name="title" translatable="yes">Media Sharing</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox2">
-        <property name="can_focus">False</property>
+    <property name="modal">True</property>
+    <child>
+      <object class="GtkBox">
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">12</property>
+        <property name="margin-end">12</property>
+        <property name="spacing">12</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkGrid" id="shared_folders_grid">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="margin_start">12</property>
             <property name="margin_end">6</property>
             <property name="margin_top">12</property>
@@ -628,75 +410,52 @@
             <property name="column_spacing">6</property>
             <child>
               <object class="GtkLabel" id="label13">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">Share music, photos and videos over the 
network.</property>
                 <property name="max-width-chars">36</property>
                 <property name="wrap">True</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">0</property>
+                  <property name="column-span">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-                <property name="width">2</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label15">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">Folders</property>
                 <property name="mnemonic_widget">shared_folders_listbox</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">1</property>
+                  <property name="column-span">2</property>
+                </layout>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-                <property name="width">2</property>
-              </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="shared_folders_frame">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="shadow_type">in</property>
-                <child>
-                  <object class="GtkListBox" id="shared_folders_listbox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                  </object>
-                </child>
+              <object class="GtkListBox" id="shared_folders_listbox">
+                <property name="selection-mode">none</property>
+                <style>
+                  <class name="content" />
+                </style>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">3</property>
+                  <property name="column-span">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
-                <property name="width">2</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
       </object>
     </child>
     <child type="titlebar">
       <object class="GtkHeaderBar" id="media_sharing_headerbar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="title" translatable="yes">Media Sharing</property>
-        <property name="show_close_button">True</property>
-        <child>
-          <placeholder/>
-        </child>
+        <property name="show_title_buttons">True</property>
       </object>
     </child>
   </object>
diff --git a/panels/sharing/meson.build b/panels/sharing/meson.build
index b3803bcda..035883950 100644
--- a/panels/sharing/meson.build
+++ b/panels/sharing/meson.build
@@ -42,7 +42,6 @@ sources = files(
   'cc-media-sharing.c',
   'cc-remote-login.c',
   'cc-sharing-networks.c',
-  'cc-sharing-switch.c',
   'cc-gnome-remote-desktop.c',
   'file-share-properties.c',
 )
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 290816965..9e640f35b 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -55,7 +55,7 @@ extern GType cc_power_panel_get_type (void);
 //extern GType cc_region_panel_get_type (void);
 extern GType cc_removable_media_panel_get_type (void);
 extern GType cc_search_panel_get_type (void);
-//extern GType cc_sharing_panel_get_type (void);
+extern GType cc_sharing_panel_get_type (void);
 extern GType cc_sound_panel_get_type (void);
 #ifdef BUILD_THUNDERBOLT
 //extern GType cc_bolt_panel_get_type (void);
@@ -126,7 +126,7 @@ static CcPanelLoaderVtable default_panels[] =
   //PANEL_TYPE("region",           cc_region_panel_get_type,               NULL),
   PANEL_TYPE("removable-media",  cc_removable_media_panel_get_type,      NULL),
   PANEL_TYPE("search",           cc_search_panel_get_type,               NULL),
-  //PANEL_TYPE("sharing",          cc_sharing_panel_get_type,              NULL),
+  PANEL_TYPE("sharing",          cc_sharing_panel_get_type,              NULL),
   PANEL_TYPE("sound",            cc_sound_panel_get_type,                NULL),
 #ifdef BUILD_THUNDERBOLT
   //PANEL_TYPE("thunderbolt",      cc_bolt_panel_get_type,                 NULL),


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