GtkWidget *window;
GtkWidget *scrolled_window;
GtkWidget *treeview;
+ GtkWidget *button;
GtkListStore *liststore;
GtkTreeModel *sortmodel;
struct callback *click, *close;
+ struct gui_priv *gui;
};
-static void
-gui_gtk_datawindow_destroy(struct datawindow_priv *win)
-{
- return;
-}
-
static GValue value;
static void
select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, struct datawindow_priv *win)
{
callback_call_0(win->close);
+ if (win->button) {
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(win->button), FALSE);
+ }
+
return FALSE;
}
+void
+gui_gtk_datawindow_destroy(struct datawindow_priv *win)
+{
+ if ((!win->gui) || (!win->gui->datawindow)) {
+ return;
+ }
+
+ gui_gtk_datawindow_delete(NULL, NULL, win);
+ gtk_widget_destroy(win->window);
+ win->gui->datawindow = NULL;
+
+ return;
+}
+
+void
+gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn)
+{
+ this_->button = btn;
+}
+
static gboolean
keypress(GtkWidget *widget, GdkEventKey *event, struct datawindow_priv *win)
{
gtk_window_set_transient_for(GTK_WINDOW((GtkWidget *)(win->window)), GTK_WINDOW(gui->win));
g_signal_connect(G_OBJECT(win->window), "delete-event", G_CALLBACK(gui_gtk_datawindow_delete), win);
gtk_widget_show_all(win->window);
+
+ win->gui = gui;
+ gui->datawindow = win;
return win;
- return NULL;
}
navit_draw(gui->nav);
}
+// Forward declarations, these should not be visible outside the GUI, so
+// they are not in the header files, but here
+void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
+void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
+
static void
roadbook_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
{
- navit_window_roadbook_new(gui->nav);
+
+ if (! gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) {
+ gui_gtk_datawindow_destroy(gui->datawindow);
+ } else {
+ navit_window_roadbook_new(gui->nav);
+ if (gui->datawindow) {
+ gui_gtk_datawindow_set_button(gui->datawindow, w);
+ }
+ }
}
static void
{ "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("ZoomOut"), NULL, NULL, G_CALLBACK(zoom_out_action) },
{ "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("ZoomIn"), NULL, NULL, G_CALLBACK(zoom_in_action) },
{ "RefreshAction", GTK_STOCK_REFRESH, _n("Recalculate"), NULL, NULL, G_CALLBACK(refresh_action) },
- { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), NULL, NULL, G_CALLBACK(roadbook_action) },
#ifdef GTK_STOCK_INFO
{ "InfoAction", GTK_STOCK_INFO, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
#else
{ "CursorAction", "cursor_icon",_n("Cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE },
{ "TrackingAction", NULL ,_n("Lock on Road"), NULL, NULL, G_CALLBACK(tracking_action),TRUE },
{ "OrientationAction", "orientation_icon", _n("Northing"), NULL, NULL, G_CALLBACK(orient_north_action),FALSE },
+ { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), NULL, NULL, G_CALLBACK(roadbook_action), FALSE },
#ifdef GTK_STOCK_FULLSCREEN
{ "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
#else
toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
gtk_toggle_action_set_active(toggle_action, attr.u.num);
}
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "RoadbookAction"));
+ gtk_toggle_action_set_active(toggle_action, 0);
}
static struct menu_priv *