<commit_before>#include <node.h>
#include <gtk/gtk.h>
#include "appjs.h"
#include "base/native_window.h"
#include "includes/cef.h"
#include "includes/util.h"
#include "includes/cef_handler.h"

extern CefRefPtr<ClientHandler> g_handler;

namespace appjs {

using namespace v8;

void destroy_handler(GtkWidget* widget, NativeWindow* window) {
  window->Emit("close");
}

void drag_handler( GtkWidget* widget, GdkEvent* event, NativeWindow* window ) {
  gtk_window_begin_move_drag(GTK_WINDOW(widget), event->type, event->button.x_root,event->button.y_root,event->button.time);
  g_signal_handler_disconnect(G_OBJECT(widget), window->GetDragHandlerId());
}

void NativeWindow::Init(char* url, Settings* settings) {
  handle_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  GtkWindow* window = (GtkWindow*)handle_;

  // Set default icon list
  if( !g_handler->GetBrowserHwnd() ) {

    char* smallerIconPath = icons->getString("smaller","");
    char* smallIconPath = icons->getString("small","");
    char* bigIconPath = icons->getString("big","");
    char* biggerIconPath = icons->getString("bigger","");

    GdkPixbuf* smallerIconBuf = gdk_pixbuf_new_from_file(smallerIconPath,NULL);
    GdkPixbuf* smallIconBuf = gdk_pixbuf_new_from_file(smallIconPath,NULL);
    GdkPixbuf* bigIconBuf = gdk_pixbuf_new_from_file(bigIconPath,NULL);
    GdkPixbuf* biggerIconBuf = gdk_pixbuf_new_from_file(biggerIconPath,NULL);

    GList* iconList;

    iconList = g_list_insert(iconList,smallerIconBuf,1);
    iconList = g_list_insert(iconList,smallIconBuf,0);
    iconList = g_list_insert(iconList,bigIconBuf,2);
    iconList = g_list_insert(iconList,biggerIconBuf,3);

    gtk_window_set_default_icon_list(iconList);

//    delete smallerIconPath;
//    delete smallIconPath;
//    delete bigIconPath;
//    delete biggerIconPath;
  }

  gtk_window_set_default_size(window, rect_.width, rect_.height);
  gtk_window_set_opacity(window, opacity_);
  gtk_window_set_decorated(window, show_chrome_);

  #if defined(__UBUNTU__) && !GTK_CHECK_VERSION(2, 24, 10)
    if(gtk_check_version(2, 24, 10))
      gtk_window_set_has_resize_grip(window, show_resize_grip);
  #endif

  if( fullscreen_ ) {
    Fullscreen();
  } else {
    gtk_window_set_resizable(window, resizable_);
  }

  if( !resizable_ ) {
    gtk_widget_set_size_request(handle_,rect_.width,rect_.height);
  }

  if( rect_.left == -1 ) {
    rect_.left = (ScreenWidth() - rect_.width) / 2;
  }

  if ( rect_.top == -1 ) {
    rect_.top = (ScreenHeight() - rect_.height) / 2;
  }

  gtk_window_move(window,rect_.left,rect_.top);<commit_msg>Get rid of annoying glib warnings in linux.<commit_after>#include <node.h>
#include <gtk/gtk.h>
#include "appjs.h"
#include "base/native_window.h"
#include "includes/cef.h"
#include "includes/util.h"
#include "includes/cef_handler.h"

extern CefRefPtr<ClientHandler> g_handler;

namespace appjs {

using namespace v8;

void destroy_handler(GtkWidget* widget, NativeWindow* window) {
  window->Emit("close");
}

void drag_handler( GtkWidget* widget, GdkEvent* event, NativeWindow* window ) {
  gtk_window_begin_move_drag(GTK_WINDOW(widget), event->type, event->button.x_root,event->button.y_root,event->button.time);
  g_signal_handler_disconnect(G_OBJECT(widget), window->GetDragHandlerId());
}

void NativeWindow::Init(char* url, Settings* settings) {
  handle_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  GtkWindow* window = (GtkWindow*)handle_;

  // Set default icon list
  if( !g_handler->GetBrowserHwnd() ) {

    GList* iconList;
    bool setIconFlag = false;

    char* smallerIconPath = icons->getString("smaller","");
    char* smallIconPath = icons->getString("small","");
    char* bigIconPath = icons->getString("big","");
    char* biggerIconPath = icons->getString("bigger","");

    if(smallerIconPath != (char*)"") {
      GdkPixbuf* smallerIconBuf = gdk_pixbuf_new_from_file(smallerIconPath,NULL);
      iconList = g_list_insert(iconList,smallerIconBuf,0);
      setIconFlag = true;
    }

    if(smallIconPath != (char*)"") {
      GdkPixbuf* smallIconBuf = gdk_pixbuf_new_from_file(smallIconPath,NULL);
      iconList = g_list_insert(iconList,smallIconBuf,1);
      setIconFlag = true;
    }

    if(bigIconPath != (char*)"") {
      GdkPixbuf* bigIconBuf = gdk_pixbuf_new_from_file(bigIconPath,NULL);
      iconList = g_list_insert(iconList,bigIconBuf,2);
      setIconFlag = true;
    }

    if(biggerIconPath != (char*)"") {
      GdkPixbuf* biggerIconBuf = gdk_pixbuf_new_from_file(biggerIconPath,NULL);
      iconList = g_list_insert(iconList,biggerIconBuf,3);
      setIconFlag = true;
    }

    if( setIconFlag )
      gtk_window_set_default_icon_list(iconList);

  }

  gtk_window_set_default_size(window, rect_.width, rect_.height);
  gtk_window_set_opacity(window, opacity_);
  gtk_window_set_decorated(window, show_chrome_);

  #if defined(__UBUNTU__) && !GTK_CHECK_VERSION(2, 24, 10)
    if(gtk_check_version(2, 24, 10))
      gtk_window_set_has_resize_grip(window, show_resize_grip);
  #endif

  if( fullscreen_ ) {
    Fullscreen();
  } else {
    gtk_window_set_resizable(window, resizable_);
  }

  if( !resizable_ ) {
    gtk_widget_set_size_request(handle_,rect_.width,rect_.height);
  }

  if( rect_.left == -1 ) {
    rect_.left = (ScreenWidth() - rect_.width) / 2;
  }

  if ( rect_.top == -1 ) {
    rect_.top = (ScreenHeight() - rect_.height) / 2;
  }

  gtk_window_move(window,rect_.left,rect_.top);
{'fraction_non_alphanumeric': 0.13386262924667652, 'fraction_numerical': 0.007016248153618907, 'mean_word_length': 4.862554112554113, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, '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': '6592834', 'n_tokens_mistral': 2013, 'n_tokens_neox': 1922, 'n_words': 303}