changeset 7168:282887c9e3dc

[gaim-migrate @ 7735] Added support for startup notification for those window managers that support it. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 06 Oct 2003 00:17:45 +0000
parents 6d3d8f11e765
children 85181c25cae3
files ChangeLog configure.ac gaim.desktop src/Makefile.am src/main.c
diffstat 5 files changed, 74 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 05 23:50:40 2003 +0000
+++ b/ChangeLog	Mon Oct 06 00:17:45 2003 +0000
@@ -8,6 +8,7 @@
 	* Massive core/UI splitting.
 	* Conversation API changes.
 	* SSL support can now be provided by third party plugins.
+	* Added startup notification support for window managers that support it.
 	* Multiple copies of gaim installed at different locations no
 	  longer attempt to load the same, possibly incompatible plugins
 	  (Robert McQueen)
--- a/configure.ac	Sun Oct 05 23:50:40 2003 +0000
+++ b/configure.ac	Mon Oct 06 00:17:45 2003 +0000
@@ -173,6 +173,22 @@
 	x_incpath_add="-I$x_includes"
 fi
 
+dnl Check for startup notification
+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)
+
+
 dnl Check for XScreenSaver
 if test "x$enable_xss" = "xyes" ; then
 	old_LIBS="$LIBS"
@@ -984,6 +1000,7 @@
 echo
 echo Use XScreenSaver Extension.... : $enable_xss
 echo Use X Session Management...... : $enable_sm
+echo Use startup notification.......: $enable_startup_notification
 echo
 echo Print debugging messages...... : $enable_debug
 echo
--- a/gaim.desktop	Sun Oct 05 23:50:40 2003 +0000
+++ b/gaim.desktop	Mon Oct 06 00:17:45 2003 +0000
@@ -11,3 +11,4 @@
 Terminal=false
 Type=Application
 Categories=Application;Network;
+StartupNotify=true
--- a/src/Makefile.am	Sun Oct 05 23:50:40 2003 +0000
+++ b/src/Makefile.am	Mon Oct 06 00:17:45 2003 +0000
@@ -171,7 +171,8 @@
 	$(XSS_LIBS) \
 	$(SM_LIBS) \
 	$(INTLLIBS) \
-	$(GTKSPELL_LIBS)
+	$(GTKSPELL_LIBS) \
+	$(STARTUP_NOTIFICATION_LIBS)
 
 gaim_remote_SOURCES = \
 	gaim-remote.c
@@ -190,4 +191,5 @@
 	$(AO_CFLAGS) \
 	$(DEBUG_CFLAGS) \
 	$(GTK_CFLAGS) \
-	$(GTKSPELL_CFLAGS)
+	$(GTKSPELL_CFLAGS) \
+	$(STARTUP_NOTIFICATION_CFLAGS)
--- a/src/main.c	Sun Oct 05 23:50:40 2003 +0000
+++ b/src/main.c	Mon Oct 06 00:17:45 2003 +0000
@@ -59,12 +59,23 @@
 #include "locale.h"
 #include <getopt.h>
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+# define SN_API_NOT_YET_FROZEN
+# include <libsn/sn-launchee.h>
+# include <gdk/gdkx.h>
+#endif
+
 extern void load_prefs();
 extern void load_pounces();
 
 static GtkWidget *name;
 static GtkWidget *pass;
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+static SnLauncheeContext *sn_context = NULL;
+static SnDisplay *sn_display = NULL;
+#endif
+
 GtkWidget *mainwindow = NULL;
 
 int opt_away = 0;
@@ -559,6 +570,42 @@
 	}
 }
 
+#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(void)
+{
+	Display *xdisplay;
+
+	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 */
+
 /* FUCKING GET ME A TOWEL! */
 #ifdef _WIN32
 int gaim_main(HINSTANCE hint, int argc, char *argv[])
@@ -868,6 +915,10 @@
 	} else if ((dologin_ret == -1) && !gaim_connections_get_all())
 		show_login();
 
+#ifdef HAVE_STARTUP_NOTIFICATION
+	startup_notification_complete();
+#endif
+
 	gtk_main();
 	gaim_sound_shutdown();
 #ifdef _WIN32