style
[psensor.git] / src / ui_appindicator.c
index e6f37e8..2c42f70 100644 (file)
@@ -1,22 +1,21 @@
 /*
-    Copyright (C) 2010-2011 jeanfi@gmail.com
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301 USA
-*/
-
+ * Copyright (C) 2010-2011 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "ui.h"
 #include "ui_appindicator.h"
 #include "ui_sensorpref.h"
+#include "ui_status.h"
 #include "ui_pref.h"
 
 static GtkMenuItem **sensor_menu_items;
 static GtkWidget *main_window;
 static int appindicator_supported = 1;
 static AppIndicator *indicator;
+static struct ui_psensor *ui_psensor;
 
 static void cb_menu_show(GtkMenuItem *mi, gpointer data)
 {
@@ -144,8 +145,7 @@ static void update_sensor_menu_items(struct psensor **sensors)
 
        n = psensor_list_size(sensors);
        for (i = 0; i < n; i++)
-               update_sensor_menu_item(sensor_menu_items[i],
-                                       sensors[i]);
+               update_sensor_menu_item(sensor_menu_items[i], sensors[i]);
 }
 
 static GtkWidget *get_menu(struct ui_psensor *ui)
@@ -215,19 +215,17 @@ void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention)
 
 static GtkStatusIcon *unity_fallback(AppIndicator *indicator)
 {
-       log_printf(LOG_DEBUG, "ui_appindicator#unity_fallback");
-
-       gtk_widget_show_all(main_window);
+       log_debug("ui_appindicator#unity_fallback");
 
        appindicator_supported = 0;
 
-       return NULL;
+       return ui_status_get_icon(ui_psensor);
 }
 
 static void
 unity_unfallback(AppIndicator *indicator, GtkStatusIcon *status_icon)
 {
-       log_printf(LOG_DEBUG, "ui_appindicator#unity_unfallback");
+       log_debug("ui_appindicator#unity_unfallback");
 
        appindicator_supported = 1;
 }
@@ -236,6 +234,7 @@ void ui_appindicator_init(struct ui_psensor *ui)
 {
        GtkWidget *menu;
 
+       ui_psensor = ui;
        main_window = ui->main_window;
 
        indicator = app_indicator_new