/* server_group_button.c generated by valac 0.56.17, the Vala compiler
 * generated from server_group_button.vala, do not modify */

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
 * -*- coding: utf-8 -*-
 *
 * Copyright (C) 2011 ~ 2018 Deepin, Inc.
 *               2011 ~ 2018 Wang Yong
 *
 * Author:     Wang Yong <wangyong@deepin.com>
 * Maintainer: Wang Yong <wangyong@deepin.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <cairo-gobject.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <pango/pango.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define WIDGETS_TYPE_CLICK_EVENT_BOX (widgets_click_event_box_get_type ())
#define WIDGETS_CLICK_EVENT_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_CLICK_EVENT_BOX, WidgetsClickEventBox))
#define WIDGETS_CLICK_EVENT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_CLICK_EVENT_BOX, WidgetsClickEventBoxClass))
#define WIDGETS_IS_CLICK_EVENT_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_CLICK_EVENT_BOX))
#define WIDGETS_IS_CLICK_EVENT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_CLICK_EVENT_BOX))
#define WIDGETS_CLICK_EVENT_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_CLICK_EVENT_BOX, WidgetsClickEventBoxClass))

typedef struct _WidgetsClickEventBox WidgetsClickEventBox;
typedef struct _WidgetsClickEventBoxClass WidgetsClickEventBoxClass;
typedef struct _WidgetsClickEventBoxPrivate WidgetsClickEventBoxPrivate;

#define WIDGETS_TYPE_SERVER_GROUP_BUTTON (widgets_server_group_button_get_type ())
#define WIDGETS_SERVER_GROUP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_SERVER_GROUP_BUTTON, WidgetsServerGroupButton))
#define WIDGETS_SERVER_GROUP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_SERVER_GROUP_BUTTON, WidgetsServerGroupButtonClass))
#define WIDGETS_IS_SERVER_GROUP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_SERVER_GROUP_BUTTON))
#define WIDGETS_IS_SERVER_GROUP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_SERVER_GROUP_BUTTON))
#define WIDGETS_SERVER_GROUP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_SERVER_GROUP_BUTTON, WidgetsServerGroupButtonClass))

typedef struct _WidgetsServerGroupButton WidgetsServerGroupButton;
typedef struct _WidgetsServerGroupButtonClass WidgetsServerGroupButtonClass;
typedef struct _WidgetsServerGroupButtonPrivate WidgetsServerGroupButtonPrivate;
enum  {
	WIDGETS_SERVER_GROUP_BUTTON_0_PROPERTY,
	WIDGETS_SERVER_GROUP_BUTTON_NUM_PROPERTIES
};
static GParamSpec* widgets_server_group_button_properties[WIDGETS_SERVER_GROUP_BUTTON_NUM_PROPERTIES];
#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block40Data Block40Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WIDGETS_TYPE_CONFIG_WINDOW (widgets_config_window_get_type ())
#define WIDGETS_CONFIG_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WIDGETS_TYPE_CONFIG_WINDOW, WidgetsConfigWindow))
#define WIDGETS_CONFIG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WIDGETS_TYPE_CONFIG_WINDOW, WidgetsConfigWindowClass))
#define WIDGETS_IS_CONFIG_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WIDGETS_TYPE_CONFIG_WINDOW))
#define WIDGETS_IS_CONFIG_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WIDGETS_TYPE_CONFIG_WINDOW))
#define WIDGETS_CONFIG_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WIDGETS_TYPE_CONFIG_WINDOW, WidgetsConfigWindowClass))

typedef struct _WidgetsConfigWindow WidgetsConfigWindow;
typedef struct _WidgetsConfigWindowClass WidgetsConfigWindowClass;
enum  {
	WIDGETS_SERVER_GROUP_BUTTON_SHOW_GROUP_SERVERS_SIGNAL,
	WIDGETS_SERVER_GROUP_BUTTON_NUM_SIGNALS
};
static guint widgets_server_group_button_signals[WIDGETS_SERVER_GROUP_BUTTON_NUM_SIGNALS] = {0};

struct _WidgetsClickEventBox {
	GtkEventBox parent_instance;
	WidgetsClickEventBoxPrivate * priv;
	gboolean is_press;
};

