Created
December 9, 2013 12:23
-
-
Save varadgautam/7871481 to your computer and use it in GitHub Desktop.
Adding an item to GtkNotebook's Default Popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static GtkMenu* | |
notebook_create_tab_popup (notebook) | |
{ | |
GtkWidget *menu; | |
gint n, i; | |
GtkWidget *menuitem; | |
n = gtk_notebook_get_n_pages (notebook); | |
menu = gtk_menu_new (); | |
menuitem = gtk_menu_item_new_with_label ("Your Menu Item Here"); | |
g_signal_connect (G_OBJECT (menuitem), "activate", G_CALLBACK | |
(handler_method), NULL); /*This is the | |
item that you want | |
to insert */ | |
gtk_menu_shell_append (GTK_MENU (menu), menuitem); | |
gtk_widget_show (menuitem); | |
for(i = 0; i < n; i++) /*And this loop is used to generate | |
the rest of the menu */ | |
{ | |
const gchar *tab_name; | |
tab_name = gtk_notebook_get_tab_label (notebook); | |
/*Might have to typecast it*/ | |
menuitem = gtk_menu_item_new_with_label(tab_name); | |
g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK | |
(handler), notebook); | |
gtk_menu_shell_append (GTK_MENU (menu), menuitem); | |
gtk_widget_show (menuitem); | |
} | |
return GTK_MENU (menu); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment