Commit f44cde35 authored by Adrien Plazas's avatar Adrien Plazas

timezone: Use a location list on small screens

parent ac07d07a
Pipeline #22702 failed with stage
in 0 seconds
......@@ -205,18 +205,20 @@ cc_timezone_map_size_allocate (GtkWidget *widget,
else
pixbuf = priv->orig_background;
/* Bilinear scaling costs about 2500ms on my system. */
priv->background = gdk_pixbuf_scale_simple (pixbuf,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
GDK_INTERP_NEAREST);
if (priv->color_map)
g_object_unref (priv->color_map);
/* Bilinear scaling costs about 2500ms on my system. */
priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map,
allocation->width,
allocation->height,
GDK_INTERP_BILINEAR);
GDK_INTERP_NEAREST);
priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map);
priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map);
......@@ -407,9 +409,9 @@ cc_timezone_map_draw (GtkWidget *widget,
}
else
{
/* Bilinear scaling costs about 1500ms on my system. */
hilight = gdk_pixbuf_scale_simple (orig_hilight, alloc.width,
alloc.height, GDK_INTERP_BILINEAR);
alloc.height, GDK_INTERP_NEAREST);
gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0);
cairo_paint (cr);
......
This diff is collapsed.
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2019 Purism SPC
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Written by:
* Adrien Plazas <kekun.plazas@laposte.net>
*/
#ifndef __GIS_LOCATION_LIST_H__
#define __GIS_LOCATION_LIST_H__
#include <glib-object.h>
#include "gnome-initial-setup.h"
G_BEGIN_DECLS
#define GIS_TYPE_LOCATION_LIST (gis_location_list_get_type())
G_DECLARE_DERIVABLE_TYPE (GisLocationList, gis_location_list, GIS, LOCATION_LIST, GtkListBox)
struct _GisLocationListClass
{
GtkListBoxClass parent_class;
};
const gchar *gis_location_list_get_text (GisLocationList *self);
void gis_location_list_set_text (GisLocationList *self,
const gchar *text);
G_END_DECLS
#endif /* __GIS_LOCATION_LIST_H__ */
......@@ -48,6 +48,7 @@
#include "cc-timezone-map.h"
#include "gis-bubble-widget.h"
#include "gis-location-list.h"
#define DEFAULT_TZ "Europe/London"
#define DESKTOP_ID "gnome-datetime-panel"
......@@ -57,6 +58,7 @@
struct _GisTimezonePagePrivate
{
GtkWidget *locations;
GtkWidget *map;
GtkWidget *search_entry;
GtkWidget *search_overlay;
......@@ -443,6 +445,7 @@ gis_timezone_page_class_init (GisTimezonePageClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/initial-setup/gis-timezone-page.ui");
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, locations);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, map);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, search_entry);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, search_overlay);
......@@ -461,6 +464,7 @@ gis_timezone_page_init (GisTimezonePage *page)
g_resources_register (datetime_get_resource ());
g_type_ensure (CC_TYPE_TIMEZONE_MAP);
g_type_ensure (GIS_TYPE_BUBBLE_WIDGET);
g_type_ensure (GIS_TYPE_LOCATION_LIST);
gtk_widget_init_template (GTK_WIDGET (page));
}
......
......@@ -29,7 +29,6 @@
<property name="margin_top">18</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="vexpand">True</property>
<property name="label" translatable="yes">Time Zone</property>
<attributes>
<attribute name="weight" value="bold"/>
......@@ -71,9 +70,21 @@
<object class="GtkOverlay" id="map_overlay">
<property name="visible">True</property>
<child>
<object class="CcTimezoneMap" id="map">
<object class="HdySqueezer">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="homogeneous">False</property>
<child>
<object class="CcTimezoneMap" id="map">
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GisLocationList" id="locations">
<property name="text" bind-source="search_entry" bind-property="text" bind-flags="sync-create"/>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child type="overlay">
......
......@@ -23,6 +23,8 @@ sources += files(
'tz.h',
'gis-bubble-widget.c',
'gis-bubble-widget.h',
'gis-location-list.c',
'gis-location-list.h',
'gis-timezone-page.c',
'gis-timezone-page.h'
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment