[gnome-bluetooth: 2/6] settings-widget: Use a Hdycolumn
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth: 2/6] settings-widget: Use a Hdycolumn
- Date: Wed, 30 Jan 2019 09:32:31 +0000 (UTC)
commit 3a2f0e0f1eca27c4ce663d7383a26cdfbc165b32
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Sep 20 17:29:57 2018 +0200
settings-widget: Use a Hdycolumn
Put the widget's content into a HdyColumn to better manage the available
width.
This deliberately doesn't adapt the indentation of the contained widget
to help this commit to be more readable and easier to review, it will be
adapted in the next commit.
lib/bluetooth-settings-widget.c | 9 ++++++++-
lib/settings.ui | 17 +++++++++++++----
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 9cdc003e..ca25c7e4 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -25,6 +25,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
#include <math.h>
#include "bluetooth-client.h"
@@ -1510,7 +1512,6 @@ add_device_section (BluetoothSettingsWidget *self)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_top (box, 6);
- gtk_widget_set_margin_bottom (box, 24);
gtk_box_pack_start (GTK_BOX (vbox), box, TRUE, TRUE, 0);
priv->child_box = box;
@@ -1894,6 +1895,12 @@ bluetooth_settings_widget_init (BluetoothSettingsWidget *self)
GtkWidget *widget;
GError *error = NULL;
+ /* This ensures the HdyColumn type is known by GtkBuilder when loading the UI
+ * template. This avoids the widget to fail at runtime if the user didn't run
+ * hdy_init().
+ */
+ g_type_ensure (HDY_TYPE_COLUMN);
+
priv->cancellable = g_cancellable_new ();
priv->debug = g_getenv ("BLUETOOTH_DEBUG") != NULL;
diff --git a/lib/settings.ui b/lib/settings.ui
index 0bc13df2..9d92b91b 100644
--- a/lib/settings.ui
+++ b/lib/settings.ui
@@ -373,24 +373,31 @@
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="hscrollbar-policy">never</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
+ <object class="HdyColumn">
+ <property name="visible">True</property>
+ <property name="maximum_width">600</property>
+ <property name="linear_growth_width">400</property>
+ <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" id="vbox_bluetooth">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">12</property>
<property name="orientation">vertical</property>
- <property name="margin_left">128</property>
- <property name="margin_right">128</property>
<child>
<object class="GtkLabel" id="explanation-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="margin_top">32</property>
- <property name="margin_bottom">12</property>
<property name="label">Visible as “Bastien's computer” and available for Bluetooth file
transfers. Transferred files are placed in the <a href="http://www.gnome.org">Downloads</a>
folder.</property>
<property name="use_markup">True</property>
<property name="justify">fill</property>
@@ -406,6 +413,8 @@
<placeholder/>
</child>
</object>
+ </child>
+ </object>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]