summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-06-12 10:41:52 -0400
committerTingPing <tingping@tingping.se>2013-06-12 10:41:52 -0400
commit8be56d700309fad3966356249f024ed94ff36f8b (patch)
tree8158cfd61a68e8c37252babc98ef62a68be9b644 /src/fe-gtk
parent8ce1a9476d07c38317b6f2d3fd5245174f76211a (diff)
Don't open libcanberra connection for every event
Closes #645
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/fe-gtk.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index d737b744..e017b9b9 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -62,6 +62,9 @@
 
 GdkPixmap *channelwin_pix;
 
+#ifdef USE_LIBCANBERRA
+static ca_context *ca_con;
+#endif
 
 #ifdef USE_XLIB
 
@@ -674,11 +677,16 @@ fe_beep (session *sess)
 	}
 #else
 #ifdef USE_LIBCANBERRA
-	ca_context *con;
-	ca_context_create (&con);
-	if (ca_context_play (con, 0,
-					CA_PROP_APPLICATION_NAME, DISPLAY_NAME,
-					CA_PROP_EVENT_ID, "message-new-instant", NULL) != 0)
+	if (ca_con == NULL)
+	{
+		ca_context_create (&ca_con);
+		ca_context_change_props (ca_con,
+										CA_PROP_APPLICATION_ID, "hexchat",
+										CA_PROP_APPLICATION_NAME, DISPLAY_NAME,
+										CA_PROP_APPLICATION_ICON_NAME, "hexchat", NULL);
+	}
+
+	if (ca_context_play (ca_con, 0, CA_PROP_EVENT_ID, "message-new-instant", NULL) != 0)
 #endif
 	gdk_beep ();
 #endif