closing the window hides psensor instead of quitting when application indicator suppo...
authorJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 2 May 2011 22:45:07 +0000 (22:45 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Mon, 2 May 2011 22:45:07 +0000 (22:45 +0000)
NEWS
src/ui.c

diff --git a/NEWS b/NEWS
index 92ef8b5..26aeaaf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@
 ** psensor: added enable/disable unity launcher counter
 ** psensor: unity launcher counter displays the higher temperature
 ** avoid fetching hddtemp daemon when no hdd in the sensors list
+** psensor: closing the window hides psensor instead of quitting when
+   application indicator support is enabled. 
 
 * v0.6.2.7
 
index 8701355..4c85dfe 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
 #include "ui_pref.h"
 #include "ui_sensorlist.h"
 
-static void on_destroy(GtkWidget *widget, gpointer data)
+static gboolean
+on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
+#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
+       gtk_widget_hide(((struct ui_psensor *)data)->main_window);
+#else
        ui_psensor_quit();
+#endif
+
+       return TRUE;
 }
 
 static void cb_menu_quit(gpointer data,
@@ -106,7 +113,8 @@ void ui_window_create(struct ui_psensor *ui)
        else
                fprintf(stderr, _("ERROR: Failed to load psensor icon.\n"));
 
-       g_signal_connect(window, "destroy", G_CALLBACK(on_destroy), ui);
+       g_signal_connect(window,
+                        "delete_event", G_CALLBACK(on_delete_event_cb), ui);
 
        gtk_window_set_decorated(GTK_WINDOW(window),
                                 ui->config->window_decoration_enabled);