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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    For copyright information, see AUTHORS.

    Déjà Dup 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
    (at your option) any later version.

    Déjà Dup 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 Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include "deja.h"

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define DEJA_DUP_TYPE_SHELL_ENV (deja_dup_shell_env_get_type ())

#define DEJA_DUP_TYPE_GNOME_SHELL (deja_dup_gnome_shell_get_type ())
#define DEJA_DUP_GNOME_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_GNOME_SHELL, DejaDupGnomeShell))
#define DEJA_DUP_IS_GNOME_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_GNOME_SHELL))
#define DEJA_DUP_GNOME_SHELL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), DEJA_DUP_TYPE_GNOME_SHELL, DejaDupGnomeShellIface))

typedef struct _DejaDupGnomeShell DejaDupGnomeShell;
typedef struct _DejaDupGnomeShellIface DejaDupGnomeShellIface;

#define DEJA_DUP_TYPE_GNOME_SHELL_PROXY (deja_dup_gnome_shell_proxy_get_type ())
typedef GDBusProxy DejaDupGnomeShellProxy;
typedef GDBusProxyClass DejaDupGnomeShellProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
typedef struct _Block4Data Block4Data;

typedef enum  {
	DEJA_DUP_SHELL_ENV_NONE,
	DEJA_DUP_SHELL_ENV_GNOME,
	DEJA_DUP_SHELL_ENV_UNITY,
	DEJA_DUP_SHELL_ENV_LEGACY
} DejaDupShellEnv;

struct _DejaDupGnomeShellIface {
	GTypeInterface parent_iface;
	gchar* (*get_ShellVersion) (DejaDupGnomeShell* self);
};

struct _Block4Data {
	int _ref_count_;
	GtkWidget* w;
};


extern DejaDupShellEnv deja_dup_shell;
DejaDupShellEnv deja_dup_shell = DEJA_DUP_SHELL_ENV_NONE;

GList* notify_get_server_caps (void);
void deja_dup_show_uri (GtkWindow* parent, const gchar* link);
void deja_dup_destroy_widget (GtkWidget* w);
GType deja_dup_shell_env_get_type (void) G_GNUC_CONST;
GType deja_dup_gnome_shell_get_type (void) G_GNUC_CONST;
GType deja_dup_gnome_shell_proxy_get_type (void) G_GNUC_CONST;
guint deja_dup_gnome_shell_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
gchar* deja_dup_gnome_shell_get_ShellVersion (DejaDupGnomeShell* self);
static void deja_dup_gnome_shell_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
static gchar* deja_dup_gnome_shell_dbus_proxy_get_ShellVersion (DejaDupGnomeShell* self);
static void deja_dup_gnome_shell_proxy_deja_dup_gnome_shell_interface_init (DejaDupGnomeShellIface* iface);
static void deja_dup_gnome_shell_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
static GVariant* deja_dup_gnome_shell_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
static GVariant* _dbus_deja_dup_gnome_shell_get_ShellVersion (DejaDupGnomeShell* self);
static gboolean deja_dup_gnome_shell_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
static void _deja_dup_gnome_shell_unregister_object (gpointer user_data);
DejaDupShellEnv deja_dup_get_shell (void);
static void _g_free0_ (gpointer var);
static void _g_list_free__g_free0_ (GList* self);
gboolean deja_dup_user_focused (GtkWidget* win, GdkEventFocus* e);
static gboolean _deja_dup_user_focused_gtk_widget_focus_in_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self);
void deja_dup_show_background_window_for_shell (GtkWindow* win);
void deja_dup_hide_background_window_for_shell (GtkWindow* win);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static gboolean __lambda4_ (Block4Data* _data4_);
static gboolean ___lambda4__gsource_func (gpointer self);
gboolean deja_dup_gui_initialize (GtkWindow* parent, gboolean show_error);

static const GDBusMethodInfo * const _deja_dup_gnome_shell_dbus_method_info[] = {NULL};
static const GDBusSignalInfo * const _deja_dup_gnome_shell_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _deja_dup_gnome_shell_dbus_property_info_ShellVersion = {-1, "ShellVersion", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE};
static const GDBusPropertyInfo * const _deja_dup_gnome_shell_dbus_property_info[] = {&_deja_dup_gnome_shell_dbus_property_info_ShellVersion, NULL};
static const GDBusInterfaceInfo _deja_dup_gnome_shell_dbus_interface_info = {-1, "org.gnome.Shell", (GDBusMethodInfo **) (&_deja_dup_gnome_shell_dbus_method_info), (GDBusSignalInfo **) (&_deja_dup_gnome_shell_dbus_signal_info), (GDBusPropertyInfo **) (&_deja_dup_gnome_shell_dbus_property_info)};
static const GDBusInterfaceVTable _deja_dup_gnome_shell_dbus_interface_vtable = {deja_dup_gnome_shell_dbus_interface_method_call, deja_dup_gnome_shell_dbus_interface_get_property, deja_dup_gnome_shell_dbus_interface_set_property};

void deja_dup_show_uri (GtkWindow* parent, const gchar* link) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (link != NULL);
	{
		GdkScreen* _tmp0_ = NULL;
		GtkWindow* _tmp1_ = NULL;
		const gchar* _tmp4_ = NULL;
		guint32 _tmp5_ = 0U;
		_tmp1_ = parent;
		if (_tmp1_ == NULL) {
			_tmp0_ = NULL;
		} else {
			GtkWindow* _tmp2_ = NULL;
			GdkScreen* _tmp3_ = NULL;
			_tmp2_ = parent;
			_tmp3_ = gtk_window_get_screen (_tmp2_);
			_tmp0_ = _tmp3_;
		}
		_tmp4_ = link;
		_tmp5_ = gtk_get_current_event_time ();
		gtk_show_uri (_tmp0_, _tmp4_, _tmp5_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch4_g_error;
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* e = NULL;
		GtkMessageDialog* dlg = NULL;
		GtkWindow* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		GtkMessageDialog* _tmp9_ = NULL;
		GtkMessageDialog* _tmp10_ = NULL;
		GError* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		GtkMessageDialog* _tmp13_ = NULL;
		GtkMessageDialog* _tmp14_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = parent;
		_tmp7_ = _ ("Could not display %s");
		_tmp8_ = link;
		_tmp9_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp6_, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _tmp7_, _tmp8_);
		g_object_ref_sink (_tmp9_);
		dlg = _tmp9_;
		_tmp10_ = dlg;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		gtk_message_dialog_format_secondary_text (_tmp10_, "%s", _tmp12_);
		_tmp13_ = dlg;
		gtk_dialog_run ((GtkDialog*) _tmp13_);
		_tmp14_ = dlg;
		deja_dup_destroy_widget ((GtkWidget*) _tmp14_);
		_g_object_unref0 (dlg);
		_g_error_free0 (e);
	}
	__finally4:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


GType deja_dup_shell_env_get_type (void) {
	static volatile gsize deja_dup_shell_env_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_shell_env_type_id__volatile)) {
		static const GEnumValue values[] = {{DEJA_DUP_SHELL_ENV_NONE, "DEJA_DUP_SHELL_ENV_NONE", "none"}, {DEJA_DUP_SHELL_ENV_GNOME, "DEJA_DUP_SHELL_ENV_GNOME", "gnome"}, {DEJA_DUP_SHELL_ENV_UNITY, "DEJA_DUP_SHELL_ENV_UNITY", "unity"}, {DEJA_DUP_SHELL_ENV_LEGACY, "DEJA_DUP_SHELL_ENV_LEGACY", "legacy"}, {0, NULL, NULL}};
		GType deja_dup_shell_env_type_id;
		deja_dup_shell_env_type_id = g_enum_register_static ("DejaDupShellEnv", values);
		g_once_init_leave (&deja_dup_shell_env_type_id__volatile, deja_dup_shell_env_type_id);
	}
	return deja_dup_shell_env_type_id__volatile;
}


gchar* deja_dup_gnome_shell_get_ShellVersion (DejaDupGnomeShell* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return DEJA_DUP_GNOME_SHELL_GET_INTERFACE (self)->get_ShellVersion (self);
}


