System Tray Icon for ossxmix

OSS related discussion in general (i.e. not limited to Linux/Solaris/BSD)

Moderators: hannu, dev, cesium, kodachi

System Tray Icon for ossxmix

Postby seawright » Sat Nov 05, 2011 4:44 pm

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.
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 */
Instead of adding a second xpn-file the pixmap definition is held in a helper-file which can be produced by:
Code: Select all
gdk-pixbuf-csource --raw --name=inline_image FILENAME >inline_image.h
substituting the full path and filename of a suitable file for FILENAME.

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.
regards
Clive
seawright
Member
 
Posts: 93
Joined: Sat Jan 06, 2007 9:10 pm
Location: Hampshire UK

Re: System Tray Icon for ossxmix

Postby seawright » Thu Dec 01, 2011 11:15 pm

Doesn't appear that this has generated enough interest to warrant a reply.

a) First I must apologise if anyone has tried to apply this patch. It did work but due to the way "phpbb" justifies code boxes the patch programme reports an error;
Code: Select all
patch -p0 <patch1
(Patch is indented 4 spaces.)
patching file ossxmix.c
patch: **** malformed patch at line 11: @@ -181,6 +182,7 @@

b) I purposely did not include a suitable icon for the system tray due to the minefield of copyright law but I would expect that a suitable icon would already be available within the theme of the desktop environment in use.

c) I know the about window my patch creates isn't a brilliant work of art compared to Rosegarden or even Firefox, I'm no artist. Perhaps one of the readers of this forum is a graphic designer who would be prepared to contribute an "about box" or "splash screen" for ossxmix.

d) Can 4front Technologies rely on sound quality alone to raise awareness or even sell commercial licenses for oss4?
regards
Clive
seawright
Member
 
Posts: 93
Joined: Sat Jan 06, 2007 9:10 pm
Location: Hampshire UK


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest