indicator as static
authorJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 11 Nov 2011 19:09:30 +0000 (19:09 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 11 Nov 2011 19:09:30 +0000 (19:09 +0000)
src/ui.h
src/ui_appindicator.c

index f6559cd..b32dc80 100644 (file)
--- a/src/ui.h
+++ b/src/ui.h
@@ -63,10 +63,6 @@ struct ui_psensor {
        /* Time of the last notification */
        struct timeval *notification_last_time;
 #endif
-
-#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
-       AppIndicator *indicator;
-#endif
 };
 
 /*
index e287e74..3d7f5a0 100644 (file)
@@ -33,6 +33,7 @@
 static GtkMenuItem **sensor_menu_items;
 static GtkWidget *main_window;
 static int appindicator_supported = 1;
+static AppIndicator *indicator;
 
 static void cb_menu_show(GtkMenuItem *mi, gpointer data)
 {
@@ -198,18 +199,18 @@ void ui_appindicator_update(struct ui_psensor *ui,
 {
        AppIndicatorStatus status;
 
-       if (!ui->indicator)
+       if (!indicator)
                return;
 
-       status = app_indicator_get_status(ui->indicator);
+       status = app_indicator_get_status(indicator);
 
        if (!attention && status == APP_INDICATOR_STATUS_ATTENTION)
                app_indicator_set_status
-                   (ui->indicator, APP_INDICATOR_STATUS_ACTIVE);
+                       (indicator, APP_INDICATOR_STATUS_ACTIVE);
 
        if (attention && status == APP_INDICATOR_STATUS_ACTIVE)
                app_indicator_set_status
-                   (ui->indicator, APP_INDICATOR_STATUS_ATTENTION);
+                   (indicator, APP_INDICATOR_STATUS_ATTENTION);
 
        update_sensor_menu_items(ui->sensors);
 }
@@ -236,7 +237,6 @@ static void unity_unfallback(AppIndicator *indicator,
 void ui_appindicator_init(struct ui_psensor *ui)
 {
        GtkWidget *menu;
-       AppIndicator *indicator;
 
        main_window = ui->main_window;
 
@@ -254,8 +254,6 @@ void ui_appindicator_init(struct ui_psensor *ui)
        menu = get_menu(ui);
        app_indicator_set_menu(indicator, GTK_MENU(menu));
 
-       ui->indicator = indicator;
-
        gtk_widget_show_all(menu);
 }