aboutsummaryrefslogtreecommitdiff
path: root/src/trayicon.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-11 06:36:56 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-11 06:36:56 +0000
commit8f4ff8e73cafc662954824690f4fc75c1863c037 (patch)
tree7e282a846bd7ce5a32f4f8f558af6537e79aebce /src/trayicon.c
parent0c621798e192f350b1b3f6c97b9d9f8b92dfb7fb (diff)
added the option to toggle window on trayicon click.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1466 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/trayicon.c')
-rw-r--r--src/trayicon.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/trayicon.c b/src/trayicon.c
index 51d9f47c..fc1f1f15 100644
--- a/src/trayicon.c
+++ b/src/trayicon.c
@@ -41,7 +41,7 @@
#include "main.h"
#include "inc.h"
#include "compose.h"
-#include "gtkutils.h"
+#include "prefs_common.h"
#if GTK_CHECK_VERSION(2, 10, 0) || defined(GDK_WINDOWING_X11)
@@ -241,7 +241,11 @@ static void trayicon_activated(GtkStatusIcon *status_icon, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
- main_window_popup(mainwin);
+ if (prefs_common.toggle_window_on_trayicon_click &&
+ gtk_window_is_active(GTK_WINDOW(mainwin->window)))
+ gtk_window_iconify(GTK_WINDOW(mainwin->window));
+ else
+ main_window_popup(mainwin);
}
static void trayicon_popup_menu_cb(GtkStatusIcon *status_icon, guint button,
@@ -317,9 +321,13 @@ static void trayicon_button_pressed(GtkWidget *widget, GdkEventButton *event,
if (!event)
return;
- if (event->button == 1)
- main_window_popup(mainwin);
- else if (event->button == 3) {
+ if (event->button == 1) {
+ if (prefs_common.toggle_window_on_trayicon_click &&
+ gtk_window_is_active(GTK_WINDOW(mainwin->window)))
+ gtk_window_iconify(GTK_WINDOW(mainwin->window));
+ else
+ main_window_popup(mainwin);
+ } else if (event->button == 3) {
gtk_menu_popup(GTK_MENU(trayicon_menu), NULL, NULL, NULL, NULL,
event->button, event->time);
}