/* Generated by GOB (v2.0.15)   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 15

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "mn-mail-icon.h"

#include "mn-mail-icon-private.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */

#line 35 "src/mn-mail-icon.gob"

#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "mn-stock.h"
#include "mn-util.h"
#include "mn-mail-icon-widget.h"

#line 34 "mn-mail-icon.c"
/* self casting macros */
#define SELF(x) MN_MAIL_ICON(x)
#define SELF_CONST(x) MN_MAIL_ICON_CONST(x)
#define IS_SELF(x) MN_IS_MAIL_ICON(x)
#define TYPE_SELF MN_TYPE_MAIL_ICON
#define SELF_CLASS(x) MN_MAIL_ICON_CLASS(x)

#define SELF_GET_CLASS(x) MN_MAIL_ICON_GET_CLASS(x)

/* self typedefs */
typedef MNMailIcon Self;
typedef MNMailIconClass SelfClass;

/* here are local prototypes */
#line 0 "src/mn-mail-icon.gob"
static void mn_mail_icon_class_init (MNMailIconClass * c);
#line 51 "mn-mail-icon.c"
#line 57 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate (MNMailIcon * self);
#line 54 "mn-mail-icon.c"
#line 59 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_mail_reader (MNMailIcon * self);
#line 57 "mn-mail-icon.c"
#line 61 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_open_latest_message (MNMailIcon * self);
#line 60 "mn-mail-icon.c"
#line 63 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_consider_new_mail_as_read (MNMailIcon * self);
#line 63 "mn-mail-icon.c"
#line 65 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_update (MNMailIcon * self);
#line 66 "mn-mail-icon.c"
#line 67 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_properties (MNMailIcon * self);
#line 69 "mn-mail-icon.c"
#line 69 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_help (MNMailIcon * self);
#line 72 "mn-mail-icon.c"
#line 71 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_about (MNMailIcon * self);
#line 75 "mn-mail-icon.c"
#line 73 "src/mn-mail-icon.gob"
static void mn_mail_icon_activate_remove (MNMailIcon * self);
#line 78 "mn-mail-icon.c"
#line 76 "src/mn-mail-icon.gob"
static void mn_mail_icon_init (MNMailIcon * self);
#line 81 "mn-mail-icon.c"
#line 131 "src/mn-mail-icon.gob"
static void mn_mail_icon_size_allocate_h (GtkWidget * widget, GtkAllocation * allocation, gpointer user_data);
#line 84 "mn-mail-icon.c"
#line 154 "src/mn-mail-icon.gob"
static GtkIconSize mn_mail_icon_find_icon_size (GtkWidget * widget, int pixel_size);
#line 87 "mn-mail-icon.c"
#line 190 "src/mn-mail-icon.gob"
static void mn_mail_icon_update_image (MNMailIcon * self);
#line 90 "mn-mail-icon.c"
#line 199 "src/mn-mail-icon.gob"
static gboolean mn_mail_icon_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data);
#line 93 "mn-mail-icon.c"
#line 217 "src/mn-mail-icon.gob"
static gboolean mn_mail_icon_button_release_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data);
#line 96 "mn-mail-icon.c"
#line 233 "src/mn-mail-icon.gob"
static void mn_mail_icon_popup_menu_position_cb (GtkMenu * menu, int * x, int * y, gboolean * push_in, gpointer user_data);
#line 99 "mn-mail-icon.c"

/*
 * Signal connection wrapper macro shortcuts
 */
