Ticket #206: gui_gtk_accels.diff

File gui_gtk_accels.diff, 4.3 KB (added by sleske, 10 years ago)

Activate accelerator keys for GTK GUI. Also adds more accelerator keys.

  • navit/navit/gui/gtk/gui_gtk_action.c

    diff --git a/navit/navit/gui/gtk/gui_gtk_action.c b/navit/navit/gui/gtk/gui_gtk_action.c
    index 18de11d..7775438 100644
    a b static GtkActionEntry entries[] = 
    206206        { "LayoutMenuAction", NULL, _n("Layout") },
    207207        { "ProjectionMenuAction", NULL, _n("Projection") },
    208208        { "VehicleMenuAction", NULL, _n("Vehicle") },
    209         { "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("ZoomOut"), NULL, _n("Decrease zoom level"), G_CALLBACK(zoom_out_action) },
    210         { "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("ZoomIn"), NULL, _n("Increase zoom level"), G_CALLBACK(zoom_in_action) },
    211         { "RefreshAction", GTK_STOCK_REFRESH, _n("Recalculate"), NULL, _n("Redraw map"), G_CALLBACK(refresh_action) },
     209        { "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("ZoomOut"), "<control>minus", _n("Decrease zoom level"), G_CALLBACK(zoom_out_action) },
     210        { "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("ZoomIn"), "<control>plus", _n("Increase zoom level"), G_CALLBACK(zoom_in_action) },
     211        { "RefreshAction", GTK_STOCK_REFRESH, _n("Recalculate"), "<control>R", _n("Redraw map"), G_CALLBACK(refresh_action) },
    212212#ifdef GTK_STOCK_INFO
    213213        { "InfoAction", GTK_STOCK_INFO, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
    214214#else
    215215        { "InfoAction", NULL, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
    216216#endif /*GTK_STOCK_INFO*/
    217         { "DestinationAction", "flag_icon", _n("Set destination"), NULL, _n("Opens address search dialog"), G_CALLBACK(destination_action) },
    218         { "RouteClearAction", NULL, _n("Stop Navigation"), NULL, NULL, G_CALLBACK(route_clear_action) },
     217        { "DestinationAction", "flag_icon", _n("Set destination"), "<control>D", _n("Opens address search dialog"), G_CALLBACK(destination_action) },
     218        { "RouteClearAction", NULL, _n("Stop Navigation"), "<control>S", NULL, G_CALLBACK(route_clear_action) },
    219219        { "Test", NULL, _n("Test"), NULL, NULL, G_CALLBACK(destination_action) },
    220         { "QuitAction", GTK_STOCK_QUIT, _n("_Quit"), "<control>Q",_n("Quit the application"), G_CALLBACK (quit_action) }
     220        { "QuitAction", GTK_STOCK_QUIT, _n("Quit"), "<control>Q",_n("Quit the application"), G_CALLBACK (quit_action) }
    221221};
    222222
    223223static guint n_entries = G_N_ELEMENTS (entries);
    static GtkToggleActionEntry toggleentries[] = 
    227227        { "CursorAction", "cursor_icon",_n("Show position cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE },
    228228        { "TrackingAction", NULL ,_n("Lock on Road"), NULL, NULL, G_CALLBACK(tracking_action),TRUE },
    229229        { "OrientationAction", "orientation_icon", _n("Keep orientation to the North"), NULL, _n("Switches map orientation to the north or the vehicle"), G_CALLBACK(orient_north_action),FALSE },
    230         { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), NULL, _n("Show/hide route description"), G_CALLBACK(roadbook_action), FALSE },
    231         { "AutozoomAction", GTK_STOCK_ZOOM_FIT, _n("Autozoom"), NULL, _n("Enable/disable automatic zoom level changing"), G_CALLBACK(autozoom_action), FALSE },
     230        { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), "<control>B", _n("Show/hide route description"), G_CALLBACK(roadbook_action), FALSE },
     231        { "AutozoomAction", GTK_STOCK_ZOOM_FIT, _n("Autozoom"), "<control>A", _n("Enable/disable automatic zoom level changing"), G_CALLBACK(autozoom_action), FALSE },
    232232#ifdef GTK_STOCK_FULLSCREEN
    233         { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
     233        { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), "<control>F", NULL, G_CALLBACK(window_fullscreen_action), FALSE }
    234234#else
    235         { "FullscreenAction", NULL, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
     235        { "FullscreenAction", NULL, _n("Fullscreen"), "<control>F", NULL, G_CALLBACK(window_fullscreen_action), FALSE }
    236236#endif /*GTK_STOCK_FULLSCREEN*/
    237237};
    238238
  • navit/navit/gui/gtk/gui_gtk_window.c

    diff --git a/navit/navit/gui/gtk/gui_gtk_window.c b/navit/navit/gui/gtk/gui_gtk_window.c
    index ce94769..b725cf9 100644
    a b gui_gtk_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs, st 
    774774        if (this->statusbar_enable) {
    775775                this->statusbar=gui_gtk_statusbar_new(this);
    776776        }
     777        gtk_window_add_accel_group (GTK_WINDOW (this->win),
     778            gtk_ui_manager_get_accel_group(this->ui_manager));
    777779        gtk_container_add(GTK_CONTAINER(this->win), this->vbox);
    778780        gtk_widget_show_all(this->win);
    779781