struct _WidgetsClickEventBoxClass {
	GtkEventBoxClass parent_class;
};

struct _WidgetsServerGroupButton {
	WidgetsClickEventBox parent_instance;
	WidgetsServerGroupButtonPrivate * priv;
	cairo_surface_t* arrow_dark_surface;
	cairo_surface_t* arrow_light_surface;
	cairo_surface_t* server_group_dark_surface;
	cairo_surface_t* server_group_light_surface;
	GdkRGBA content_dark_color;
	GdkRGBA content_light_color;
	GdkRGBA hover_dark_color;
	GdkRGBA hover_light_color;
	GdkRGBA line_dark_color;
	GdkRGBA line_light_color;
	GdkRGBA press_dark_color;
	GdkRGBA press_light_color;
	GdkRGBA title_dark_color;
	GdkRGBA title_light_color;
	gboolean display_bottom_line;
	gboolean is_hover;
	gint arrow_x;
	gint content_size;
	gint content_y;
	gint height;
	gint image_x;
	gint server_number;
	gint text_width;
	gint text_x;
	gint title_size;
	gint title_y;
	gint width;
	gchar* title;
};

struct _WidgetsServerGroupButtonClass {
	WidgetsClickEventBoxClass parent_class;
};

struct _Block40Data {
	int _ref_count_;
	WidgetsServerGroupButton* self;
	gchar* server_title;
};

static gpointer widgets_server_group_button_parent_class = NULL;
VALA_EXTERN gint constant_SLIDER_WIDTH;
VALA_EXTERN gint constant_SLIDER_PANEL_TEXT_WIDTH;

VALA_EXTERN GType widgets_click_event_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsClickEventBox, g_object_unref)
VALA_EXTERN GType widgets_server_group_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsServerGroupButton, g_object_unref)
VALA_EXTERN WidgetsServerGroupButton* widgets_server_group_button_new (const gchar* server_title,
                                                           gint number);
VALA_EXTERN WidgetsServerGroupButton* widgets_server_group_button_construct (GType object_type,
                                                                 const gchar* server_title,
                                                                 gint number);
static Block40Data* block40_data_ref (Block40Data* _data40_);
static void block40_data_unref (void * _userdata_);
VALA_EXTERN WidgetsClickEventBox* widgets_click_event_box_new (void);
VALA_EXTERN WidgetsClickEventBox* widgets_click_event_box_construct (GType object_type);
VALA_EXTERN cairo_surface_t* utils_create_image_surface (const gchar* surface_path);
VALA_EXTERN void utils_hex_to_rgba (const gchar* hex_color,
                        gdouble alpha,
                        GdkRGBA* result);
static gboolean widgets_server_group_button_on_draw (WidgetsServerGroupButton* self,
                                              GtkWidget* widget,
                                              cairo_t* cr);
static gboolean _widgets_server_group_button_on_draw_gtk_widget_draw (GtkWidget* _sender,
                                                               cairo_t* cr,
                                                               gpointer self);
static gboolean __lambda116_ (WidgetsServerGroupButton* self,
                       GtkWidget* w,
                       GdkEventCrossing* e);
static gboolean ___lambda116__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                      GdkEventCrossing* event,
                                                      gpointer self);
static gboolean __lambda117_ (WidgetsServerGroupButton* self,
                       GtkWidget* w,
                       GdkEventCrossing* e);
static gboolean ___lambda117__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                      GdkEventCrossing* event,
                                                      gpointer self);
static gboolean __lambda118_ (WidgetsServerGroupButton* self,
                       GtkWidget* w,
                       GdkEventButton* e);
static gboolean ___lambda118__gtk_widget_button_press_event (GtkWidget* _sender,
                                                      GdkEventButton* event,
                                                      gpointer self);
static gboolean __lambda119_ (WidgetsServerGroupButton* self,
                       GtkWidget* w,
                       GdkEventButton* e);
static gboolean ___lambda119__gtk_widget_button_release_event (GtkWidget* _sender,
                                                        GdkEventButton* event,
                                                        gpointer self);
static void __lambda120_ (Block40Data* _data40_,
                   WidgetsClickEventBox* w,
                   GdkEventButton* e);
