}
}
+static void indicators_update(struct ui_psensor *ui)
+{
+ struct psensor **sensor_cur = ui->sensors;
+ unsigned int attention = 0;
+
+ if (!is_appindicator_supported() && !is_status_supported())
+ return ;
+
+ while (*sensor_cur) {
+ struct psensor *s = *sensor_cur;
+
+ if (s->alarm_enabled && s->alarm_raised) {
+ attention = 1;
+ break;
+ }
+
+ sensor_cur++;
+ }
+
+#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
+ if (is_appindicator_supported())
+ ui_appindicator_update(ui, attention);
+#endif
+
+ if (is_status_supported())
+ ui_status_update(ui, attention);
+}
+
gboolean ui_refresh_thread(gpointer data)
{
struct config *cfg;
ui_sensorlist_update(ui);
-#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
- ui_appindicator_update(ui);
-#endif
+ indicators_update(ui);
#ifdef HAVE_UNITY
ui_unity_launcher_entry_update(ui->sensors,
ui_sensorlist_create(&ui);
/*
- * show the window as soon as all gtk event has been processed
+ * show the window as soon as all gtk events have been processed
* in order to ensure that the status icon is attempted to be
* drawn before. If not, there is no way to detect that it is
* visible.
return GTK_WIDGET(menu);
}
-
-void ui_appindicator_update(struct ui_psensor *ui)
+void ui_appindicator_update(struct ui_psensor *ui,
+ unsigned int attention)
{
- struct psensor **sensor_cur = ui->sensors;
AppIndicatorStatus status;
- int attention = 0;
if (!ui->indicator)
return;
- while (*sensor_cur) {
- struct psensor *s = *sensor_cur;
-
- if (s->alarm_enabled && s->alarm_raised) {
- attention = 1;
- break;
- }
-
- sensor_cur++;
- }
-
status = app_indicator_get_status(ui->indicator);
if (!attention && status == APP_INDICATOR_STATUS_ATTENTION)
appindicator_supported = 1;
}
-
void ui_appindicator_init(struct ui_psensor *ui)
{
GtkWidget *menu;
#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
void ui_appindicator_init(struct ui_psensor *ui);
-void ui_appindicator_update(struct ui_psensor *ui);
+void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention);
int is_appindicator_supported();
void ui_appindicator_cleanup();
#else
g_object_unref(G_OBJECT(status));
}
+
+void ui_status_update(struct ui_psensor *ui, unsigned int attention)
+{
+ log_printf(LOG_DEBUG, "ui_status_update()");
+}
void ui_status_init(struct ui_psensor *ui);
void ui_status_cleanup();
-
+void ui_status_update(struct ui_psensor *ui, unsigned int attention);
/* Whether status icon is supported i.e. visible. */
int is_status_supported();