From 62b8d0bfdeb3e9b76d0b373035c2e4a96f9fa483 Mon Sep 17 00:00:00 2001 From: horwitz Date: Fri, 10 Aug 2007 12:07:13 +0000 Subject: [PATCH] add fullscreen option to display menu of main window git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@378 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/gui/gtk/gui_gtk_action.c | 61 ++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/navit/src/gui/gtk/gui_gtk_action.c b/navit/src/gui/gtk/gui_gtk_action.c index f84eaee..7932d40 100644 --- a/navit/src/gui/gtk/gui_gtk_action.c +++ b/navit/src/gui/gtk/gui_gtk_action.c @@ -28,61 +28,70 @@ struct menu_priv { /* Create callbacks that implement our Actions */ static void -zoom_in_action(GtkWidget *w, struct navit *nav, void *dummy) +zoom_in_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_zoom_in(nav, 2); + navit_zoom_in(gui->nav, 2); } static void -zoom_out_action(GtkWidget *w, struct navit *nav, void *dummy) +zoom_out_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_zoom_out(nav, 2); + navit_zoom_out(gui->nav, 2); } static void -refresh_action(GtkWidget *w, struct navit *nav, void *dummy) +refresh_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_draw(nav); + navit_draw(gui->nav); } static void -roadbook_action(GtkWidget *w, struct navit *nav, void *dummy) +roadbook_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_window_roadbook_new(nav); + navit_window_roadbook_new(gui->nav); } static void -cursor_action(GtkWidget *w, struct navit *nav, void *dummy) +cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_toggle_cursor(nav); + navit_toggle_cursor(gui->nav); #if 0 ac->gui->co->flags->track=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)); #endif } static void -tracking_action(GtkWidget *w, struct navit *nav, void *dummy) +tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_toggle_tracking(nav); + navit_toggle_tracking(gui->nav); #if 0 ac->gui->co->flags->track=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)); #endif } static void -orient_north_action(GtkWidget *w, struct navit *nav, void *dummy) +orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { #if 0 ac->gui->co->flags->orient_north=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)); #endif } +static void +window_fullscreen_action(GtkWidget *w, struct gui_priv *gui, void *dummy) +{ + if(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) + gtk_window_fullscreen(GTK_WINDOW(gui->win)); + else + gtk_window_unfullscreen(GTK_WINDOW(gui->win)); +} + #include #include "point.h" #include "transform.h" static void -info_action(GtkWidget *w, struct navit *nav, void *dummy) +info_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { char buffer[512]; int mw,mh; @@ -90,7 +99,7 @@ info_action(GtkWidget *w, struct navit *nav, void *dummy) struct point p; struct transformation *t; - t=navit_get_trans(nav); + t=navit_get_trans(gui->nav); transform_get_size(t, &mw, &mh); p.x=0; p.y=0; @@ -106,22 +115,22 @@ info_action(GtkWidget *w, struct navit *nav, void *dummy) static void -route_clear_action(GtkWidget *w, struct navit *nav, void *dummy) +route_clear_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_set_destination(nav, NULL, NULL); + navit_set_destination(gui->nav, NULL, NULL); } static void -destination_action(GtkWidget *w, struct navit *nav, void *dummy) +destination_action(GtkWidget *w, struct gui_priv *gui, void *dummy) { - destination_address(nav); + destination_address(gui->nav); } static void -quit_action (GtkWidget *w, struct navit *nav, void *dummy) +quit_action (GtkWidget *w, struct gui_priv *gui, void *dummy) { - navit_destroy(nav); + navit_destroy(gui->nav); } static void @@ -194,7 +203,8 @@ static GtkToggleActionEntry toggleentries[] = { { "CursorAction", "cursor_icon",_n("Cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE }, { "TrackingAction", NULL ,_n("Tracking"), NULL, NULL, G_CALLBACK(tracking_action),TRUE }, - { "OrientationAction", "orientation_icon", _n("Orientation"), NULL, NULL, G_CALLBACK(orient_north_action),FALSE } + { "OrientationAction", "orientation_icon", _n("Orientation"), NULL, NULL, G_CALLBACK(orient_north_action),FALSE }, + { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE } }; static guint n_toggleentries = G_N_ELEMENTS (toggleentries); @@ -345,6 +355,7 @@ static char layout[] = \ \ \ + \ \ \ \ @@ -501,10 +512,10 @@ gui_gtk_ui_new (struct gui_priv *this, struct menu_methods *meth, char *path, in gtk_action_group_set_translation_domain(this->base_group,"navit"); gtk_action_group_set_translation_domain(this->debug_group,"navit"); gtk_action_group_set_translation_domain(this->dyn_group,"navit"); - gtk_action_group_add_actions (this->base_group, entries, n_entries, this->nav); - gtk_action_group_add_toggle_actions (this->base_group, toggleentries, n_toggleentries, this->nav); + gtk_action_group_add_actions (this->base_group, entries, n_entries, this); + gtk_action_group_add_toggle_actions (this->base_group, toggleentries, n_toggleentries, this); gtk_ui_manager_insert_action_group (this->menu_manager, this->base_group, 0); - gtk_action_group_add_actions (this->debug_group, debug_entries, n_debug_entries, this->nav); + gtk_action_group_add_actions (this->debug_group, debug_entries, n_debug_entries, this); gtk_ui_manager_insert_action_group (this->menu_manager, this->debug_group, 0); gtk_ui_manager_add_ui_from_string (this->menu_manager, layout, strlen(layout), &error); gtk_ui_manager_insert_action_group (this->menu_manager, this->dyn_group, 0); -- 2.7.4