static void ___lambda120__widgets_click_event_box_clicked (WidgetsClickEventBox* _sender,
                                                    GdkEventButton* event,
                                                    gpointer self);
VALA_EXTERN GType widgets_config_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WidgetsConfigWindow, g_object_unref)
VALA_EXTERN gboolean widgets_config_window_is_light_theme (WidgetsConfigWindow* self);
VALA_EXTERN void draw_draw_surface (cairo_t* cr,
                        cairo_surface_t* surface,
                        gint x,
                        gint y,
                        gint width,
                        gint height);
VALA_EXTERN void utils_set_context_color (cairo_t* cr,
                              GdkRGBA* color);
VALA_EXTERN void draw_draw_text (cairo_t* cr,
                     const gchar* text,
                     gint x,
                     gint y,
                     gint width,
                     gint height,
                     gint size,
                     PangoAlignment horizontal_alignment,
                     const gchar* vertical_align,
                     gint* wrap_width);
VALA_EXTERN void draw_draw_rectangle (cairo_t* cr,
                          gint x,
                          gint y,
                          gint w,
                          gint h,
                          gboolean fill);
static void widgets_server_group_button_finalize (GObject * obj);
static GType widgets_server_group_button_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static Block40Data*
block40_data_ref (Block40Data* _data40_)
{
	g_atomic_int_inc (&_data40_->_ref_count_);
	return _data40_;
}

static void
block40_data_unref (void * _userdata_)
{
	Block40Data* _data40_;
	_data40_ = (Block40Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data40_->_ref_count_)) {
		WidgetsServerGroupButton* self;
		self = _data40_->self;
		_g_free0 (_data40_->server_title);
		_g_object_unref0 (self);
		g_slice_free (Block40Data, _data40_);
	}
}

static gboolean
_widgets_server_group_button_on_draw_gtk_widget_draw (GtkWidget* _sender,
                                                      cairo_t* cr,
                                                      gpointer self)
{
	gboolean result;
	result = widgets_server_group_button_on_draw ((WidgetsServerGroupButton*) self, _sender, cr);
	return result;
}

static gboolean
__lambda116_ (WidgetsServerGroupButton* self,
              GtkWidget* w,
              GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	self->is_hover = TRUE;
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = FALSE;
	return result;
}

static gboolean
___lambda116__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                             GdkEventCrossing* event,
                                             gpointer self)
{
	gboolean result;
	result = __lambda116_ ((WidgetsServerGroupButton*) self, _sender, event);
	return result;
}

static gboolean
__lambda117_ (WidgetsServerGroupButton* self,
              GtkWidget* w,
              GdkEventCrossing* e)
{
	gboolean result;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	self->is_hover = FALSE;
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = FALSE;
	return result;
}

static gboolean
___lambda117__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                             GdkEventCrossing* event,
                                             gpointer self)
{
	gboolean result;
	result = __lambda117_ ((WidgetsServerGroupButton*) self, _sender, event);
	return result;
}

static gboolean
__lambda118_ (WidgetsServerGroupButton* self,
              GtkWidget* w,
              GdkEventButton* e)
{
	gboolean result;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = FALSE;
	return result;
}

static gboolean
___lambda118__gtk_widget_button_press_event (GtkWidget* _sender,
                                             GdkEventButton* event,
                                             gpointer self)
{
	gboolean result;
	result = __lambda118_ ((WidgetsServerGroupButton*) self, _sender, event);
	return result;
}

static gboolean
__lambda119_ (WidgetsServerGroupButton* self,
              GtkWidget* w,
              GdkEventButton* e)
{
	gboolean result;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	self->is_hover = FALSE;
	gtk_widget_queue_draw ((GtkWidget*) self);
	result = FALSE;
	return result;
}

static gboolean
___lambda119__gtk_widget_button_release_event (GtkWidget* _sender,
                                               GdkEventButton* event,
                                               gpointer self)
{
	gboolean result;
	result = __lambda119_ ((WidgetsServerGroupButton*) self, _sender, event);
	return result;
}

