Commit Diff


commit - 9d42db9fd4627178ae545ca05b640ed1539f60b1
commit + 6c0c6b6a7164b77c805401ec1b0bf50d4271c918
blob - 28d7b4d67d362b9eff9ac800d79e7d2bb25accaa
blob + 8f1e6c97c94afb9424b5845d6cf3a40fbb558974
--- ChangeLog-gtk2.claws
+++ ChangeLog-gtk2.claws
@@ -1,3 +1,11 @@
+2004-08-12 [colin]	0.9.12cvs57.5
+
+	* sylpheed.desktop
+	* configure.ac
+	* src/Makefile.am
+	* src/main.c
+		Add support for Freedesktop.org's startup notification
+
 2004-08-11 [colin]	0.9.12cvs57.4
 
 	* src/textview.c
blob - 886014579b0ea3028e9e397ac511d55e2c16707a
blob + 17f8d520905544eb98ca9a02ef7b7a6d0d041a23
--- PATCHSETS
+++ PATCHSETS
@@ -115,3 +115,4 @@
 ( cvs diff -u -r 1.15.2.6 -r 1.15.2.7 src/summary_search.c; ) > 0.9.12cvs57.2.patchset
 ( cvs diff -u -r 1.3.12.4 -r 1.3.12.5 src/message_search.c; cvs diff -u -r 1.15.2.7 -r 1.15.2.8 src/summary_search.c; cvs diff -u -r 1.96.2.15 -r 1.96.2.16 src/textview.c; ) > 0.9.12cvs57.3.patchset
 ( cvs diff -u -r 1.96.2.16 -r 1.96.2.17 src/textview.c; ) > 0.9.12cvs57.4.patchset
+( cvs diff -u -r 1.7 -r 1.8 sylpheed.desktop; cvs diff -u -r 1.654.2.147 -r 1.654.2.148 configure.ac; cvs diff -u -r 1.155.2.9 -r 1.155.2.10 src/Makefile.am; cvs diff -u -r 1.115.2.14 -r 1.115.2.15 src/main.c; ) > 0.9.12cvs57.5.patchset
blob - 4d03ee6659fc2e4eefeeedec0b926acfc8aeafd9
blob + 51174cd0910186cd4d5c96e6bf700753db12230d
--- configure.ac
+++ configure.ac
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=57
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.4
+EXTRA_GTK2_VERSION=.5
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
@@ -597,6 +597,27 @@ fi
 AC_SUBST(CLAMAV_LIBS)
 AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
 
+dnl #######################################################################
+dnl # Check for startup notification
+dnl #######################################################################
+AC_ARG_ENABLE(startup-notification, [  --disable-startup-notification    compile without startup notification support],,enable_startup_notification=yes)
+
+if test "x$enable_startup_notification" = "xyes"; then
+	PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
+	[
+		AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
+		echo "Building with libstartup-notification"
+		enable_startup_notification=yes
+	],
+	[
+		echo "Building without libstartup-notification"
+		enable_startup_notification=no
+	])
+
+	AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
+	AC_SUBST(STARTUP_NOTIFICATION_LIBS)
+fi
+
 dnl ****************************
 dnl ** Final configure output **
 dnl ****************************
blob - 1da9c7d36c04343fe726ba58b14693f023ac5c7a
blob + 6b9c713ef6e06ff6b00cb181c74fe0afab42680d
--- src/Makefile.am
+++ src/Makefile.am
@@ -369,7 +369,8 @@ sylpheed_LDADD = \
 	$(COMPFACE_LIBS) \
 	$(JPILOT_LIBS) \
 	$(PTHREAD_LIBS) \
-	$(LIBICONV)
+	$(LIBICONV) \
+	$(STARTUP_NOTIFICATION_LIBS)
 
 AM_CPPFLAGS = \
 	-DG_LOG_DOMAIN=\"Sylpheed\" \
@@ -381,6 +382,7 @@ AM_CPPFLAGS = \
 	$(ASPELL_CFLAGS) \
 	$(GTK_CFLAGS) \
 	$(GPGME_CFLAGS) \
-	$(OPENSSL_CFLAGS)
+	$(OPENSSL_CFLAGS) \
+	$(STARTUP_NOTIFICATION_CFLAGS)
 
 AM_YFLAGS = -d
