[gnome-control-center/T20818: 12/54] datetime: adapt timezone dialog for small screens
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/T20818: 12/54] datetime: adapt timezone dialog for small screens
- Date: Tue, 23 Jan 2018 21:31:02 +0000 (UTC)
commit 5cabfc1bb328489efdae29a3898fa3cf51376c33
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jan 10 11:17:30 2016 -0200
datetime: adapt timezone dialog for small screens
The timezone dialog doesn't resize on small screens,
requesting too much width and height and cropping
important fields like the search bar and the close
button.
To fix that, add scrollbars around the world map and
use them when running on small screens.
[endlessm/eos-shell#6226]
panels/datetime/cc-datetime-panel.c | 30 ++++++++++++++++++++++++++++++
panels/datetime/datetime.ui | 16 ++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index bb0ab87..557d7a5 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -71,6 +71,8 @@ enum {
struct _CcDateTimePanelPrivate
{
GtkBuilder *builder;
+ GtkWidget *timezone_dialog;
+ GtkWidget *scrolled_window;
GtkWidget *map;
GList *listboxes;
@@ -159,6 +161,30 @@ cc_date_time_panel_get_help_uri (CcPanel *panel)
}
static void
+cc_date_time_panel_constructed (GObject *object)
+{
+ CcDateTimePanelPrivate *priv;
+ CcShell *shell;
+
+ G_OBJECT_CLASS (cc_date_time_panel_parent_class)->constructed (object);
+
+ priv = CC_DATE_TIME_PANEL (object)->priv;
+ shell = cc_panel_get_shell (CC_PANEL (object));
+
+ if (cc_shell_is_small_screen (shell))
+ {
+ gint width, height;
+
+ gtk_window_get_size (GTK_WINDOW (cc_shell_get_toplevel (shell)), &width, &height);
+ gtk_widget_set_size_request (priv->timezone_dialog, width, height);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ }
+}
+
+static void
cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -166,6 +192,7 @@ cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
g_type_class_add_private (klass, sizeof (CcDateTimePanelPrivate));
+ object_class->constructed = cc_date_time_panel_constructed;
object_class->dispose = cc_date_time_panel_dispose;
panel_class->get_permission = cc_date_time_panel_get_permission;
@@ -1034,6 +1061,9 @@ setup_timezone_dialog (CcDateTimePanel *self)
gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->builder, "aspectmap")),
priv->map);
+ priv->timezone_dialog = W ("timezone-dialog");
+ priv->scrolled_window = W ("timezone-scrolledwindow");
+
dialog = W ("timezone-dialog");
entry = W ("timezone-searchentry");
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index 17a4e6b..fc3f2e6 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -236,6 +236,18 @@
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
+ <object class="GtkScrolledWindow" id="timezone-scrolledwindow">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkViewport" id="timezone-viewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
<object class="GtkFrame" id="aspectmap">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -248,6 +260,10 @@
<placeholder/>
</child>
</object>
+ </child>
+ </object>
+ </child>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]