static void
__lambda120_ (Block40Data* _data40_,
              WidgetsClickEventBox* w,
              GdkEventButton* e)
{
	WidgetsServerGroupButton* self;
	self = _data40_->self;
	g_return_if_fail (w != NULL);
	g_return_if_fail (e != NULL);
	g_signal_emit (self, widgets_server_group_button_signals[WIDGETS_SERVER_GROUP_BUTTON_SHOW_GROUP_SERVERS_SIGNAL], 0, _data40_->server_title);
}

static void
___lambda120__widgets_click_event_box_clicked (WidgetsClickEventBox* _sender,
                                               GdkEventButton* event,
                                               gpointer self)
{
	__lambda120_ (self, _sender, event);
}

WidgetsServerGroupButton*
widgets_server_group_button_construct (GType object_type,
                                       const gchar* server_title,
                                       gint number)
{
	WidgetsServerGroupButton * self = NULL;
	Block40Data* _data40_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	cairo_surface_t* _tmp2_;
	cairo_surface_t* _tmp3_;
	cairo_surface_t* _tmp4_;
	cairo_surface_t* _tmp5_;
	GdkRGBA _tmp6_ = {0};
	GdkRGBA _tmp7_ = {0};
	GdkRGBA _tmp8_ = {0};
	GdkRGBA _tmp9_ = {0};
	GdkRGBA _tmp10_ = {0};
	GdkRGBA _tmp11_ = {0};
	GdkRGBA _tmp12_ = {0};
	GdkRGBA _tmp13_ = {0};
	GdkRGBA _tmp14_ = {0};
	GdkRGBA _tmp15_ = {0};
	g_return_val_if_fail (server_title != NULL, NULL);
	_data40_ = g_slice_new0 (Block40Data);
	_data40_->_ref_count_ = 1;
	_tmp0_ = g_strdup (server_title);
	_g_free0 (_data40_->server_title);
	_data40_->server_title = _tmp0_;
	self = (WidgetsServerGroupButton*) widgets_click_event_box_construct (object_type);
	_data40_->self = g_object_ref (self);
	gtk_widget_add_events ((GtkWidget*) self, (gint) (((GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK) | GDK_POINTER_MOTION_MASK) | GDK_LEAVE_NOTIFY_MASK));
	_tmp1_ = g_strdup (_data40_->server_title);
	_g_free0 (self->title);
	self->title = _tmp1_;
	self->server_number = number;
	_tmp2_ = utils_create_image_surface ("server_group_dark.svg");
	_cairo_surface_destroy0 (self->server_group_dark_surface);
	self->server_group_dark_surface = _tmp2_;
	_tmp3_ = utils_create_image_surface ("server_group_light.svg");
	_cairo_surface_destroy0 (self->server_group_light_surface);
	self->server_group_light_surface = _tmp3_;
	_tmp4_ = utils_create_image_surface ("list_arrow_dark.svg");
	_cairo_surface_destroy0 (self->arrow_dark_surface);
	self->arrow_dark_surface = _tmp4_;
	_tmp5_ = utils_create_image_surface ("list_arrow_light.svg");
	_cairo_surface_destroy0 (self->arrow_light_surface);
	self->arrow_light_surface = _tmp5_;
	utils_hex_to_rgba ("#FFFFFF", 1.0, &_tmp6_);
	self->title_dark_color = _tmp6_;
	utils_hex_to_rgba ("#FFFFFF", 0.5, &_tmp7_);
	self->content_dark_color = _tmp7_;
	utils_hex_to_rgba ("#FFFFFF", 0.1, &_tmp8_);
	self->press_dark_color = _tmp8_;
	utils_hex_to_rgba ("#FFFFFF", 0.1, &_tmp9_);
	self->hover_dark_color = _tmp9_;
	utils_hex_to_rgba ("#303030", 1.0, &_tmp10_);
	self->title_light_color = _tmp10_;
	utils_hex_to_rgba ("#000000", 0.5, &_tmp11_);
	self->content_light_color = _tmp11_;
	utils_hex_to_rgba ("#000000", 0.1, &_tmp12_);
	self->press_light_color = _tmp12_;
	utils_hex_to_rgba ("#000000", 0.1, &_tmp13_);
	self->hover_light_color = _tmp13_;
	utils_hex_to_rgba ("#ffffff", 0.05, &_tmp14_);
	self->line_dark_color = _tmp14_;
	utils_hex_to_rgba ("#000000", 0.05, &_tmp15_);
	self->line_light_color = _tmp15_;
	gtk_widget_set_size_request ((GtkWidget*) self, self->width, self->height);
	g_signal_connect_object ((GtkWidget*) self, "draw", (GCallback) _widgets_server_group_button_on_draw_gtk_widget_draw, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "enter-notify-event", (GCallback) ___lambda116__gtk_widget_enter_notify_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "leave-notify-event", (GCallback) ___lambda117__gtk_widget_leave_notify_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "button-press-event", (GCallback) ___lambda118__gtk_widget_button_press_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "button-release-event", (GCallback) ___lambda119__gtk_widget_button_release_event, self, 0);
	g_signal_connect_data ((WidgetsClickEventBox*) self, "clicked", (GCallback) ___lambda120__widgets_click_event_box_clicked, block40_data_ref (_data40_), (GClosureNotify) block40_data_unref, 0);
	block40_data_unref (_data40_);
	_data40_ = NULL;
	return self;
}

