#include <gtk/gtk.h>

static gchar *current_icon = GTK_STOCK_GO_UP;

static void tray_icon_clicked(
		GtkStatusIcon *icon, guint button, guint activate_time,
		gpointer user_data) {
	current_icon =
		current_icon == GTK_STOCK_GO_UP ? GTK_STOCK_GO_DOWN : GTK_STOCK_GO_UP;
	gtk_status_icon_set_from_icon_name(icon, current_icon);
}

static GtkStatusIcon *create_tray_icon() {
	GtkStatusIcon *tray_icon;

	tray_icon = gtk_status_icon_new();
	gtk_status_icon_set_from_icon_name(tray_icon, current_icon);
	g_signal_connect(tray_icon, "button-press-event", tray_icon_clicked, NULL);
	gtk_status_icon_set_visible(tray_icon, TRUE);

	return tray_icon;
}

int main(int argc, char **argv) {
	GtkStatusIcon *tray_icon;

	gtk_init(&argc, &argv);
	tray_icon = create_tray_icon();
	gtk_main();

	return 0;
}
