[gnome-online-accounts/wip/rishi/mobile-web-view] webview: Make it more flexible in terms of its size
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/mobile-web-view] webview: Make it more flexible in terms of its size
- Date: Wed, 31 Jul 2019 12:31:48 +0000 (UTC)
commit b05efce6c80b9c37fc2eadd04359ed4e1f074340
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jul 30 19:32:17 2019 +0200
webview: Make it more flexible in terms of its size
So far, the minimum size of a GoaWebView was set to 500x400, which
meant that it couldn't be shrunk to fit smaller devices. This has now
been made more flexible by changing the current minimum to be the
default size, and using 300x200 as the new minimum.
https://gitlab.gnome.org/GNOME/gnome-online-accounts/merge_requests/26
src/goabackend/goawebview.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/goabackend/goawebview.c b/src/goabackend/goawebview.c
index 8d1a55cf..b07ed1ec 100644
--- a/src/goabackend/goawebview.c
+++ b/src/goabackend/goawebview.c
@@ -266,6 +266,26 @@ web_view_script_message_received_password_submit_cb (GoaWebView *self, WebKitJav
JSStringRelease (js_string);
}
+static void
+goa_web_view_get_preferred_height (GtkWidget *widget, gint *minimum_size, gint *natural_size)
+{
+ *minimum_size = 200;
+ *natural_size = 400;
+}
+
+static void
+goa_web_view_get_preferred_width (GtkWidget *widget, gint *minimum_size, gint *natural_size)
+{
+ *minimum_size = 300;
+ *natural_size = 500;
+}
+
+static GtkSizeRequestMode
+goa_web_view_get_request_mode (GtkWidget *widget)
+{
+ return GTK_SIZE_REQUEST_CONSTANT_SIZE;
+}
+
static void
goa_web_view_constructed (GObject *object)
{
@@ -298,7 +318,6 @@ goa_web_view_constructed (GObject *object)
"user-content-manager", self->user_content_manager,
"web-context", self->context,
NULL));
- gtk_widget_set_size_request (self->web_view, 500, 400);
gtk_container_add (GTK_CONTAINER (self), self->web_view);
#ifdef GOA_INSPECTOR_ENABLED
@@ -414,12 +433,17 @@ static void
goa_web_view_class_init (GoaWebViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructed = goa_web_view_constructed;
object_class->dispose = goa_web_view_dispose;
object_class->finalize = goa_web_view_finalize;
object_class->set_property = goa_web_view_set_property;
+ widget_class->get_preferred_height = goa_web_view_get_preferred_height;
+ widget_class->get_preferred_width = goa_web_view_get_preferred_width;
+ widget_class->get_request_mode = goa_web_view_get_request_mode;
+
g_object_class_install_property (object_class,
PROP_EXISTING_IDENTITY,
g_param_spec_string ("existing-identity",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]