WidgetsServerGroupButton*
widgets_server_group_button_new (const gchar* server_title,
                                 gint number)
{
	return widgets_server_group_button_construct (WIDGETS_TYPE_SERVER_GROUP_BUTTON, server_title, number);
}

static gboolean
widgets_server_group_button_on_draw (WidgetsServerGroupButton* self,
                                     GtkWidget* widget,
                                     cairo_t* cr)
{
	gboolean is_light_theme = FALSE;
	GtkWidget* _tmp0_;
	const gchar* _tmp7_;
	gchar* content = NULL;
	const gchar* _tmp12_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (cr != NULL, FALSE);
	_tmp0_ = gtk_widget_get_toplevel ((GtkWidget*) self);
	is_light_theme = widgets_config_window_is_light_theme (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, WIDGETS_TYPE_CONFIG_WINDOW, WidgetsConfigWindow));
	if (is_light_theme) {
		cairo_surface_t* _tmp1_;
		cairo_surface_t* _tmp2_;
		_tmp1_ = self->server_group_light_surface;
		draw_draw_surface (cr, _tmp1_, self->image_x, 0, 0, self->height);
		_tmp2_ = self->arrow_light_surface;
		draw_draw_surface (cr, _tmp2_, self->arrow_x, 0, 0, self->height);
	} else {
		cairo_surface_t* _tmp3_;
		cairo_surface_t* _tmp4_;
		_tmp3_ = self->server_group_dark_surface;
		draw_draw_surface (cr, _tmp3_, self->image_x, 0, 0, self->height);
		_tmp4_ = self->arrow_dark_surface;
		draw_draw_surface (cr, _tmp4_, self->arrow_x, 0, 0, self->height);
	}
	if (is_light_theme) {
		GdkRGBA _tmp5_;
		_tmp5_ = self->title_light_color;
		utils_set_context_color (cr, &_tmp5_);
	} else {
		GdkRGBA _tmp6_;
		_tmp6_ = self->title_dark_color;
		utils_set_context_color (cr, &_tmp6_);
	}
	_tmp7_ = self->title;
	draw_draw_text (cr, _tmp7_, self->text_x, self->title_y, self->text_width, self->height, self->title_size, PANGO_ALIGN_LEFT, "top", NULL);
	if (is_light_theme) {
		GdkRGBA _tmp8_;
		_tmp8_ = self->content_light_color;
		utils_set_context_color (cr, &_tmp8_);
	} else {
		GdkRGBA _tmp9_;
		_tmp9_ = self->content_dark_color;
		utils_set_context_color (cr, &_tmp9_);
	}
	if (self->server_number > 1) {
		gchar* _tmp10_;
		_tmp10_ = g_strdup_printf ("%i servers", self->server_number);
		_g_free0 (content);
		content = _tmp10_;
	} else {
		gchar* _tmp11_;
		_tmp11_ = g_strdup ("1 server");
		_g_free0 (content);
		content = _tmp11_;
	}
	_tmp12_ = content;
	draw_draw_text (cr, _tmp12_, self->text_x, self->content_y, self->text_width, self->height, self->content_size, PANGO_ALIGN_LEFT, "top", NULL);
	if (self->display_bottom_line) {
		if (is_light_theme) {
			GdkRGBA _tmp13_;
			_tmp13_ = self->line_light_color;
			utils_set_context_color (cr, &_tmp13_);
		} else {
			GdkRGBA _tmp14_;
			_tmp14_ = self->line_dark_color;
			utils_set_context_color (cr, &_tmp14_);
		}
		draw_draw_rectangle (cr, 8, self->height - 1, self->width - 16, 1, TRUE);
	}
	if (((WidgetsClickEventBox*) self)->is_press) {
		if (is_light_theme) {
			GdkRGBA _tmp15_;
			_tmp15_ = self->press_light_color;
			utils_set_context_color (cr, &_tmp15_);
		} else {
			GdkRGBA _tmp16_;
			_tmp16_ = self->content_dark_color;
			utils_set_context_color (cr, &_tmp16_);
		}
		draw_draw_rectangle (cr, 0, 0, self->width, self->height, TRUE);
	} else {
		if (self->is_hover) {
			if (is_light_theme) {
				GdkRGBA _tmp17_;
				_tmp17_ = self->hover_light_color;
				utils_set_context_color (cr, &_tmp17_);
			} else {
				GdkRGBA _tmp18_;
				_tmp18_ = self->hover_dark_color;
				utils_set_context_color (cr, &_tmp18_);
			}
			draw_draw_rectangle (cr, 0, 0, self->width, self->height, TRUE);
		}
	}
	result = TRUE;
	_g_free0 (content);
	return result;
}

