Add popup version of main menu bar to nsgtk, accessable via right-mouse button
svn path=/trunk/netsurf/; revision=3390
This commit is contained in:
parent
a3fcf23c3b
commit
6002c9d217
|
@ -59,6 +59,9 @@ struct gtk_scaffolding {
|
|||
|
||||
GladeXML *xml;
|
||||
|
||||
GladeXML *popup_xml;
|
||||
GtkMenu *popup_menu;
|
||||
|
||||
struct gtk_history_window *history_window;
|
||||
|
||||
int throb_frame;
|
||||
|
@ -758,6 +761,22 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
|
|||
|
||||
g->fullscreen = false;
|
||||
|
||||
/* create the popup version of the menu */
|
||||
g->popup_xml = glade_xml_new(glade_file_location, "menuPopup", NULL);
|
||||
g->popup_menu = GTK_MENU(glade_xml_get_widget(g->popup_xml, "menuPopup"));
|
||||
|
||||
#define POPUP_ATTACH(x, y) gtk_menu_item_set_submenu( \
|
||||
GTK_MENU_ITEM(glade_xml_get_widget(g->popup_xml, x)),\
|
||||
GTK_WIDGET(glade_xml_get_widget(g->xml, y)))
|
||||
|
||||
POPUP_ATTACH("menupopup_file", "menumain_file");
|
||||
POPUP_ATTACH("menupopup_edit", "menumain_edit");
|
||||
POPUP_ATTACH("menupopup_view", "menumain_view");
|
||||
POPUP_ATTACH("menupopup_navigate", "menumain_navigate");
|
||||
POPUP_ATTACH("menupopup_help", "menumain_help");
|
||||
|
||||
#undef POPUP_ATTACH
|
||||
|
||||
/* finally, show the window. */
|
||||
gtk_widget_show(GTK_WIDGET(g->window));
|
||||
|
||||
|
@ -833,3 +852,9 @@ gboolean nsgtk_scaffolding_is_busy(nsgtk_scaffolding *scaffold)
|
|||
/* We are considered "busy" if the stop button is sensitive */
|
||||
return GTK_WIDGET_SENSITIVE((GTK_WIDGET(scaffold->stop_button)));
|
||||
}
|
||||
|
||||
void nsgtk_scaffolding_popup_menu(nsgtk_scaffolding *g, guint button)
|
||||
{
|
||||
printf("foo.\n");
|
||||
gtk_menu_popup(g->popup_menu, NULL, NULL, NULL, NULL, button, 0);
|
||||
}
|
||||
|
|
|
@ -22,4 +22,6 @@ void nsgtk_attach_toplevel_viewport(nsgtk_scaffolding *g, GtkViewport *vp);
|
|||
|
||||
void nsgtk_scaffolding_destroy(nsgtk_scaffolding *scaffold);
|
||||
|
||||
void nsgtk_scaffolding_popup_menu(nsgtk_scaffolding *g, guint button);
|
||||
|
||||
#endif /* NETSURF_GTK_SCAFFOLDING_H */
|
||||
|
|
|
@ -334,8 +334,11 @@ gboolean nsgtk_window_button_press_event(GtkWidget *widget,
|
|||
if (event->button == 2) /* 2 == middle button on X */
|
||||
button = BROWSER_MOUSE_CLICK_2;
|
||||
|
||||
if (event->button == 3) /* 3 == right button on X */
|
||||
return TRUE; /* Do nothing for right click for now */
|
||||
if (event->button == 3) {
|
||||
/* 3 == right button on X */
|
||||
nsgtk_scaffolding_popup_menu(g->scaffold, event->button);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
browser_window_mouse_click(g->bw, button,
|
||||
event->x / g->scale, event->y / g->scale);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menuitem4_menu">
|
||||
<widget class="GtkMenu" id="menumain_file">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="new_window">
|
||||
|
@ -262,7 +262,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menuitem5_menu">
|
||||
<widget class="GtkMenu" id="menumain_edit">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="cut">
|
||||
|
@ -372,7 +372,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menuitem6_menu">
|
||||
<widget class="GtkMenu" id="menumain_view">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="stop">
|
||||
|
@ -667,13 +667,13 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="navigate">
|
||||
<widget class="GtkMenuItem" id="menuitem7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Navigate</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="navigate_menu">
|
||||
<widget class="GtkMenu" id="menumain_navigate">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="back">
|
||||
|
@ -796,13 +796,13 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="help">
|
||||
<widget class="GtkMenuItem" id="menuitem8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="help_menu">
|
||||
<widget class="GtkMenu" id="menumain_help">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="contents">
|
||||
|
@ -5545,4 +5545,57 @@ OF THE POSSIBILITY OF SUCH DAMAGES.
|
|||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkMenu" id="menuPopup">
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_file">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_object">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="label" translatable="yes">Object</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_edit">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Edit</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">View</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_navigate">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Navigate</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_menupopup_navigate_activate" last_modification_time="Mon, 09 Jul 2007 13:07:30 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menupopup_help">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
|
Loading…
Reference in New Issue