#define self_connect__activate(object,func,data)	mn_mail_icon_connect__activate((object),(func),(data))
#define self_connect_after__activate(object,func,data)	mn_mail_icon_connect_after__activate((object),(func),(data))
#define self_connect_data__activate(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_mail_reader(object,func,data)	mn_mail_icon_connect__activate_mail_reader((object),(func),(data))
#define self_connect_after__activate_mail_reader(object,func,data)	mn_mail_icon_connect_after__activate_mail_reader((object),(func),(data))
#define self_connect_data__activate_mail_reader(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_mail_reader((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_open_latest_message(object,func,data)	mn_mail_icon_connect__activate_open_latest_message((object),(func),(data))
#define self_connect_after__activate_open_latest_message(object,func,data)	mn_mail_icon_connect_after__activate_open_latest_message((object),(func),(data))
#define self_connect_data__activate_open_latest_message(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_open_latest_message((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_consider_new_mail_as_read(object,func,data)	mn_mail_icon_connect__activate_consider_new_mail_as_read((object),(func),(data))
#define self_connect_after__activate_consider_new_mail_as_read(object,func,data)	mn_mail_icon_connect_after__activate_consider_new_mail_as_read((object),(func),(data))
#define self_connect_data__activate_consider_new_mail_as_read(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_consider_new_mail_as_read((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_update(object,func,data)	mn_mail_icon_connect__activate_update((object),(func),(data))
#define self_connect_after__activate_update(object,func,data)	mn_mail_icon_connect_after__activate_update((object),(func),(data))
#define self_connect_data__activate_update(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_update((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_properties(object,func,data)	mn_mail_icon_connect__activate_properties((object),(func),(data))
#define self_connect_after__activate_properties(object,func,data)	mn_mail_icon_connect_after__activate_properties((object),(func),(data))
#define self_connect_data__activate_properties(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_properties((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_help(object,func,data)	mn_mail_icon_connect__activate_help((object),(func),(data))
#define self_connect_after__activate_help(object,func,data)	mn_mail_icon_connect_after__activate_help((object),(func),(data))
#define self_connect_data__activate_help(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_help((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_about(object,func,data)	mn_mail_icon_connect__activate_about((object),(func),(data))
#define self_connect_after__activate_about(object,func,data)	mn_mail_icon_connect_after__activate_about((object),(func),(data))
#define self_connect_data__activate_about(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_about((object),(func),(data),(destroy_data),(flags))
#define self_connect__activate_remove(object,func,data)	mn_mail_icon_connect__activate_remove((object),(func),(data))
#define self_connect_after__activate_remove(object,func,data)	mn_mail_icon_connect_after__activate_remove((object),(func),(data))
#define self_connect_data__activate_remove(object,func,data,destroy_data,flags)	mn_mail_icon_connect_data__activate_remove((object),(func),(data),(destroy_data),(flags))

enum {
	ACTIVATE_SIGNAL,
	ACTIVATE_MAIL_READER_SIGNAL,
	ACTIVATE_OPEN_LATEST_MESSAGE_SIGNAL,
	ACTIVATE_CONSIDER_NEW_MAIL_AS_READ_SIGNAL,
	ACTIVATE_UPDATE_SIGNAL,
	ACTIVATE_PROPERTIES_SIGNAL,
	ACTIVATE_HELP_SIGNAL,
	ACTIVATE_ABOUT_SIGNAL,
	ACTIVATE_REMOVE_SIGNAL,
	LAST_SIGNAL
};

static guint object_signals[LAST_SIGNAL] = {0};

/* pointer to the class of our parent */
static EggTrayIconClass *parent_class = NULL;