static void deja_dup_gnome_shell_base_init (DejaDupGnomeShellIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


GType deja_dup_gnome_shell_get_type (void) {
	static volatile gsize deja_dup_gnome_shell_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_gnome_shell_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupGnomeShellIface), (GBaseInitFunc) deja_dup_gnome_shell_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType deja_dup_gnome_shell_type_id;
		deja_dup_gnome_shell_type_id = g_type_register_static (G_TYPE_INTERFACE, "DejaDupGnomeShell", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (deja_dup_gnome_shell_type_id, G_TYPE_OBJECT);
		g_type_set_qdata (deja_dup_gnome_shell_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) deja_dup_gnome_shell_proxy_get_type);
		g_type_set_qdata (deja_dup_gnome_shell_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Shell");
		g_type_set_qdata (deja_dup_gnome_shell_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_deja_dup_gnome_shell_dbus_interface_info));
		g_type_set_qdata (deja_dup_gnome_shell_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) deja_dup_gnome_shell_register_object);
		g_once_init_leave (&deja_dup_gnome_shell_type_id__volatile, deja_dup_gnome_shell_type_id);
	}
	return deja_dup_gnome_shell_type_id__volatile;
}


G_DEFINE_TYPE_EXTENDED (DejaDupGnomeShellProxy, deja_dup_gnome_shell_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (DEJA_DUP_TYPE_GNOME_SHELL, deja_dup_gnome_shell_proxy_deja_dup_gnome_shell_interface_init) )
static void deja_dup_gnome_shell_proxy_class_init (DejaDupGnomeShellProxyClass* klass) {
	G_DBUS_PROXY_CLASS (klass)->g_signal = deja_dup_gnome_shell_proxy_g_signal;
}


static void deja_dup_gnome_shell_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
}


static void deja_dup_gnome_shell_proxy_init (DejaDupGnomeShellProxy* self) {
}


static gchar* deja_dup_gnome_shell_dbus_proxy_get_ShellVersion (DejaDupGnomeShell* self) {
	GVariant *_inner_reply;
	gchar* _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "ShellVersion");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.gnome.Shell"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ShellVersion"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			return NULL;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_dup_string (_inner_reply, NULL);
	g_variant_unref (_inner_reply);
	return _result;
}


static void deja_dup_gnome_shell_proxy_deja_dup_gnome_shell_interface_init (DejaDupGnomeShellIface* iface) {
	iface->get_ShellVersion = deja_dup_gnome_shell_dbus_proxy_get_ShellVersion;
}


static void deja_dup_gnome_shell_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	g_object_unref (invocation);
}


static GVariant* _dbus_deja_dup_gnome_shell_get_ShellVersion (DejaDupGnomeShell* self) {
	gchar* result;
	GVariant* _reply;
	result = deja_dup_gnome_shell_get_ShellVersion (self);
	_reply = g_variant_new_string (result);
	_g_free0 (result);
	return _reply;
}


static GVariant* deja_dup_gnome_shell_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (property_name, "ShellVersion") == 0) {
		return _dbus_deja_dup_gnome_shell_get_ShellVersion (object);
	}
	return NULL;
}


static gboolean deja_dup_gnome_shell_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}


guint deja_dup_gnome_shell_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_deja_dup_gnome_shell_dbus_interface_info), &_deja_dup_gnome_shell_dbus_interface_vtable, data, _deja_dup_gnome_shell_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void _deja_dup_gnome_shell_unregister_object (gpointer user_data) {
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _g_list_free__g_free0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_free0_, NULL);
	g_list_free (self);
}


