* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
-
#include "log.h"
#include "ui_status.h"
static void cb_activate(GtkStatusIcon *icon,
gpointer data)
{
- log_printf(LOG_DEBUG, "cb_activate()");
+ log_debug("cb_activate()");
ui_window_show((struct ui_psensor *)data);
}
guint activate_time,
gpointer data)
{
- log_printf(LOG_DEBUG, "cb_popup_menu()");
+ log_debug("cb_popup_menu()");
}
void ui_status_init(struct ui_psensor *ui)
{
if (status)
return ;
-
- log_printf(LOG_DEBUG, "ui_status_create()");
+
+ log_debug("ui_status_create()");
status = gtk_status_icon_new();
gtk_status_icon_set_from_icon_name(status, "psensor_normal");
int is_status_supported()
{
- return gtk_status_icon_is_embedded(status);
+ return status && gtk_status_icon_is_embedded(status);
}
void ui_status_cleanup()
{
- log_printf(LOG_DEBUG, "ui_status_cleanup()");
-
- g_object_unref(G_OBJECT(status));
+ log_debug("ui_status_cleanup()");
+
+ if (status) {
+ g_object_unref(G_OBJECT(status));
+ status = NULL;
+ }
}
void ui_status_update(struct ui_psensor *ui, unsigned int attention)
{
- log_printf(LOG_DEBUG, "ui_status_update()");
+ log_debug("ui_status_update()");
if (status_attention && !attention)
gtk_status_icon_set_from_icon_name(status, "psensor_normal");
status_attention = attention;
}
-GtkStatusIcon *ui_status_get_icon()
+GtkStatusIcon *ui_status_get_icon(struct ui_psensor *ui)
{
+ if (!status)
+ ui_status_init(ui);
+
return status;
}