sharing: Fix the networks section from the File/Media Sharing dialogs

- Remove the "Networks" title from CcSharingNetworks
and only use the titles from the AdwPreferencesGroups

- Remove the margins from CcSharingNetworks,
since AdwPreferencesGroup already has margins

- Remove unused `spacing` properties

- Replace the Media Sharing GtkGrid with a GtkBox,
like in the File Sharing dialog, and separate the
networks and folders section into their own
AdwPreferencesGroups

- Remove an unnecessary GtkListBox. It was added[1]
in order to make the "Require Password" and "Password"
rows to have the boxed-list style. Since the dialogs
from Sharing panel started to use AdwPreferencesPage/Group[2],
this GtkListBox is no longer necessary.

[1] 9a15a48d
[2] 45a5a1e0

Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2818
This commit is contained in:
Automeris naranja 2024-01-30 23:13:02 -03:00 committed by Felipe Borges
parent c0c357c3bc
commit 7009df80d0
3 changed files with 18 additions and 42 deletions

View file

@ -1,21 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<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="spacing">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label15">
<property name="xalign">0</property>
<property name="label" translatable="yes">Networks</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkListBox" id="listbox">
<property name="hexpand">True</property>

View file

@ -68,7 +68,7 @@ struct _CcSharingPanel
GtkWidget *personal_file_sharing_row;
GtkWidget *personal_file_sharing_switch;
GtkWidget *shared_folders_grid;
GtkWidget *media_sharing_vbox;
GtkWidget *shared_folders_listbox;
GDBusProxy *sharing_proxy;
@ -116,7 +116,7 @@ cc_sharing_panel_class_init (CcSharingPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/sharing/cc-sharing-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, hostname_entry);
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, shared_folders_grid);
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, media_sharing_vbox);
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, main_list_box);
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, media_sharing_dialog);
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, media_sharing_enable_row);
@ -484,7 +484,7 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
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_box_append (GTK_BOX (self->media_sharing_vbox), networks);
w = create_switch_with_bindings (GTK_SWITCH (g_object_get_data (G_OBJECT (networks), "switch")));
gtk_widget_set_valign (w, GTK_ALIGN_CENTER);

View file

@ -106,15 +106,6 @@
<child>
<object class="GtkBox" id="personal_file_sharing_vbox">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
@ -168,22 +159,21 @@
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Folders</property>
<child>
<object class="GtkGrid" id="shared_folders_grid">
<property name="row_spacing">12</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkListBox" id="shared_folders_listbox">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list" />
</style>
<layout>
<property name="column">0</property>
<property name="row">3</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<object class="GtkListBox" id="shared_folders_listbox">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Networks</property>
<child>
<object class="GtkBox" id="media_sharing_vbox">
<property name="orientation">vertical</property>
</object>
</child>
</object>