~ubuntu-branches/ubuntu/vivid/nip2/vivid-proposed

« back to all changes in this revision

Viewing changes to src/program.c

  • Committer: Bazaar Package Importer
  • Author(s): Jay Berkenbilt
  • Date: 2010-10-18 20:33:55 UTC
  • mfrom: (2.2.4 experimental) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20101018203355-z2zmf7klex8n74fl
Add abrowser as an additional choice to satisfy the browser
dependency.  This removes differences between the Debian and Ubuntu
versions of the package.  (Closes: #600550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1477
1477
static void
1478
1478
program_find_again_action_cb( GtkAction *action, Program *program )
1479
1479
{
 
1480
        if( !program->search )
 
1481
                return;
 
1482
 
1480
1483
        if( program->find_sym ) 
1481
1484
                program->find_start += 1;
1482
1485
 
1633
1636
static GtkActionEntry program_actions[] = {
1634
1637
        /* Menu items.
1635
1638
         */
1636
 
        { "FileMenu", NULL, "_File" },
1637
 
        { "FileNewMenu", NULL, "_New" },
1638
 
        { "EditMenu", NULL, "_Edit" },
1639
1639
        { "DebugMenu", NULL, "_Debug" },
1640
 
        { "HelpMenu", NULL, "_Help" },
1641
1640
 
1642
1641
        /* Actions.
1643
1642
         */
1696
1695
                N_( "Remove and reload all startup data" ), 
1697
1696
                G_CALLBACK( program_reload_action_cb ) },
1698
1697
 
1699
 
        { "Close", 
1700
 
                GTK_STOCK_CLOSE, N_( "_Close" ), NULL,
1701
 
                N_( "Close" ), 
1702
 
                G_CALLBACK( iwindow_kill_action_cb ) },
1703
 
 
1704
1698
        { "Cut", 
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 ) },
1773
1767
 
1774
 
        { "About", 
1775
 
                NULL, N_( "_About" ), NULL,
1776
 
                N_( "About this program" ), 
1777
 
                G_CALLBACK( mainw_about_action_cb ) },
1778
 
 
1779
 
        { "Guide", 
1780
 
                GTK_STOCK_HELP, N_( "_Contents" ), "F1",
1781
 
                N_( "Open the users guide" ), 
1782
 
                G_CALLBACK( mainw_guide_action_cb ) },
1783
 
 
1784
1768
        { "HelpTool", 
1785
1769
                NULL, N_( "Help on _Tool" ), NULL,
1786
1770
                N_( "View docs for this tool" ), 
1791
1775
"<ui>"
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'/>"
1835
1819
"      <menuitem action='Guide'/>"
1836
1820
"      <menuitem action='About'/>"
1837
1821
"      <menuitem action='HelpTool'/>"
 
1822
"      <separator/>"
 
1823
"      <menuitem action='Homepage'/>"
1838
1824
"    </menu>"
1839
1825
"  </menubar>"
1840
1826
"</ui>";
2056
2042
static void
2057
2043
program_edit_map_cb( GtkWidget *widget, Program *program )
2058
2044
{
 
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 );
 
2050
 
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,
2066
2054
                NULL, NULL );
 
2055
 
2067
2056
        GtkAction *action;
2068
2057
 
2069
 
        action = gtk_action_group_get_action( program->action_group, 
2070
 
                "Paste" );
 
2058
        action = gtk_action_group_get_action( iwnd->action_group, "Paste" );
2071
2059
        g_object_set( G_OBJECT( action ), 
2072
2060
                "sensitive", available && editable,
2073
2061
                NULL );
2074
2062
 
2075
 
        action = gtk_action_group_get_action( program->action_group, 
2076
 
                "Copy" );
 
2063
        action = gtk_action_group_get_action( iwnd->action_group, "Copy" );
2077
2064
        g_object_set( G_OBJECT( action ), 
2078
2065
                "sensitive", selected,
2079
2066
                NULL );
2080
2067
 
2081
 
        action = gtk_action_group_get_action( program->action_group, 
2082
 
                "Cut" );
2083
 
        g_object_set( G_OBJECT( action ), 
2084
 
                "sensitive", selected && editable,
2085
 
                NULL );
2086
 
 
2087
 
        action = gtk_action_group_get_action( program->action_group, 
2088
 
                "Delete" );
2089
 
        g_object_set( G_OBJECT( action ), 
2090
 
                "sensitive", selected && editable,
2091
 
                NULL );
2092
 
 
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,
 
2071
                NULL );
 
2072
 
 
2073
        action = gtk_action_group_get_action( iwnd->action_group, "Delete" );
 
2074
        g_object_set( G_OBJECT( action ), 
 
2075
                "sensitive", selected && editable,
 
2076
                NULL );
 
2077
 
 
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,
2134
2119
static void
2135
2120
program_build( Program *program, GtkWidget *vbox )
2136
2121
{
2137
 
        GtkAccelGroup *accel_group;
 
2122
        iWindow *iwnd = IWINDOW( program );
 
2123
 
2138
2124
        GError *error;
2139
2125
 
2140
2126
        GtkWidget *mbar;
2146
2132
 
2147
2133
        /* Make main menu bar
2148
2134
         */
2149
 
        program->action_group = gtk_action_group_new( "ProgramActions" );
2150
 
        gtk_action_group_set_translation_domain( program->action_group, 
2151
 
                GETTEXT_PACKAGE );
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 ) );
2155
2138
 
2156
 
        program->ui_manager = gtk_ui_manager_new();
2157
 
        gtk_ui_manager_insert_action_group( program->ui_manager, 
2158
 
                program->action_group, 0 );
2159
 
 
2160
 
        accel_group = gtk_ui_manager_get_accel_group( program->ui_manager );
2161
 
        gtk_window_add_accel_group( GTK_WINDOW( program ), accel_group );
2162
 
 
2163
2139
        error = NULL;
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 );
2169
2145
        }
2170
2146
 
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 );
2175
2151
 
2176
2152
        /* On map of the edit menu, rethink cut/copy/paste sensitivity.
2177
2153
         */
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",