From: Colin Leroy Date: Thu, 12 Aug 2004 09:36:15 +0000 (+0000) Subject: 2004-08-12 [colin] 0.9.12cvs58 X-Git-Tag: rel_0_9_12a~27 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=eb6fb2501c96d48056a8c56945f0bbbb547e42d6 2004-08-12 [colin] 0.9.12cvs58 * configure.ac * sylpheed.desktop * src/Makefile.am * src/main.c Add support for Freedesktop.org's startup notification --- diff --git a/ChangeLog.claws b/ChangeLog.claws index c8b53e9a6..37fc0af5e 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,11 @@ +2004-08-12 [colin] 0.9.12cvs58 + + * configure.ac + * sylpheed.desktop + * src/Makefile.am + * src/main.c + Add support for Freedesktop.org's startup notification + 2004-08-10 [colin] 0.9.12cvs57 * src/main.c diff --git a/PATCHSETS b/PATCHSETS index 4fe1fcc78..0037e64af 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -39,3 +39,4 @@ ( cvs diff -u -r 1.139 -r 1.140 src/main.c; cvs diff -u -r 1.13 -r 1.14 src/common/ssl.c; cvs diff -u -r 1.7 -r 1.8 src/common/sylpheed.c; cvs diff -u -r 1.5 -r 1.6 src/common/sylpheed.h; ) > 0.9.12cvs55.patchset ( cvs diff -u -r 1.140 -r 1.141 src/main.c; cvs diff -u -r 1.14 -r 1.15 src/common/ssl.c; cvs diff -u -r 1.8 -r 1.9 src/common/sylpheed.c; cvs diff -u -r 1.6 -r 1.7 src/common/sylpheed.h; ) > 0.9.12cvs56.patchset ( cvs diff -u -r 1.141 -r 1.142 src/main.c; cvs diff -u -r 1.14 -r 1.15 src/common/socket.c; cvs diff -u -r 1.15 -r 1.16 src/common/ssl.c; cvs diff -u -r 1.9 -r 1.10 src/common/sylpheed.c; cvs diff -u -r 1.7 -r 1.8 src/common/sylpheed.h; ) > 0.9.12cvs57.patchset +( cvs diff -u -r 1.1117 -r 1.1118 configure.ac; cvs diff -u -r 1.7 -r 1.8 sylpheed.desktop; cvs diff -u -r 1.185 -r 1.186 src/Makefile.am; cvs diff -u -r 1.142 -r 1.143 src/main.c; ) > 0.9.12cvs58.patchset diff --git a/configure.ac b/configure.ac index 79c8a5b80..09003a6da 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=12 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=57 +EXTRA_VERSION=58 EXTRA_RELEASE= if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then @@ -576,6 +576,28 @@ 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 **************************** diff --git a/src/Makefile.am b/src/Makefile.am index 7eafec7bf..26992e54c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -373,7 +373,8 @@ sylpheed_LDADD = \ $(COMPFACE_LIBS) \ $(JPILOT_LIBS) \ $(PTHREAD_LIBS) \ - $(LIBICONV) + $(LIBICONV) \ + $(STARTUP_NOTIFICATION_LIBS) AM_CPPFLAGS = \ -DG_LOG_DOMAIN=\"Sylpheed\" \ @@ -385,6 +386,7 @@ AM_CPPFLAGS = \ $(ASPELL_CFLAGS) \ $(GTK_CFLAGS) \ $(GPGME_CFLAGS) \ - $(OPENSSL_CFLAGS) + $(OPENSSL_CFLAGS) \ + $(STARTUP_NOTIFICATION_CFLAGS) AM_YFLAGS = -d diff --git a/src/main.c b/src/main.c index c3538405a..428078e9c 100644 --- a/src/main.c +++ b/src/main.c @@ -37,6 +37,12 @@ #include #include +#ifdef HAVE_STARTUP_NOTIFICATION +# define SN_API_NOT_YET_FROZEN +# include +# include +#endif + #if USE_GPGME # include # 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,7 +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."); @@ -364,6 +423,10 @@ int main(int argc, char *argv[]) plugin_load_all("GTK"); static_mainwindow = mainwin; + +#ifdef HAVE_STARTUP_NOTIFICATION + startup_notification_complete(FALSE); +#endif gtk_main(); exit_sylpheed(mainwin); diff --git a/sylpheed.desktop b/sylpheed.desktop index d11de03f4..b70367ebc 100644 --- a/sylpheed.desktop +++ b/sylpheed.desktop @@ -8,3 +8,4 @@ Icon=sylpheed.png Terminal=0 Type=Application Categories=Application;Network; +StartupNotify=true