/* Short form macros */
#define self_activate mn_mail_icon_activate
#define self_activate_mail_reader mn_mail_icon_activate_mail_reader
#define self_activate_open_latest_message mn_mail_icon_activate_open_latest_message
#define self_activate_consider_new_mail_as_read mn_mail_icon_activate_consider_new_mail_as_read
#define self_activate_update mn_mail_icon_activate_update
#define self_activate_properties mn_mail_icon_activate_properties
#define self_activate_help mn_mail_icon_activate_help
#define self_activate_about mn_mail_icon_activate_about
#define self_activate_remove mn_mail_icon_activate_remove
#define self_size_allocate_h mn_mail_icon_size_allocate_h
#define self_find_icon_size mn_mail_icon_find_icon_size
#define self_update_image mn_mail_icon_update_image
#define self_button_press_event_h mn_mail_icon_button_press_event_h
#define self_button_release_event_h mn_mail_icon_button_release_event_h
#define self_popup_menu_position_cb mn_mail_icon_popup_menu_position_cb
#define self_set_from_stock mn_mail_icon_set_from_stock
#define self_set_blinking mn_mail_icon_set_blinking
#define self_set_count mn_mail_icon_set_count
#define self_set_tip mn_mail_icon_set_tip
#define self_set_tip_widget mn_mail_icon_set_tip_widget
#define self_new mn_mail_icon_new
GType
mn_mail_icon_get_type (void)
{
	static GType type = 0;

	if ___GOB_UNLIKELY(type == 0) {
		static const GTypeInfo info = {
			sizeof (MNMailIconClass),
			(GBaseInitFunc) NULL,
			(GBaseFinalizeFunc) NULL,
			(GClassInitFunc) mn_mail_icon_class_init,
			(GClassFinalizeFunc) NULL,
			NULL /* class_data */,
			sizeof (MNMailIcon),
			0 /* n_preallocs */,
			(GInstanceInitFunc) mn_mail_icon_init,
			NULL
		};

		type = g_type_register_static (EGG_TYPE_TRAY_ICON, "MNMailIcon", &info, (GTypeFlags)0);
	}

	return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((MNMailIcon *)g_object_new(mn_mail_icon_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static MNMailIcon * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static MNMailIcon *
GET_NEW_VARG (const char *first, ...)
{
	MNMailIcon *ret;
	va_list ap;
	va_start (ap, first);
	ret = (MNMailIcon *)g_object_new_valist (mn_mail_icon_get_type (), first, ap);
	va_end (ap);
	return ret;
}


static void
___dispose (GObject *obj_self)
{
#define __GOB_FUNCTION__ "MN:Mail:Icon::dispose"
	MNMailIcon *self G_GNUC_UNUSED = MN_MAIL_ICON (obj_self);
	if (G_OBJECT_CLASS (parent_class)->dispose) \
		(* G_OBJECT_CLASS (parent_class)->dispose) (obj_self);
#line 45 "src/mn-mail-icon.gob"
	if(self->_priv->tooltips) { g_object_unref ((gpointer) self->_priv->tooltips); self->_priv->tooltips = NULL; }
#line 224 "mn-mail-icon.c"
}
#undef __GOB_FUNCTION__


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "MN:Mail:Icon::finalize"
	MNMailIcon *self G_GNUC_UNUSED = MN_MAIL_ICON (obj_self);
	gpointer priv G_GNUC_UNUSED = self->_priv;
	if(G_OBJECT_CLASS(parent_class)->finalize) \
		(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
#line 48 "src/mn-mail-icon.gob"
	if(self->_priv->stock_id) { g_free ((gpointer) self->_priv->stock_id); self->_priv->stock_id = NULL; }
#line 239 "mn-mail-icon.c"
#line 51 "src/mn-mail-icon.gob"
	if(self->_priv->menu) { gtk_widget_destroy ((gpointer) self->_priv->menu); self->_priv->menu = NULL; }
#line 242 "mn-mail-icon.c"
}
#undef __GOB_FUNCTION__

static void 
mn_mail_icon_class_init (MNMailIconClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "MN:Mail:Icon::class_init"
	GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

	g_type_class_add_private(c,sizeof(MNMailIconPrivate));

	parent_class = g_type_class_ref (EGG_TYPE_TRAY_ICON);

	object_signals[ACTIVATE_SIGNAL] =
		g_signal_new ("activate",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_MAIL_READER_SIGNAL] =
		g_signal_new ("activate_mail_reader",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_mail_reader),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_OPEN_LATEST_MESSAGE_SIGNAL] =
		g_signal_new ("activate_open_latest_message",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_open_latest_message),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_CONSIDER_NEW_MAIL_AS_READ_SIGNAL] =
		g_signal_new ("activate_consider_new_mail_as_read",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_consider_new_mail_as_read),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_UPDATE_SIGNAL] =
		g_signal_new ("activate_update",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_update),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_PROPERTIES_SIGNAL] =
		g_signal_new ("activate_properties",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_properties),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_HELP_SIGNAL] =
		g_signal_new ("activate_help",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_help),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_ABOUT_SIGNAL] =
		g_signal_new ("activate_about",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_about),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);
	object_signals[ACTIVATE_REMOVE_SIGNAL] =
		g_signal_new ("activate_remove",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (MNMailIconClass, activate_remove),
			NULL, NULL,
			g_cclosure_marshal_VOID__VOID,
			G_TYPE_NONE, 0);

	c->activate = NULL;
	c->activate_mail_reader = NULL;
	c->activate_open_latest_message = NULL;
	c->activate_consider_new_mail_as_read = NULL;
	c->activate_update = NULL;
	c->activate_properties = NULL;
	c->activate_help = NULL;
	c->activate_about = NULL;
	c->activate_remove = NULL;
	g_object_class->dispose = ___dispose;
	g_object_class->finalize = ___finalize;
}
#undef __GOB_FUNCTION__
#line 76 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_init (MNMailIcon * self G_GNUC_UNUSED)
{
#line 346 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::init"
	self->_priv = G_TYPE_INSTANCE_GET_PRIVATE(self,MN_TYPE_MAIL_ICON,MNMailIconPrivate);
#line 45 "src/mn-mail-icon.gob"
	self->_priv->tooltips = mn_tooltips_new();
#line 351 "mn-mail-icon.c"
#line 46 "src/mn-mail-icon.gob"
	self->_priv->widget = mn_mail_icon_widget_new();
#line 354 "mn-mail-icon.c"
#line 51 "src/mn-mail-icon.gob"
	self->_priv->menu = gtk_menu_new();
#line 357 "mn-mail-icon.c"
 {
#line 77 "src/mn-mail-icon.gob"

    GtkMenuShell *shell;
    GtkWidget *properties_item;
    GtkWidget *help_item;
    GtkWidget *about_item;
    GtkWidget *remove_item;

    shell = GTK_MENU_SHELL(selfp->menu);
    /* translators: header capitalization */
    self->mail_reader_item = mn_menu_shell_append(shell, MN_STOCK_MAIL_READER, _("_Mail Reader"));
    /* translators: header capitalization */
    self->open_latest_message_item = mn_menu_shell_append(shell, MN_STOCK_OPEN_MESSAGE, _("_Open Latest Message"));

    mn_menu_shell_append(shell, NULL, NULL);

    /* translators: header capitalization */
    self->consider_new_mail_as_read_item = mn_menu_shell_append(shell, MN_STOCK_CONSIDER_NEW_MAIL_AS_READ, _("_Consider New Mail as Read"));
    /* translators: header capitalization */
    self->update_item = mn_menu_shell_append(shell, GTK_STOCK_REFRESH, _("_Update"));

    mn_menu_shell_append(shell, NULL, NULL);

    properties_item = mn_menu_shell_append(shell, GTK_STOCK_PROPERTIES, NULL);
    help_item = mn_menu_shell_append(shell, GTK_STOCK_HELP, NULL);
    about_item = mn_menu_shell_append(shell, GTK_STOCK_ABOUT, NULL);

    mn_menu_shell_append(shell, NULL, NULL);

    /* translators: header capitalization */
    remove_item = mn_menu_shell_append(shell, GTK_STOCK_REMOVE, _("R_emove From Notification Area"));

    g_signal_connect_swapped(self->mail_reader_item, "activate", G_CALLBACK(self_activate_mail_reader), self);
    g_signal_connect_swapped(self->open_latest_message_item, "activate", G_CALLBACK(self_activate_open_latest_message), self);
    g_signal_connect_swapped(self->consider_new_mail_as_read_item, "activate", G_CALLBACK(self_activate_consider_new_mail_as_read), self);
    g_signal_connect_swapped(self->update_item, "activate", G_CALLBACK(self_activate_update), self);
    g_signal_connect_swapped(properties_item, "activate", G_CALLBACK(self_activate_properties), self);
    g_signal_connect_swapped(help_item, "activate", G_CALLBACK(self_activate_help), self);
    g_signal_connect_swapped(about_item, "activate", G_CALLBACK(self_activate_about), self);
    g_signal_connect_swapped(remove_item, "activate", G_CALLBACK(self_activate_remove), self);

    gtk_widget_add_events(GTK_WIDGET(self), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);

    gtk_container_add(GTK_CONTAINER(self), selfp->widget);

    g_object_connect(self,
		     "signal::button-press-event", self_button_press_event_h, self,
		     "signal::button-release-event", self_button_release_event_h, self,
		     NULL);

    g_signal_connect(selfp->widget, "size-allocate", G_CALLBACK(self_size_allocate_h), self);

    gtk_widget_show(selfp->widget);
  
#line 413 "mn-mail-icon.c"
 }
}
#undef __GOB_FUNCTION__