static void
widgets_server_group_button_class_init (WidgetsServerGroupButtonClass * klass,
                                        gpointer klass_data)
{
	widgets_server_group_button_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = widgets_server_group_button_finalize;
	widgets_server_group_button_signals[WIDGETS_SERVER_GROUP_BUTTON_SHOW_GROUP_SERVERS_SIGNAL] = g_signal_new ("show-group-servers", WIDGETS_TYPE_SERVER_GROUP_BUTTON, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
widgets_server_group_button_instance_init (WidgetsServerGroupButton * self,
                                           gpointer klass)
{
	self->display_bottom_line = TRUE;
	self->is_hover = FALSE;
	self->arrow_x = constant_SLIDER_WIDTH - 22;
	self->content_size = 10;
	self->content_y = 27;
	self->height = 56;
	self->image_x = 12;
	self->text_width = constant_SLIDER_PANEL_TEXT_WIDTH;
	self->text_x = 72;
	self->title_size = 11;
	self->title_y = 5;
	self->width = constant_SLIDER_WIDTH;
}

static void
widgets_server_group_button_finalize (GObject * obj)
{
	WidgetsServerGroupButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_SERVER_GROUP_BUTTON, WidgetsServerGroupButton);
	_cairo_surface_destroy0 (self->arrow_dark_surface);
	_cairo_surface_destroy0 (self->arrow_light_surface);
	_cairo_surface_destroy0 (self->server_group_dark_surface);
	_cairo_surface_destroy0 (self->server_group_light_surface);
	_g_free0 (self->title);
	G_OBJECT_CLASS (widgets_server_group_button_parent_class)->finalize (obj);
}

static GType
widgets_server_group_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsServerGroupButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_server_group_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsServerGroupButton), 0, (GInstanceInitFunc) widgets_server_group_button_instance_init, NULL };
	GType widgets_server_group_button_type_id;
	widgets_server_group_button_type_id = g_type_register_static (WIDGETS_TYPE_CLICK_EVENT_BOX, "WidgetsServerGroupButton", &g_define_type_info, 0);
	return widgets_server_group_button_type_id;
}

GType
widgets_server_group_button_get_type (void)
{
	static volatile gsize widgets_server_group_button_type_id__once = 0;
	if (g_once_init_enter (&widgets_server_group_button_type_id__once)) {
		GType widgets_server_group_button_type_id;
		widgets_server_group_button_type_id = widgets_server_group_button_get_type_once ();
		g_once_init_leave (&widgets_server_group_button_type_id__once, widgets_server_group_button_type_id);
	}
	return widgets_server_group_button_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

