2 * Copyright (C) 2010-2011 jeanfi@gmail.com
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include "ui_status.h"
25 GtkStatusIcon *status;
27 static void cb_activate(GtkStatusIcon *icon,
30 struct ui_psensor *ui;
32 log_printf(LOG_DEBUG, "cb_activate()");
34 ui = (struct ui_psensor *)data;
35 gtk_window_present(GTK_WINDOW(ui->main_window));
38 static void cb_popup_menu(GtkStatusIcon *icon,
43 log_printf(LOG_DEBUG, "cb_popup_menu()");
46 void ui_status_init(struct ui_psensor *ui)
48 log_printf(LOG_DEBUG, "ui_status_create()");
50 status = gtk_status_icon_new();
51 gtk_status_icon_set_from_icon_name(status, "psensor");
52 gtk_status_icon_set_visible(status, TRUE);
54 g_signal_connect(G_OBJECT(status),
56 G_CALLBACK(cb_popup_menu),
59 g_signal_connect(G_OBJECT(status),
61 G_CALLBACK(cb_activate),
65 int is_status_supported()
67 return gtk_status_icon_is_embedded(status);
70 void ui_status_cleanup()
72 log_printf(LOG_DEBUG, "ui_status_cleanup()");
74 g_object_unref(G_OBJECT(status));
77 void ui_status_update(struct ui_psensor *ui, unsigned int attention)
79 log_printf(LOG_DEBUG, "ui_status_update()");