closing the window hides psensor instead of quitting when application indicator suppo...
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 29 May 2011 08:04:23 +0000 (08:04 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 29 May 2011 08:04:23 +0000 (08:04 +0000)
NEWS
src/ui.c

diff --git a/NEWS b/NEWS
index 81f1c7d..1dec4be 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 * v0.6.1.10
 
 ** psensor: support of appindicator < 0.2.9
+** psensor: closing the window hides psensor instead of quitting when
+   application indicator support is enabled. 
 
 * v0.6.1.9
 
index 8b3bc03..a988fc6 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
 #include "cfg.h"
 #include "ui.h"
 
-void on_destroy(GtkWidget *widget, gpointer data)
+static gboolean
+on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
-       ui_psensor_exit();
+
+#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
+       gtk_widget_hide(((struct ui_psensor *)data)->main_window);
+#else
+       ui_psensor_quit();
+#endif
+
+       return TRUE;
 }
 
 void ui_psensor_exit()
@@ -65,7 +73,8 @@ GtkWidget *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);