@Ravi, If you are coding everything properly, then you most likely have to enable the notification area. I think the notification area might come whitelisted by default(If your using Ubuntu.)
You can check by using the gtk_status_icon_is_embedded function. If it returns no then go here and follow the steps.
Here is an example piece of code i threw together. Took me little bit but I learned some stuff in the process.
Code:
#include <gtk/gtk.h>
static void destroy_event(GtkWidget *widget, gpointer data) {
gtk_main_quit();
}
static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
gtk_main_quit();
return FALSE;
}
static void activate (GtkStatusIcon* status_icon, gpointer user_data) {
g_debug("'activate' signal triggered");
}
//To compile append `pkg-config --cflags --libs gtk+-2.0`
int main( int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *image;
GtkWidget *table;
GdkPixbuf *pixbuf;
GtkStatusIcon *status_icon;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);
gtk_window_set_title(GTK_WINDOW(window), "Pixbuf Example");
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
table = gtk_table_new(10, 10, TRUE);
gtk_container_add(GTK_CONTAINER(window), table);
gtk_widget_show(table);
pixbuf = gdk_pixbuf_new_from_file("/home/annonymous/Pictures/icon.png", NULL);
image = gtk_image_new_from_pixbuf(pixbuf);
//gtk_table_attach_defaults(GTK_TABLE(table), image, 1, 3, 1, 3);
gtk_widget_show(image);
status_icon = gtk_status_icon_new_from_pixbuf(pixbuf);
gtk_status_icon_set_tooltip_text(GTK_STATUS_ICON(status_icon), "This is a tool tip");
gtk_status_icon_set_visible(status_icon, TRUE);
//gtk_widget_show(status_icon);
g_debug("embedded: %s", gtk_status_icon_is_embedded(status_icon) ? "yes" : "no");
g_signal_connect_swapped(G_OBJECT(window), "destroy-event",
G_CALLBACK(destroy_event), G_OBJECT(window));
g_signal_connect_swapped(G_OBJECT(window), "delete-event",
G_CALLBACK(delete_event), NULL);
g_signal_connect (G_OBJECT (status_icon), "activate",
G_CALLBACK (activate), NULL);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
Hope this helps.