aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-27 00:58:58 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-27 00:58:58 +0000
commit89509eaa2ec34175cf7bf559d2180a56f3d0a476 (patch)
tree1fb875f849c5d742fccc5583ff667bc03335044c
parente297246f6519b0d066777a84e50274990f675047 (diff)
added mail arrival notification at tray icon.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1191 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja5
-rw-r--r--src/trayicon.c84
-rw-r--r--src/trayicon.h2
4 files changed, 67 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index 94be6488..b7a79b00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-27
+
+ * src/trayicon.[ch]: trayicon_set_notify(): added. It blinks the tray
+ icon for 5 seconds.
+
2006-09-26
* libsylph/prefs_common.[ch]
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 12d0b53d..2898a6f9 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,8 @@
+2006-09-27
+
+ * src/trayicon.[ch]: trayicon_set_notify(): 追加。トレイアイコンを
+ 5秒間点滅させる。
+
2006-09-26
* libsylph/prefs_common.[ch]
diff --git a/src/trayicon.c b/src/trayicon.c
index 50c94f34..ae9b0244 100644
--- a/src/trayicon.c
+++ b/src/trayicon.c
@@ -163,6 +163,20 @@ TrayIcon *trayicon_create(MainWindow *mainwin)
#if GTK_CHECK_VERSION(2, 10, 0)
+void trayicon_show(TrayIcon *tray_icon)
+{
+ gtk_status_icon_set_visible(trayicon.status_icon, TRUE);
+};
+
+void trayicon_destroy(TrayIcon *tray_icon)
+{
+#if 0
+ g_object_unref(tray_icon->status_icon);
+ tray_icon->status_icon = NULL;
+#endif
+ gtk_status_icon_set_visible(tray_icon->status_icon, FALSE);
+}
+
void trayicon_set_tooltip(const gchar *text)
{
if (text) {
@@ -175,6 +189,24 @@ void trayicon_set_tooltip(const gchar *text)
}
}
+static guint notify_tag = 0;
+
+gboolean notify_timeout_cb(gpointer data)
+{
+ gtk_status_icon_set_blinking(trayicon.status_icon, FALSE);
+ notify_tag = 0;
+ return FALSE;
+}
+
+void trayicon_set_notify(gboolean enabled)
+{
+ if (enabled && notify_tag == 0) {
+ gtk_status_icon_set_blinking(trayicon.status_icon, enabled);
+ notify_tag = g_timeout_add(5000, notify_timeout_cb, NULL);
+ } else if (!enabled && notify_tag > 0)
+ g_source_remove(notify_tag);
+}
+
void trayicon_set_stock_icon(StockPixmap icon)
{
GdkPixbuf *pixbuf;
@@ -187,20 +219,6 @@ void trayicon_set_stock_icon(StockPixmap icon)
g_object_unref(scaled_pixbuf);
}
-void trayicon_show(TrayIcon *tray_icon)
-{
- gtk_status_icon_set_visible(trayicon.status_icon, TRUE);
-};
-
-void trayicon_destroy(TrayIcon *tray_icon)
-{
-#if 0
- g_object_unref(tray_icon->status_icon);
- tray_icon->status_icon = NULL;
-#endif
- gtk_status_icon_set_visible(tray_icon->status_icon, FALSE);
-}
-
static void trayicon_activated(GtkStatusIcon *status_icon, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
@@ -219,6 +237,17 @@ static void trayicon_popup_menu_cb(GtkStatusIcon *status_icon, guint button,
#else
+void trayicon_show(TrayIcon *tray_icon)
+{
+ gtk_widget_show(tray_icon->widget);
+};
+
+void trayicon_destroy(TrayIcon *tray_icon)
+{
+ gtk_widget_destroy(tray_icon->widget);
+ tray_icon->widget = NULL;
+}
+
void trayicon_set_tooltip(const gchar *text)
{
if (text) {
@@ -232,6 +261,10 @@ void trayicon_set_tooltip(const gchar *text)
}
}
+void trayicon_set_notify(gboolean enabled)
+{
+}
+
void trayicon_set_stock_icon(StockPixmap icon)
{
GdkPixbuf *pixbuf;
@@ -244,17 +277,6 @@ void trayicon_set_stock_icon(StockPixmap icon)
g_object_unref(scaled_pixbuf);
}
-void trayicon_show(TrayIcon *tray_icon)
-{
- gtk_widget_show(tray_icon->widget);
-};
-
-void trayicon_destroy(TrayIcon *tray_icon)
-{
- gtk_widget_destroy(tray_icon->widget);
- tray_icon->widget = NULL;
-}
-
static void trayicon_button_pressed(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
@@ -336,19 +358,23 @@ TrayIcon *trayicon_create(MainWindow *mainwin)
return NULL;
}
-void trayicon_set_tooltip(const gchar *text)
+void trayicon_show(TrayIcon *tray_icon)
{
}
-void trayicon_set_stock_icon(StockPixmap icon)
+void trayicon_destroy(TrayIcon *tray_icon)
{
}
-void trayicon_show(TrayIcon *tray_icon)
+void trayicon_set_tooltip(const gchar *text)
{
}
-void trayicon_destroy(TrayIcon *tray_icon)
+void trayicon_set_notify(gboolean enabled)
+{
+}
+
+void trayicon_set_stock_icon(StockPixmap icon)
{
}
diff --git a/src/trayicon.h b/src/trayicon.h
index a5869666..af509dd9 100644
--- a/src/trayicon.h
+++ b/src/trayicon.h
@@ -43,8 +43,10 @@ struct _TrayIcon
};
TrayIcon *trayicon_create (MainWindow *mainwin);
+void trayicon_show (TrayIcon *tray_icon);
void trayicon_destroy (TrayIcon *tray_icon);
void trayicon_set_tooltip (const gchar *text);
+void trayicon_set_notify (gboolean enabled);
void trayicon_set_stock_icon (StockPixmap icon);
#endif /* __TRAYICON_H__ */