DejaDupShellEnv deja_dup_get_shell (void) {
	DejaDupShellEnv result = 0;
	DejaDupShellEnv _tmp0_ = 0;
	DejaDupShellEnv _tmp14_ = 0;
	GError * _inner_error_ = NULL;
	_tmp0_ = deja_dup_shell;
	if (_tmp0_ == DEJA_DUP_SHELL_ENV_NONE) {
		{
			GList* caps = NULL;
			GList* _tmp1_ = NULL;
			gboolean persistence = FALSE;
			gboolean actions = FALSE;
			GList* _tmp2_ = NULL;
			gboolean _tmp6_ = FALSE;
			gboolean _tmp7_ = FALSE;
			deja_dup_shell = DEJA_DUP_SHELL_ENV_LEGACY;
			_tmp1_ = notify_get_server_caps ();
			caps = _tmp1_;
			persistence = FALSE;
			actions = FALSE;
			_tmp2_ = caps;
			{
				GList* cap_collection = NULL;
				GList* cap_it = NULL;
				cap_collection = _tmp2_;
				for (cap_it = cap_collection; cap_it != NULL; cap_it = cap_it->next) {
					gchar* _tmp3_ = NULL;
					gchar* cap = NULL;
					_tmp3_ = g_strdup ((const gchar*) cap_it->data);
					cap = _tmp3_;
					{
						const gchar* _tmp4_ = NULL;
						_tmp4_ = cap;
						if (g_strcmp0 (_tmp4_, "persistence") == 0) {
							persistence = TRUE;
						} else {
							const gchar* _tmp5_ = NULL;
							_tmp5_ = cap;
							if (g_strcmp0 (_tmp5_, "actions") == 0) {
								actions = TRUE;
							}
						}
						_g_free0 (cap);
					}
				}
			}
			_tmp7_ = persistence;
			if (_tmp7_) {
				gboolean _tmp8_ = FALSE;
				_tmp8_ = actions;
				_tmp6_ = _tmp8_;
			} else {
				_tmp6_ = FALSE;
			}
			if (_tmp6_) {
				gchar* gsv = NULL;
				const gchar* _tmp13_ = NULL;
				gsv = NULL;
				{
					DejaDupGnomeShell* gs = NULL;
					DejaDupGnomeShell* _tmp9_ = NULL;
					DejaDupGnomeShell* _tmp10_ = NULL;
					gchar* _tmp11_ = NULL;
					gchar* _tmp12_ = NULL;
					_tmp9_ = g_initable_new (DEJA_DUP_TYPE_GNOME_SHELL_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.gnome.Shell", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/gnome/Shell", "g-interface-name", "org.gnome.Shell", "g-interface-info", g_type_get_qdata (DEJA_DUP_TYPE_GNOME_SHELL, g_quark_from_static_string ("vala-dbus-interface-info")), NULL);
					gs = (DejaDupGnomeShell*) _tmp9_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						goto __catch5_g_error;
					}
					_tmp10_ = gs;
					_tmp11_ = deja_dup_gnome_shell_get_ShellVersion (_tmp10_);
					_tmp12_ = _tmp11_;
					_g_free0 (gsv);
					gsv = _tmp12_;
					_g_object_unref0 (gs);
				}
				goto __finally5;
				__catch5_g_error:
				{
					GError* e = NULL;
					e = _inner_error_;
					_inner_error_ = NULL;
					_g_error_free0 (e);
				}
				__finally5:
				if (G_UNLIKELY (_inner_error_ != NULL)) {
					_g_free0 (gsv);
					__g_list_free__g_free0_0 (caps);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
					g_clear_error (&_inner_error_);
					return 0;
				}
				_tmp13_ = gsv;
				if (_tmp13_ != NULL) {
					deja_dup_shell = DEJA_DUP_SHELL_ENV_GNOME;
				}
				_g_free0 (gsv);
			}
			__g_list_free__g_free0_0 (caps);
		}
	}
	_tmp14_ = deja_dup_shell;
	result = _tmp14_;
	return result;
}


static gboolean _deja_dup_user_focused_gtk_widget_focus_in_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self) {
	gboolean result;
	result = deja_dup_user_focused (_sender, event);
	return result;
}


gboolean deja_dup_user_focused (GtkWidget* win, GdkEventFocus* e) {
	gboolean result = FALSE;
	GtkWidget* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	guint _tmp2_ = 0U;
	g_return_val_if_fail (win != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = win;
	gtk_window_set_urgency_hint (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_window_get_type (), GtkWindow), FALSE);
	_tmp1_ = win;
	g_signal_parse_name ("focus-in-event", gtk_widget_get_type (), &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _deja_dup_user_focused_gtk_widget_focus_in_event, NULL);
	result = FALSE;
	return result;
}


void deja_dup_show_background_window_for_shell (GtkWindow* win) {
	GtkWindow* _tmp0_ = NULL;
	GtkWindow* _tmp1_ = NULL;
	GtkWindow* _tmp2_ = NULL;
	DejaDupShellEnv _tmp3_ = 0;
	g_return_if_fail (win != NULL);
	_tmp0_ = win;
	gtk_window_set_focus_on_map (_tmp0_, FALSE);
	_tmp1_ = win;
	gtk_window_set_urgency_hint (_tmp1_, TRUE);
	_tmp2_ = win;
	g_signal_connect ((GtkWidget*) _tmp2_, "focus-in-event", (GCallback) _deja_dup_user_focused_gtk_widget_focus_in_event, NULL);
	_tmp3_ = deja_dup_get_shell ();
	if (_tmp3_ == DEJA_DUP_SHELL_ENV_UNITY) {
		GtkWindow* _tmp4_ = NULL;
		GtkWindow* _tmp5_ = NULL;
		GtkWindow* _tmp6_ = NULL;
		_tmp4_ = win;
		gtk_window_iconify (_tmp4_);
		_tmp5_ = win;
		gtk_widget_show ((GtkWidget*) _tmp5_);
		_tmp6_ = win;
		gtk_window_iconify (_tmp6_);
	} else {
		GtkWindow* _tmp7_ = NULL;
		_tmp7_ = win;
		gtk_widget_show ((GtkWidget*) _tmp7_);
	}
}


