aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-23 09:49:26 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-23 09:49:26 +0000
commit733d4928e512c31baf076c6b97267c6b4691ba73 (patch)
treea0ab31a29b89d7f7e6a501c81a8ea8ec6fa0666d /src/mainwindow.c
parentd639875e773bda1e903956e25b54b9fc7414a0ad (diff)
initial implementation of the tray icon.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@501 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r--src/mainwindow.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index faca8664..9e928ef2 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -77,6 +77,7 @@
#include "alertpanel.h"
#include "statusbar.h"
#include "inputdialog.h"
+#include "eggtrayicon.h"
#include "utils.h"
#include "gtkutils.h"
#include "codeconv.h"
@@ -159,6 +160,10 @@ static void ac_label_button_pressed (GtkWidget *widget,
static void ac_menu_popup_closed (GtkMenuShell *menu_shell,
gpointer data);
+static void tray_icon_button_pressed (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer data);
+
static gint main_window_close_cb (GtkWidget *widget,
GdkEventAny *event,
gpointer data);
@@ -799,6 +804,11 @@ MainWindow *main_window_create(SeparateType type)
GtkWidget *ac_button;
GtkWidget *ac_label;
+ GtkWidget *tray_icon;
+ GtkWidget *tray_icon_img;
+ GtkWidget *eventbox;
+ GtkTooltips *tray_icon_tip;
+
FolderView *folderview;
SummaryView *summaryview;
MessageView *messageview;
@@ -904,6 +914,21 @@ MainWindow *main_window_create(SeparateType type)
gtk_widget_show_all(statusbar);
+ tray_icon = GTK_WIDGET(egg_tray_icon_new("Sylpheed"));
+
+ eventbox = gtk_event_box_new();
+ gtk_container_add(GTK_CONTAINER(tray_icon), eventbox);
+ g_signal_connect(G_OBJECT(eventbox), "button_press_event",
+ G_CALLBACK(tray_icon_button_pressed), mainwin);
+ tray_icon_img = stock_pixbuf_widget_scale(NULL, STOCK_PIXMAP_SYLPHEED,
+ 24, 24);
+ gtk_container_add(GTK_CONTAINER(eventbox), tray_icon_img);
+
+ tray_icon_tip = gtk_tooltips_new();
+ gtk_tooltips_set_tip(tray_icon_tip, tray_icon, _("Sylpheed"), NULL);
+
+ gtk_widget_show_all(tray_icon);
+
/* create views */
mainwin->folderview = folderview = folderview_create();
mainwin->summaryview = summaryview = summary_create();
@@ -937,6 +962,10 @@ MainWindow *main_window_create(SeparateType type)
mainwin->ac_button = ac_button;
mainwin->ac_label = ac_label;
+ mainwin->tray_icon = tray_icon;
+ mainwin->tray_icon_img = tray_icon_img;
+ mainwin->tray_icon_tip = tray_icon_tip;
+
/* set context IDs for status bar */
mainwin->mainwin_cid = gtk_statusbar_get_context_id
(GTK_STATUSBAR(statusbar), "Main Window");
@@ -2541,6 +2570,15 @@ static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
manage_window_focus_in(mainwin->window, NULL, NULL);
}
+static void tray_icon_button_pressed(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (event && event->button == 1)
+ gtk_window_present(GTK_WINDOW(mainwin->window));
+}
+
static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
gpointer data)
{