1633
1636
static GtkActionEntry program_actions[] = {
1636
{ "FileMenu", NULL, "_File" },
1637
{ "FileNewMenu", NULL, "_New" },
1638
{ "EditMenu", NULL, "_Edit" },
1639
1639
{ "DebugMenu", NULL, "_Debug" },
1640
{ "HelpMenu", NULL, "_Help" },
1696
1695
N_( "Remove and reload all startup data" ),
1697
1696
G_CALLBACK( program_reload_action_cb ) },
1700
GTK_STOCK_CLOSE, N_( "_Close" ), NULL,
1702
G_CALLBACK( iwindow_kill_action_cb ) },
1705
1699
GTK_STOCK_CUT, N_( "C_ut" ), NULL,
1706
1700
N_( "Cut selected text" ),
1771
1765
N_( "Show all errors" ),
1772
1766
G_CALLBACK( program_errorreport_action_cb ) },
1775
NULL, N_( "_About" ), NULL,
1776
N_( "About this program" ),
1777
G_CALLBACK( mainw_about_action_cb ) },
1780
GTK_STOCK_HELP, N_( "_Contents" ), "F1",
1781
N_( "Open the users guide" ),
1782
G_CALLBACK( mainw_guide_action_cb ) },
1785
1769
NULL, N_( "Help on _Tool" ), NULL,
1786
1770
N_( "View docs for this tool" ),
1792
1776
" <menubar name='ProgramMenubar'>"
1793
1777
" <menu action='FileMenu'>"
1794
" <menu action='FileNewMenu'>"
1778
" <menu action='NewMenu'>"
1795
1779
" <menuitem action='NewTool'/>"
1796
1780
" <menuitem action='NewToolkit'/>"
1797
1781
" <menuitem action='NewSeparator'/>"
2057
2043
program_edit_map_cb( GtkWidget *widget, Program *program )
2045
iWindow *iwnd = IWINDOW( program );
2059
2046
GtkClipboard *clipboard = gtk_widget_get_clipboard(
2060
2047
GTK_WIDGET( program ), GDK_SELECTION_CLIPBOARD );
2061
2048
GtkTextView *text_view = GTK_TEXT_VIEW( program->text );
2062
2049
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( text_view );
2063
2051
gboolean editable = !program->kit || !program->kit->pseudo;
2064
2052
gboolean available = gtk_clipboard_wait_is_text_available( clipboard );
2065
2053
gboolean selected = gtk_text_buffer_get_selection_bounds( text_buffer,
2067
2056
GtkAction *action;
2069
action = gtk_action_group_get_action( program->action_group,
2058
action = gtk_action_group_get_action( iwnd->action_group, "Paste" );
2071
2059
g_object_set( G_OBJECT( action ),
2072
2060
"sensitive", available && editable,
2075
action = gtk_action_group_get_action( program->action_group,
2063
action = gtk_action_group_get_action( iwnd->action_group, "Copy" );
2077
2064
g_object_set( G_OBJECT( action ),
2078
2065
"sensitive", selected,
2081
action = gtk_action_group_get_action( program->action_group,
2083
g_object_set( G_OBJECT( action ),
2084
"sensitive", selected && editable,
2087
action = gtk_action_group_get_action( program->action_group,
2089
g_object_set( G_OBJECT( action ),
2090
"sensitive", selected && editable,
2093
action = gtk_action_group_get_action( program->action_group,
2068
action = gtk_action_group_get_action( iwnd->action_group, "Cut" );
2069
g_object_set( G_OBJECT( action ),
2070
"sensitive", selected && editable,
2073
action = gtk_action_group_get_action( iwnd->action_group, "Delete" );
2074
g_object_set( G_OBJECT( action ),
2075
"sensitive", selected && editable,
2078
action = gtk_action_group_get_action( iwnd->action_group,
2094
2079
"DeselectAll" );
2095
2080
g_object_set( G_OBJECT( action ),
2096
2081
"sensitive", selected,
2147
2133
/* Make main menu bar
2149
program->action_group = gtk_action_group_new( "ProgramActions" );
2150
gtk_action_group_set_translation_domain( program->action_group,
2152
gtk_action_group_add_actions( program->action_group,
2135
gtk_action_group_add_actions( iwnd->action_group,
2153
2136
program_actions, G_N_ELEMENTS( program_actions ),
2154
2137
GTK_WINDOW( program ) );
2156
program->ui_manager = gtk_ui_manager_new();
2157
gtk_ui_manager_insert_action_group( program->ui_manager,
2158
program->action_group, 0 );
2160
accel_group = gtk_ui_manager_get_accel_group( program->ui_manager );
2161
gtk_window_add_accel_group( GTK_WINDOW( program ), accel_group );
2164
if( !gtk_ui_manager_add_ui_from_string( program->ui_manager,
2140
if( !gtk_ui_manager_add_ui_from_string( iwnd->ui_manager,
2165
2141
program_menubar_ui_description, -1, &error ) ) {
2166
2142
g_message( "building menus failed: %s", error->message );
2167
2143
g_error_free( error );
2168
2144
exit( EXIT_FAILURE );
2171
mbar = gtk_ui_manager_get_widget( program->ui_manager,
2147
mbar = gtk_ui_manager_get_widget( iwnd->ui_manager,
2172
2148
"/ProgramMenubar" );
2173
2149
gtk_box_pack_start( GTK_BOX( vbox ), mbar, FALSE, FALSE, 0 );
2174
2150
gtk_widget_show( mbar );
2176
2152
/* On map of the edit menu, rethink cut/copy/paste sensitivity.
2178
item = gtk_ui_manager_get_widget( program->ui_manager,
2154
item = gtk_ui_manager_get_widget( iwnd->ui_manager,
2179
2155
"/ProgramMenubar/EditMenu/Cut" );
2180
2156
item = gtk_widget_get_parent( GTK_WIDGET( item ) );
2181
2157
gtk_signal_connect( GTK_OBJECT( item ), "map",