void deja_dup_hide_background_window_for_shell (GtkWindow* win) {
	DejaDupShellEnv _tmp0_ = 0;
	g_return_if_fail (win != NULL);
	_tmp0_ = deja_dup_get_shell ();
	if (_tmp0_ == DEJA_DUP_SHELL_ENV_UNITY) {
		GtkWindow* _tmp1_ = NULL;
		GtkWindow* _tmp2_ = NULL;
		GtkWindow* _tmp3_ = NULL;
		_tmp1_ = win;
		gtk_window_iconify (_tmp1_);
		_tmp2_ = win;
		gtk_widget_show ((GtkWidget*) _tmp2_);
		_tmp3_ = win;
		gtk_window_iconify (_tmp3_);
	} else {
		GtkWindow* _tmp4_ = NULL;
		_tmp4_ = win;
		gtk_widget_hide ((GtkWidget*) _tmp4_);
	}
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static Block4Data* block4_data_ref (Block4Data* _data4_) {
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}


static void block4_data_unref (void * _userdata_) {
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		_g_object_unref0 (_data4_->w);
		g_slice_free (Block4Data, _data4_);
	}
}


static gboolean __lambda4_ (Block4Data* _data4_) {
	gboolean result = FALSE;
	GtkWidget* _tmp0_ = NULL;
	_tmp0_ = _data4_->w;
	gtk_widget_destroy (_tmp0_);
	result = FALSE;
	return result;
}


static gboolean ___lambda4__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda4_ (self);
	return result;
}


void deja_dup_destroy_widget (GtkWidget* w) {
	Block4Data* _data4_;
	GtkWidget* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkWidget* _tmp2_ = NULL;
	GtkWidget* _tmp3_ = NULL;
	g_return_if_fail (w != NULL);
	_data4_ = g_slice_new0 (Block4Data);
	_data4_->_ref_count_ = 1;
	_tmp0_ = w;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data4_->w);
	_data4_->w = _tmp1_;
	_tmp2_ = _data4_->w;
	gtk_widget_hide (_tmp2_);
	_tmp3_ = _data4_->w;
	g_object_ref ((GObject*) _tmp3_);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda4__gsource_func, block4_data_ref (_data4_), block4_data_unref);
	block4_data_unref (_data4_);
	_data4_ = NULL;
}


gboolean deja_dup_gui_initialize (GtkWindow* parent, gboolean show_error) {
	gboolean result = FALSE;
	gchar* header = NULL;
	gchar* msg = NULL;
	gboolean rv = FALSE;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	_tmp2_ = deja_dup_initialize (&_tmp0_, &_tmp1_);
	_g_free0 (header);
	header = _tmp0_;
	_g_free0 (msg);
	msg = _tmp1_;
	rv = _tmp2_;
	_tmp4_ = rv;
	if (!_tmp4_) {
		gboolean _tmp5_ = FALSE;
		_tmp5_ = show_error;
		_tmp3_ = _tmp5_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		GtkMessageDialog* dlg = NULL;
		GtkWindow* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		GtkMessageDialog* _tmp8_ = NULL;
		GtkMessageDialog* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		GtkMessageDialog* _tmp11_ = NULL;
		GtkMessageDialog* _tmp12_ = NULL;
		_tmp6_ = parent;
		_tmp7_ = header;
		_tmp8_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp6_, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _tmp7_);
		g_object_ref_sink (_tmp8_);
		dlg = _tmp8_;
		_tmp9_ = dlg;
		_tmp10_ = msg;
		gtk_message_dialog_format_secondary_text (_tmp9_, "%s", _tmp10_);
		_tmp11_ = dlg;
		gtk_dialog_run ((GtkDialog*) _tmp11_);
		_tmp12_ = dlg;
		deja_dup_destroy_widget ((GtkWidget*) _tmp12_);
		_g_object_unref0 (dlg);
	}
	result = rv;
	_g_free0 (msg);
	_g_free0 (header);
	return result;
}



