Commit c6c19446 authored by Mohammed Sadiq's avatar Mohammed Sadiq Committed by Debarshi Ray

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
parent 686fa2b9
......@@ -266,6 +266,32 @@ 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)
{
if (minimum_size != NULL)
*minimum_size = 200;
if (natural_size != NULL)
*natural_size = 400;
}
static void
goa_web_view_get_preferred_width (GtkWidget *widget, gint *minimum_size, gint *natural_size)
{
if (minimum_size != NULL)
*minimum_size = 300;
if (natural_size != NULL)
*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 +324,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 +439,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",
......
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