System Tray Icon for ossxmix
I like the System Tray Icon facility provided with ossxmix but the icon itself after scaling and clipping is displayed as a meaningless coloured blob. This is unfortunate as the image (ossxmix.xpm) from which it derives is a high quality attractive image ideally suited to publicising 4front Technology as the creators and driving force behind oss sound drivers and their associated tools.
Rather than replacing this image with one more familiar as the volume control icon displayed in the system tray of a competitors operating system I suggest retaining it for display in an "about dialogue" accessible from the tray-icon's popup menu and adding a separate image for the icon.
The following patch shows how this could be achieved.
At first sight this may appear to be a strange way of storing the image but xpm-files are conspicuous by their absence on my Linux box, icons being stored as either png or svg files. I'm not sure if the same applies to BSD, Solaris and other flavours of UNIX on which oss may be utilised.
Rather than replacing this image with one more familiar as the volume control icon displayed in the system tray of a competitors operating system I suggest retaining it for display in an "about dialogue" accessible from the tray-icon's popup menu and adding a separate image for the icon.
The following patch shows how this could be achieved.
- Code: Select all
--- ossxmix_c.bak 2011-11-01 00:48:19.000000000 +0000
+++ ossxmix.c 2011-11-05 02:31:52.000000000 +0000
@@ -49,6 +49,7 @@
#include <errno.h>
#include "gtkvu.h"
#include "ossxmix.xpm"
+#include "inline_image.h"
#undef TEST_JOY
#undef DEBUG
@@ -181,6 +182,7 @@
static void activate_mainwindow (GtkStatusIcon *, guint, guint, gpointer);
static void popup_mainwindow (GtkWidget *, gpointer);
static void trayicon_popupmenu (GtkStatusIcon *, guint, guint, gpointer);
+static void show_about(GtkWidget *, gpointer);
static GtkStatusIcon *status_icon = NULL;
#endif /* STATUSICON */
@@ -2093,6 +2095,7 @@
{
char tmp[100];
+ icon_pix = gdk_pixbuf_new_from_inline (-1, inline_image, FALSE, NULL);
status_icon = gtk_status_icon_new_from_pixbuf (icon_pix);
snprintf (tmp, sizeof(tmp), "ossxmix - device %d / %s",
dev, root[dev]->name);
@@ -2311,6 +2314,10 @@
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (popup_mainwindow), NULL);
gtk_menu_append (tray_menu, item);
+ item = gtk_menu_item_new_with_label ("About");
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (show_about), NULL);
+ gtk_menu_append (tray_menu, item);
item = gtk_menu_item_new_with_label ("Quit");
gtk_menu_append (tray_menu, item);
g_signal_connect (G_OBJECT (item), "activate",
@@ -2323,5 +2330,23 @@
gtk_status_icon_position_menu, status_icon,
button, etime);
}
+
+void show_about(GtkWidget *widget, gpointer data)
+{
+ GdkPixbuf *icon_pix;
+ icon_pix = gdk_pixbuf_new_from_xpm_data ((const char **)ossxmix);
+
+ gtk_show_about_dialog (NULL,
+ "program-name", "ossxmix",
+ "version", "4.2",
+ "copyright", "(c) 4Front Technologies. All Rights Reserved",
+ "comments", "Open Sound System GTK based GUI mixer program.",
+ "website", "http://www.opensound.com",
+ "logo", icon_pix,
+ NULL);
+
+ g_object_unref(icon_pix), icon_pix = NULL;
+}
+
#endif /* STATUSICON */
- Code: Select all
gdk-pixbuf-csource --raw --name=inline_image FILENAME >inline_image.h
At first sight this may appear to be a strange way of storing the image but xpm-files are conspicuous by their absence on my Linux box, icons being stored as either png or svg files. I'm not sure if the same applies to BSD, Solaris and other flavours of UNIX on which oss may be utilised.