We Make Easy to Share your Script!


Please Wait till the Whole syntax and colors load........
#include <gtk/gtk.h>

int main(int argc,char *argv[])
{
   GtkWidget *vbox;
   GtkWidget *window;

   GtkWidget *menu;
   GtkWidget *filemenu;
   GtkWidget *file;
   GtkWidget *quit;

   gtk_init(&argc,&argv);

   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title(GTK_WINDOW(window), "title");
//I have added this extra line as earlier there was no display there was only icon on taskbar
   gtk_widget_show(window);

   vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(window), vbox);

   menu = gtk_menu_bar_new();

   filemenu = gtk_menu_new();

   file = gtk_menu_item_new_with_label("File");
   quit = gtk_menu_item_new_with_label("Quit");

   gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu);
   gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit);
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), file); /* Error was here */
   gtk_box_pack_start(GTK_BOX(vbox), menu, FALSE, FALSE, 3);

   gtk_widget_show_all(window);

   g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

   g_signal_connect(quit, "activate", G_CALLBACK(gtk_main_quit), NULL);

   gtk_main();

   return 0;
}