<commit_before>/**
 * Appcelerator Titanium - licensed under the Apache Public License 2
 * see LICENSE in the root folder for details on the license.
 * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
 */

#include "../ui_module.h"
#include <iostream>
#include <Poco/Process.h>

using namespace ti;

#define STUB() printf("Method is still a stub, %s:%i\n", __FILE__, __LINE__)

static void destroy_cb(
	GtkWidget* widget,
	gpointer data);
static gboolean event_cb(
	GtkWidget* window,
	GdkEvent* event,
	gpointer user_data);
static void window_object_cleared_cb(
	WebKitWebView*,
	WebKitWebFrame*,
	JSGlobalContextRef,
	JSObjectRef, gpointer);
static void populate_popup_cb(
	WebKitWebView *web_view,
	GtkMenu *menu,
	gpointer data);
static gint navigation_requested_cb(
	WebKitWebView* web_view,
	WebKitWebFrame* web_frame,
	WebKitNetworkRequest* request);
static gint new_window_navigation_requested_cb(
	WebKitWebView* web_view,
	WebKitWebFrame* web_frame,
	WebKitNetworkRequest* request,
	gchar* frame_name);

GtkUserWindow::GtkUserWindow(Host *host, WindowConfig* config) : UserWindow(host, config)
{
	this->gtk_window = NULL;
	this->web_view = NULL,
	this->menu = NULL;
	this->menu_bar = NULL;
	this->gdk_width = -1;
	this->gdk_height = -1;
	this->gdk_x = -1;
	this->gdk_y = -1;

}

GtkUserWindow::~GtkUserWindow()
{
	this->Close();
}

UserWindow* GtkUserWindow::WindowFactory(Host *host, WindowConfig* config)
{
	return new GtkUserWindow(host, config);
}

void GtkUserWindow::Open()
{
	if (this->gtk_window == NULL)
	{
		/* web view */
		WebKitWebView* web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
		g_signal_connect(G_OBJECT(web_view), "window-object-cleared",
		                 G_CALLBACK(window_object_cleared_cb),
		                 this);
		g_signal_connect(G_OBJECT(web_view), "navigation-requested",
		                 G_CALLBACK(navigation_requested_cb), this);
		g_signal_connect(G_OBJECT(web_view), "new-window-navigation-requested",
		                 G_CALLBACK(new_window_navigation_requested_cb), this);

		g_signal_connect(
			G_OBJECT (web_view),
			"populate-popup",
			G_CALLBACK (populate_popup_cb),
			this);

		GtkWidget* view_container = NULL;
		if (this->IsUsingScrollbars())
		{
			/* web view scroller */
			GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);<commit_msg>enable developer settings for gtk ui:<commit_after>/**
 * Appcelerator Titanium - licensed under the Apache Public License 2
 * see LICENSE in the root folder for details on the license.
 * Copyright (c) 2008 Appcelerator, Inc. All Rights Reserved.
 */

#include "../ui_module.h"
#include <iostream>
#include <Poco/Process.h>

using namespace ti;

#define STUB() printf("Method is still a stub, %s:%i\n", __FILE__, __LINE__)

static void destroy_cb(
	GtkWidget* widget,
	gpointer data);
static gboolean event_cb(
	GtkWidget* window,
	GdkEvent* event,
	gpointer user_data);
static void window_object_cleared_cb(
	WebKitWebView*,
	WebKitWebFrame*,
	JSGlobalContextRef,
	JSObjectRef, gpointer);
static void populate_popup_cb(
	WebKitWebView *web_view,
	GtkMenu *menu,
	gpointer data);
static gint navigation_requested_cb(
	WebKitWebView* web_view,
	WebKitWebFrame* web_frame,
	WebKitNetworkRequest* request);
static gint new_window_navigation_requested_cb(
	WebKitWebView* web_view,
	WebKitWebFrame* web_frame,
	WebKitNetworkRequest* request,
	gchar* frame_name);

GtkUserWindow::GtkUserWindow(Host *host, WindowConfig* config) : UserWindow(host, config)
{
	this->gtk_window = NULL;
	this->web_view = NULL,
	this->menu = NULL;
	this->menu_bar = NULL;
	this->gdk_width = -1;
	this->gdk_height = -1;
	this->gdk_x = -1;
	this->gdk_y = -1;

}

GtkUserWindow::~GtkUserWindow()
{
	this->Close();
}

UserWindow* GtkUserWindow::WindowFactory(Host *host, WindowConfig* config)
{
	return new GtkUserWindow(host, config);
}

void GtkUserWindow::Open()
{
	if (this->gtk_window == NULL)
	{
		/* web view */
		WebKitWebView* web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
		g_signal_connect(G_OBJECT(web_view), "window-object-cleared",
		                 G_CALLBACK(window_object_cleared_cb),
		                 this);
		g_signal_connect(G_OBJECT(web_view), "navigation-requested",
		                 G_CALLBACK(navigation_requested_cb), this);
		g_signal_connect(G_OBJECT(web_view), "new-window-navigation-requested",
		                 G_CALLBACK(new_window_navigation_requested_cb), this);
		g_signal_connect(G_OBJECT (web_view), "populate-popup",
		                 G_CALLBACK (populate_popup_cb), this);

		WebKitWebSettings* settings = webkit_web_settings_new();
		g_object_set(G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);
		webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view), settings);

		GtkWidget* view_container = NULL;
		if (this->IsUsingScrollbars())
		{
			/* web view scroller */
			GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
{'fraction_non_alphanumeric': 0.11362248014660965, 'fraction_numerical': 0.0036652412950519244, 'mean_word_length': 4.847619047619047, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, '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': '2476394', 'n_tokens_mistral': 1803, 'n_tokens_neox': 1720, 'n_words': 366}