#line 57 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate (MNMailIcon * self)
{
#line 423 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 57 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 57 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 434 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 59 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_mail_reader (MNMailIcon * self)
{
#line 452 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 59 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 59 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 463 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_MAIL_READER_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 61 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_open_latest_message (MNMailIcon * self)
{
#line 481 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 61 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 61 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 492 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_OPEN_LATEST_MESSAGE_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 63 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_consider_new_mail_as_read (MNMailIcon * self)
{
#line 510 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 63 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 63 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 521 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_CONSIDER_NEW_MAIL_AS_READ_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 65 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_update (MNMailIcon * self)
{
#line 539 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 65 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 65 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 550 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_UPDATE_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 67 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_properties (MNMailIcon * self)
{
#line 568 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 67 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 67 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 579 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_PROPERTIES_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 69 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_help (MNMailIcon * self)
{
#line 597 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 69 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 69 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 608 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_HELP_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 71 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_about (MNMailIcon * self)
{
#line 626 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 71 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 71 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 637 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_ABOUT_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}

#line 73 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_activate_remove (MNMailIcon * self)
{
#line 655 "mn-mail-icon.c"
	GValue ___param_values[1];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 73 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 73 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 666 "mn-mail-icon.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	g_signal_emitv (___param_values,
		object_signals[ACTIVATE_REMOVE_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
}


#line 131 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_size_allocate_h (GtkWidget * widget, GtkAllocation * allocation, gpointer user_data)
{
#line 685 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::size_allocate_h"
{
#line 135 "src/mn-mail-icon.gob"
	
    Self *self = user_data;
    GtkOrientation orientation;
    int size;

    orientation = egg_tray_icon_get_orientation(EGG_TRAY_ICON(self));

    if (orientation == GTK_ORIENTATION_HORIZONTAL)
      size = allocation->height;
    else
      size = allocation->width;

    if (selfp->size != size)
      {
	selfp->size = size;
	self_update_image(self);
      }
  }}
#line 707 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 154 "src/mn-mail-icon.gob"
static GtkIconSize 
mn_mail_icon_find_icon_size (GtkWidget * widget, int pixel_size)
{
#line 714 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::find_icon_size"
#line 154 "src/mn-mail-icon.gob"
	g_return_val_if_fail (widget != NULL, (GtkIconSize )0);
#line 154 "src/mn-mail-icon.gob"
	g_return_val_if_fail (GTK_IS_WIDGET (widget), (GtkIconSize )0);
#line 720 "mn-mail-icon.c"
{
#line 156 "src/mn-mail-icon.gob"
	
    GdkScreen *screen;
    GtkSettings *settings;
    GtkIconSize s, size;
    int w, h, d, dist;

    screen = gtk_widget_get_screen(widget);

    if (! screen)
      return GTK_ICON_SIZE_MENU;

    settings = gtk_settings_get_for_screen(screen);

    dist = G_MAXINT;
    size = GTK_ICON_SIZE_MENU;

    for (s = GTK_ICON_SIZE_MENU; s < GTK_ICON_SIZE_DIALOG; s++)
      {
	if (gtk_icon_size_lookup_for_settings(settings, s, &w, &h)
	    && w <= pixel_size
	    && h <= pixel_size)
	  {
	    d = MAX(pixel_size - w, pixel_size - h);
	    if (d < dist)
	      {
		dist = d;
		size = s;
	      }
	  }
      }

    return size;
  }}
#line 756 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 190 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_update_image (MNMailIcon * self)
{
#line 763 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::update_image"
#line 190 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 190 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 769 "mn-mail-icon.c"
{
#line 192 "src/mn-mail-icon.gob"
	
    GtkIconSize size;

    size = self_find_icon_size(selfp->widget, selfp->size);
    mn_mail_icon_widget_set_from_stock(MN_MAIL_ICON_WIDGET(selfp->widget), selfp->stock_id, size);
  }}
#line 778 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 199 "src/mn-mail-icon.gob"
static gboolean 
mn_mail_icon_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
{
#line 785 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::button_press_event_h"
{
#line 203 "src/mn-mail-icon.gob"
	
    Self *self = user_data;

    if (event->button == 1)
      self_activate(self);
    else if (event->button == 3)
      {
	gtk_menu_popup(GTK_MENU(selfp->menu), NULL, NULL, self_popup_menu_position_cb, self, event->button, event->time);
	return TRUE;		/* do not propagate event */
      }

    return FALSE;		/* propagate event */
  }}
#line 802 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 217 "src/mn-mail-icon.gob"
static gboolean 
mn_mail_icon_button_release_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
{
#line 809 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::button_release_event_h"
{
#line 221 "src/mn-mail-icon.gob"
	
    Self *self = user_data;

    if (event->button == 3)
      {
	gtk_menu_popdown(GTK_MENU(selfp->menu));
	return TRUE;		/* do not propagate event */
      }

    return FALSE;		/* propagate event */
  }}
#line 824 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 233 "src/mn-mail-icon.gob"
static void 
mn_mail_icon_popup_menu_position_cb (GtkMenu * menu, int * x, int * y, gboolean * push_in, gpointer user_data)
{
#line 831 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::popup_menu_position_cb"
{
#line 239 "src/mn-mail-icon.gob"
	
    GtkWidget *widget = user_data;

    gdk_window_get_origin(widget->window, x, y);

    *x += widget->allocation.x;
    *y += widget->allocation.y;

    if (*y > gdk_screen_get_height(gtk_widget_get_screen(widget)) / 2)
      {
	GtkRequisition req;

	gtk_widget_size_request(GTK_WIDGET(menu), &req);
	*y -= req.height;
      }
    else
      *y += widget->allocation.height;

    *push_in = TRUE;
  }}
#line 855 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 260 "src/mn-mail-icon.gob"
void 
mn_mail_icon_set_from_stock (MNMailIcon * self, const char * stock_id)
{
#line 862 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::set_from_stock"
#line 260 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 260 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 868 "mn-mail-icon.c"
{
#line 262 "src/mn-mail-icon.gob"
	
    g_free(selfp->stock_id);
    selfp->stock_id = g_strdup(stock_id);

    self_update_image(self);
  }}
#line 877 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 269 "src/mn-mail-icon.gob"
void 
mn_mail_icon_set_blinking (MNMailIcon * self, gboolean blinking)
{
#line 884 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::set_blinking"
#line 269 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 269 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 890 "mn-mail-icon.c"
{
#line 271 "src/mn-mail-icon.gob"
	
    mn_mail_icon_widget_set_blinking(MN_MAIL_ICON_WIDGET(selfp->widget), blinking);
  }}
#line 896 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 275 "src/mn-mail-icon.gob"
void 
mn_mail_icon_set_count (MNMailIcon * self, int count)
{
#line 903 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::set_count"
#line 275 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 275 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 909 "mn-mail-icon.c"
{
#line 277 "src/mn-mail-icon.gob"
	
    mn_mail_icon_widget_set_count(MN_MAIL_ICON_WIDGET(selfp->widget), count);
  }}
#line 915 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 281 "src/mn-mail-icon.gob"
void 
mn_mail_icon_set_tip (MNMailIcon * self, const char * tip)
{
#line 922 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::set_tip"
#line 281 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 281 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 928 "mn-mail-icon.c"
{
#line 283 "src/mn-mail-icon.gob"
	
    mn_tooltips_set_tip(selfp->tooltips, GTK_WIDGET(self), tip);
  }}
#line 934 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 287 "src/mn-mail-icon.gob"
void 
mn_mail_icon_set_tip_widget (MNMailIcon * self, GtkWidget * tip_widget)
{
#line 941 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::set_tip_widget"
#line 287 "src/mn-mail-icon.gob"
	g_return_if_fail (self != NULL);
#line 287 "src/mn-mail-icon.gob"
	g_return_if_fail (MN_IS_MAIL_ICON (self));
#line 947 "mn-mail-icon.c"
{
#line 289 "src/mn-mail-icon.gob"
	
    mn_tooltips_set_tip_widget(selfp->tooltips, GTK_WIDGET(self), tip_widget);
  }}
#line 953 "mn-mail-icon.c"
#undef __GOB_FUNCTION__

#line 293 "src/mn-mail-icon.gob"
GtkWidget * 
mn_mail_icon_new (void)
{
#line 960 "mn-mail-icon.c"
#define __GOB_FUNCTION__ "MN:Mail:Icon::new"
{
#line 295 "src/mn-mail-icon.gob"
	
    return GTK_WIDGET(GET_NEW_VARG("title", _("Mail Notification"), NULL));
  }}
#line 967 "mn-mail-icon.c"
#undef __GOB_FUNCTION__