blob - bfa12ed34e6dd45173bc1cee9d3316258d5cdddd
blob + a9cb8555b84e14a655d752a67c1e98aa26db8800
--- src/main.c
+++ src/main.c
@@ -37,6 +37,12 @@
 #include <sys/types.h>
 #include <signal.h>
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+# define SN_API_NOT_YET_FROZEN
+# include <libsn/sn-launchee.h>
+# include <gdk/gdkx.h>
+#endif
+
 #if USE_GPGME
 #  include <gpgme.h>
 #  include "passphrase.h"
@@ -93,6 +99,11 @@ gchar *prog_version;
 gchar *argv0;
 #endif
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+static SnLauncheeContext *sn_context = NULL;
+static SnDisplay *sn_display = NULL;
+#endif
+
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
 
@@ -165,6 +176,48 @@ _("File `%s' already exists.\n"
 
 static MainWindow *static_mainwindow;
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+static void sn_error_trap_push(SnDisplay *display, Display *xdisplay)
+{
+	gdk_error_trap_push();
+}
+
+static void sn_error_trap_pop(SnDisplay *display, Display *xdisplay)
+{
+	gdk_error_trap_pop();
+}
+
+static void startup_notification_complete(gboolean with_window)
+{
+	Display *xdisplay;
+	GtkWidget *hack = NULL;
+
+	if (with_window) {
+		/* this is needed to make the startup notification leave,
+		 * if we have been launched from a menu.
+		 * We have to display a window, so let it be very little */
+		hack = gtk_window_new(GTK_WINDOW_POPUP);
+		gtk_widget_set_uposition(hack, 0, 0);
+		gtk_widget_set_usize(hack, 1, 1);
+		gtk_widget_show(hack);
+	}
+
+	xdisplay = GDK_DISPLAY();
+	sn_display = sn_display_new(xdisplay,
+				sn_error_trap_push,
+				sn_error_trap_pop);
+	sn_context = sn_launchee_context_new_from_environment(sn_display,
+						 DefaultScreen(xdisplay));
+
+	if (sn_context != NULL)
+	{
+		sn_launchee_context_complete(sn_context);
+		sn_launchee_context_unref(sn_context);
+		sn_display_unref(sn_display);
+	}
+}
+#endif /* HAVE_STARTUP_NOTIFICATION */
+
 void sylpheed_gtk_idle(void) 
 {
 	while(gtk_events_pending())
@@ -201,8 +254,13 @@ int main(int argc, char *argv[])
 
 	/* check and create unix domain socket */
 	lock_socket = prohibit_duplicate_launch();
-	if (lock_socket < 0) return 0;
-
+	if (lock_socket < 0) {
+#ifdef HAVE_STARTUP_NOTIFICATION
+		if(gtk_init_check(&argc, &argv))
+			startup_notification_complete(TRUE);
+#endif
+		return 0;
+	}
 	if (cmd.status || cmd.status_full) {
 		puts("0 Sylpheed not running.");
 		lock_socket_remove();
@@ -282,6 +340,7 @@ int main(int argc, char *argv[])
 	mh_gtk_init();
 	imap_gtk_init();
 	news_gtk_init();
+		
 	mainwin = main_window_create
 		(prefs_common.sep_folder | prefs_common.sep_msg << 1);
 	folderview = mainwin->folderview;
@@ -368,6 +427,10 @@ int main(int argc, char *argv[])
 	plugin_load_all("GTK2");
 	
 	static_mainwindow = mainwin;
+
+#ifdef HAVE_STARTUP_NOTIFICATION
+	startup_notification_complete(FALSE);
+#endif
 	gtk_main();
 
 	exit_sylpheed(mainwin);
blob - d11de03f47c0dc596c0981f8a6dac5146fa5ab2c
blob + b70367ebcf7131079f6a2ae9129025926d439540
--- sylpheed.desktop
+++ sylpheed.desktop
@@ -8,3 +8,4 @@ Icon=sylpheed.png
 Terminal=0
 Type=Application
 Categories=Application;Network;
+StartupNotify=true