2004-08-12 [colin] 0.9.12cvs57.5
authorColin Leroy <colin@colino.net>
Thu, 12 Aug 2004 08:37:25 +0000 (08:37 +0000)
committerColin Leroy <colin@colino.net>
Thu, 12 Aug 2004 08:37:25 +0000 (08:37 +0000)
* sylpheed.desktop
* configure.ac
* src/Makefile.am
* src/main.c
Add support for Freedesktop.org's startup notification

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/Makefile.am
src/main.c
sylpheed.desktop

index 28d7b4d..8f1e6c9 100644 (file)
@@ -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
index 8860145..17f8d52 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 4d03ee6..51174cd 100644 (file)
@@ -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 ****************************
index 1da9c7d..6b9c713 100644 (file)
@@ -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
index bfa12ed..a9cb855 100644 (file)
 #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);
index d11de03..b70367e 100644 (file)
@@ -8,3 +8,4 @@ Icon=sylpheed.png
 Terminal=0
 Type=Application
 Categories=Application;Network;
+StartupNotify=true