GtkStatusIcon and Unity



Hi there. Below is a simple tray icon example program.

It does not create an icon in Unity.

Is support for this planned? If not, why? I thought part of the goal GTK+ was to be cross-platform?

Regards,
Andrew

#include <stdio.h>
#include <gtk/gtk.h>

static void tray_icon_on_click(GtkStatusIcon *status_icon, gpointer user_data) {
    printf("Clicked on tray icon\n");
}

static void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, 
                       guint activate_time, gpointer user_data)
{
    printf("Popup menu\n");
}

int main(int argc, char * argv[]) {
    gtk_init(&argc, &argv);

    GtkStatusIcon *tray_icon = gtk_status_icon_new();

    g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
    g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(tray_icon_on_menu), NULL);

    gtk_status_icon_set_from_file(tray_icon, GTK_STOCK_MEDIA_STOP);
    gtk_status_icon_set_tooltip(tray_icon, "Blend");
    gtk_status_icon_set_visible(tray_icon, TRUE);

    gtk_main();

    return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]