<commit_before>/* Copyright (c) 2009, Igalia
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * * Neither the name of the Nokia Corporation nor the names of its
 *   contributors may be used to endorse or promote products derived from
 *   this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <glib/gi18n.h>
#include "modest-scrolled-window-scrollable.h"

static void modest_scrolled_window_scrollable_class_init (ModestScrolledWindowScrollableClass *klass);
static void modest_scrolled_window_scrollable_init (ModestScrolledWindowScrollable *self);
static void modest_scrollable_iface_init (gpointer g, gpointer iface_data);

/* GObject interface */
static void modest_scrolled_window_scrollable_finalize (GObject *obj);
static void modest_scrolled_window_scrollable_get_property (GObject *obj,
								 guint prop_id, 
								 GValue *value, 
								 GParamSpec *pspec);
static void modest_scrolled_window_scrollable_set_property (GObject *obj,
								 guint prop_id, 
								 const GValue *value, 
								 GParamSpec *pspec);

/* Modest scrollable interface */
static void modest_scrolled_window_scrollable_add_with_viewport (ModestScrollable *self, GtkWidget *widget);
static void modest_scrolled_window_scrollable_add_with_viewport_default (ModestScrollable *self, GtkWidget *widget);
static GtkAdjustment *modest_scrolled_window_scrollable_get_vadjustment (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_vadjustment_default (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_hadjustment (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_hadjustment_default (ModestScrollable *self);
static void modest_scrolled_window_scrollable_scroll_to (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_scroll_to_default (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_jump_to (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_jump_to_default (ModestScrollable *self, const gint x, const gint y);
static GtkPolicyType modest_scrolled_window_scrollable_get_vertical_policy (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_vertical_policy_default (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_horizontal_policy (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_horizontal_policy_default (ModestScrollable *self);
static void modest_scrolled_window_scrollable_set_horizontal_policy (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_horizontal_policy_default (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_vertical_policy (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_vertical_policy_default (ModestScrollable *self, GtkPolicyType policy);

/* list properties */
enum {
	PROP_0,
	PROP_HORIZONTAL_POLICY,
	PROP_VERTICAL_POLICY,
	PROP_MOVEMENT_MODE,
	PROP_HORIZONTAL_MAX_OVERSHOOT,
	PROP_VERTICAL_MAX_OVERSHOOT,
};

/* globals */
static GtkScrolledWindowClass *parent_class = NULL;

G_DEFINE_TYPE_EXTENDED    (ModestScrolledWindowScrollable,
			   modest_scrolled_window_scrollable,
			   GTK_TYPE_SCROLLED_WINDOW,
			   0,
			   {
			     G_IMPLEMENT_INTERFACE (MODEST_TYPE_SCROLLABLE, modest_scrollable_iface_init);
			     g_type_interface_add_prerequisite (g_define_type_id, GTK_TYPE_BIN);
			   }
			   );

GtkWidget *
modest_scrolled_window_scrollable_new                            (void)
{
	GtkWidget *scrollable = g_object_new (MODEST_TYPE_SCROLLED_WINDOW_SCROLLABLE, 
					      NULL);

    return scrollable;
}

static void
modest_scrolled_window_scrollable_class_init (ModestScrolledWindowScrollableClass *klass)
{
	GObjectClass *gobject_class;

	parent_class = g_type_class_peek_parent (klass);
	gobject_class->finalize = modest_scrolled_window_scrollable_finalize;
	gobject_class->set_property = modest_scrolled_window_scrollable_set_property;
	gobject_class->get_property = modest_scrolled_window_scrollable_get_property;<commit_msg>By default don't allow horizontal scroll in scrolled window scrollable.<commit_after>/* Copyright (c) 2009, Igalia
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * * Neither the name of the Nokia Corporation nor the names of its
 *   contributors may be used to endorse or promote products derived from
 *   this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <glib/gi18n.h>
#include "modest-scrolled-window-scrollable.h"

static void modest_scrolled_window_scrollable_class_init (ModestScrolledWindowScrollableClass *klass);
static void modest_scrolled_window_scrollable_init (ModestScrolledWindowScrollable *self);
static void modest_scrollable_iface_init (gpointer g, gpointer iface_data);

/* GObject interface */
static void modest_scrolled_window_scrollable_finalize (GObject *obj);
static void modest_scrolled_window_scrollable_get_property (GObject *obj,
								 guint prop_id, 
								 GValue *value, 
								 GParamSpec *pspec);
static void modest_scrolled_window_scrollable_set_property (GObject *obj,
								 guint prop_id, 
								 const GValue *value, 
								 GParamSpec *pspec);

/* Modest scrollable interface */
static void modest_scrolled_window_scrollable_add_with_viewport (ModestScrollable *self, GtkWidget *widget);
static void modest_scrolled_window_scrollable_add_with_viewport_default (ModestScrollable *self, GtkWidget *widget);
static GtkAdjustment *modest_scrolled_window_scrollable_get_vadjustment (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_vadjustment_default (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_hadjustment (ModestScrollable *self);
static GtkAdjustment *modest_scrolled_window_scrollable_get_hadjustment_default (ModestScrollable *self);
static void modest_scrolled_window_scrollable_scroll_to (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_scroll_to_default (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_jump_to (ModestScrollable *self, const gint x, const gint y);
static void modest_scrolled_window_scrollable_jump_to_default (ModestScrollable *self, const gint x, const gint y);
static GtkPolicyType modest_scrolled_window_scrollable_get_vertical_policy (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_vertical_policy_default (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_horizontal_policy (ModestScrollable *self);
static GtkPolicyType modest_scrolled_window_scrollable_get_horizontal_policy_default (ModestScrollable *self);
static void modest_scrolled_window_scrollable_set_horizontal_policy (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_horizontal_policy_default (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_vertical_policy (ModestScrollable *self, GtkPolicyType policy);
static void modest_scrolled_window_scrollable_set_vertical_policy_default (ModestScrollable *self, GtkPolicyType policy);

/* list properties */
enum {
	PROP_0,
	PROP_HORIZONTAL_POLICY,
	PROP_VERTICAL_POLICY,
	PROP_MOVEMENT_MODE,
	PROP_HORIZONTAL_MAX_OVERSHOOT,
	PROP_VERTICAL_MAX_OVERSHOOT,
};

/* globals */
static GtkScrolledWindowClass *parent_class = NULL;

G_DEFINE_TYPE_EXTENDED    (ModestScrolledWindowScrollable,
			   modest_scrolled_window_scrollable,
			   GTK_TYPE_SCROLLED_WINDOW,
			   0,
			   {
			     G_IMPLEMENT_INTERFACE (MODEST_TYPE_SCROLLABLE, modest_scrollable_iface_init);
			     g_type_interface_add_prerequisite (g_define_type_id, GTK_TYPE_BIN);
			   }
			   );

GtkWidget *
modest_scrolled_window_scrollable_new                            (void)
{
	GtkWidget *scrollable = g_object_new (MODEST_TYPE_SCROLLED_WINDOW_SCROLLABLE,
					      "hscrollbar-policy", GTK_POLICY_NEVER,
					      "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
					      NULL);

    return scrollable;
}

static void
modest_scrolled_window_scrollable_class_init (ModestScrolledWindowScrollableClass *klass)
{
	GObjectClass *gobject_class;

	parent_class = g_type_class_peek_parent (klass);
	gobject_class->finalize = modest_scrolled_window_scrollable_finalize;
	gobject_class->set_property = modest_scrolled_window_scrollable_set_property;
	gobject_class->get_property = modest_scrolled_window_scrollable_get_property;
{'fraction_non_alphanumeric': 0.052860310421286034, 'fraction_numerical': 0.0014190687361419069, 'mean_word_length': 6.369934640522875, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5621216', 'n_tokens_mistral': 3543, 'n_tokens_neox': 3266, 'n_words': 916}