185 |
vbox = gtk_vbox_new(FALSE, 4); |
vbox = gtk_vbox_new(FALSE, 4); |
186 |
|
|
187 |
/* hbox containing the four columns of cache details */ |
/* hbox containing the four columns of cache details */ |
188 |
|
GtkWidget *pbox = portrait_box_new(FALSE, 0); |
189 |
|
|
190 |
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
191 |
|
|
192 |
/* vbox containing leftmost column (icon and container) */ |
/* vbox containing leftmost column (icon and container) */ |
242 |
|
|
243 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
244 |
|
|
245 |
|
/* pack left two columns into portrait box */ |
246 |
|
gtk_box_pack_start_defaults(GTK_BOX(pbox), ihbox); |
247 |
|
ihbox = gtk_hbox_new(FALSE, 0); |
248 |
|
|
249 |
/* ----------- vbox containing all ratings ---------- */ |
/* ----------- vbox containing all ratings ---------- */ |
250 |
colbox = gtk_vbox_new(FALSE, 0); |
colbox = gtk_vbox_new(FALSE, 0); |
251 |
|
|
328 |
} |
} |
329 |
|
|
330 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
331 |
|
gtk_box_pack_start_defaults(GTK_BOX(pbox), ihbox); |
332 |
|
|
333 |
/* ----------------------------------------------------- */ |
/* ----------------------------------------------------- */ |
334 |
|
|
335 |
gtk_box_pack_start(GTK_BOX(vbox), ihbox, FALSE, FALSE, 0); |
gtk_box_pack_start(GTK_BOX(vbox), pbox, FALSE, FALSE, 0); |
336 |
gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0); |
gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0); |
337 |
|
|
338 |
/* ----------------------------------------------------- */ |
/* ----------------------------------------------------- */ |
605 |
if(gc_link) { |
if(gc_link) { |
606 |
GtkWidget *but = |
GtkWidget *but = |
607 |
gtk_button_new_with_label(_("Post a new log entry for this geocache")); |
gtk_button_new_with_label(_("Post a new log entry for this geocache")); |
|
#if 0 |
|
|
gtk_button_set_image(GTK_BUTTON(but), |
|
|
gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); |
|
|
gtk_button_set_image_position(GTK_BUTTON(but), GTK_POS_LEFT); |
|
|
#endif |
|
608 |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5) |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5) |
609 |
hildon_gtk_widget_set_theme_size(but, |
hildon_gtk_widget_set_theme_size(but, |
610 |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
780 |
g_free(context); |
g_free(context); |
781 |
} |
} |
782 |
|
|
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
|
|
#define CUSTOM_NOTEBOOK |
|
|
#endif |
|
|
|
|
|
static GtkWidget *notebook_new(void) { |
|
|
#ifdef CUSTOM_NOTEBOOK |
|
|
GtkWidget *vbox = gtk_vbox_new(FALSE, 0); |
|
|
|
|
|
GtkWidget *notebook = gtk_notebook_new(); |
|
|
|
|
|
/* prevents user from accidentially touching the breadcrumb trail */ |
|
|
/* (looks ugly on fremantle as it isn't themed) */ |
|
|
// gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM); |
|
|
|
|
|
/* solution for fremantle: we use a row of ordinary buttons instead */ |
|
|
/* of regular tabs */ |
|
|
|
|
|
/* hide the regular tabs */ |
|
|
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE); |
|
|
|
|
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), notebook); |
|
|
|
|
|
/* store a reference to the notebook in the vbox */ |
|
|
g_object_set_data(G_OBJECT(vbox), "notebook", (gpointer)notebook); |
|
|
|
|
|
/* create a hbox for the buttons */ |
|
|
GtkWidget *hbox = gtk_hbox_new(TRUE, 0); |
|
|
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
|
|
g_object_set_data(G_OBJECT(vbox), "hbox", (gpointer)hbox); |
|
|
|
|
|
return vbox; |
|
|
#else |
|
|
return gtk_notebook_new(); |
|
|
#endif |
|
|
} |
|
|
|
|
|
#ifdef CUSTOM_NOTEBOOK |
|
|
static void on_notebook_button_clicked(GtkWidget *button, gpointer data) { |
|
|
GtkNotebook *nb = |
|
|
GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook")); |
|
|
|
|
|
gint page = (gint)g_object_get_data(G_OBJECT(button), "page"); |
|
|
gtk_notebook_set_current_page(nb, page); |
|
|
} |
|
|
#endif |
|
|
|
|
|
static void notebook_append_page(GtkWidget *notebook, |
|
|
GtkWidget *page, char *label) { |
|
|
#ifdef CUSTOM_NOTEBOOK |
|
|
GtkNotebook *nb = |
|
|
GTK_NOTEBOOK(g_object_get_data(G_OBJECT(notebook), "notebook")); |
|
|
|
|
|
gint page_num = gtk_notebook_append_page(nb, page, gtk_label_new(label)); |
|
|
GtkWidget *button = NULL; |
|
|
|
|
|
/* select button for page 0 by default */ |
|
|
if(!page_num) { |
|
|
button = gtk_radio_button_new_with_label(NULL, label); |
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); |
|
|
g_object_set_data(G_OBJECT(notebook), "group_master", (gpointer)button); |
|
|
} else { |
|
|
GtkWidget *master = g_object_get_data(G_OBJECT(notebook), "group_master"); |
|
|
button = gtk_radio_button_new_with_label_from_widget( |
|
|
GTK_RADIO_BUTTON(master), label); |
|
|
} |
|
|
|
|
|
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE); |
|
|
g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num); |
|
|
|
|
|
gtk_signal_connect(GTK_OBJECT(button), "clicked", |
|
|
GTK_SIGNAL_FUNC(on_notebook_button_clicked), notebook); |
|
|
|
|
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5) |
|
|
hildon_gtk_widget_set_theme_size(button, |
|
|
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
|
|
#endif |
|
|
|
|
|
gtk_box_pack_start_defaults( |
|
|
GTK_BOX(g_object_get_data(G_OBJECT(notebook), "hbox")), |
|
|
button); |
|
|
|
|
|
#else |
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, gtk_label_new(label)); |
|
|
#endif |
|
|
} |
|
|
|
|
783 |
static GObject *notebook_object(GtkWidget *notebook) { |
static GObject *notebook_object(GtkWidget *notebook) { |
784 |
#ifdef CUSTOM_NOTEBOOK |
return G_OBJECT(notebook_get_gtk_notebook(notebook)); |
|
return G_OBJECT(g_object_get_data(G_OBJECT(notebook), "notebook")); |
|
|
#else |
|
|
return G_OBJECT(notebook); |
|
|
#endif |
|
785 |
} |
} |
786 |
|
|
787 |
GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) { |
GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) { |
813 |
notebook_append_page(notebook, |
notebook_append_page(notebook, |
814 |
cache_hint(appdata, cache), _("Hint")); |
cache_hint(appdata, cache), _("Hint")); |
815 |
|
|
816 |
if(cache->log) |
// always display log page to allow user to post a new log |
817 |
|
if(cache->log |
818 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
819 |
|
|| (strncmp(cache->id, "GC", 2) == 0) |
820 |
|
#endif |
821 |
|
) |
822 |
notebook_append_page(notebook, |
notebook_append_page(notebook, |
823 |
cache_logs(appdata, cache_context, cache->log, cache->logs_are_html), |
cache_logs(appdata, cache_context, cache->log, cache->logs_are_html), |
824 |
_("Logs")); |
_("Logs")); |
831 |
notebook_append_page(notebook, |
notebook_append_page(notebook, |
832 |
cache_tbs(appdata, cache->tb), _("TBs")); |
cache_tbs(appdata, cache->tb), _("TBs")); |
833 |
|
|
834 |
notebook_append_page(notebook, |
/* the demo caches don't have coordinates, so avoid */ |
835 |
cache_notes(cache_context), _("Notes")); |
/* having to deal with them */ |
836 |
|
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) { |
837 |
|
notebook_append_page(notebook, |
838 |
|
cache_notes(cache_context), _("Notes")); |
839 |
|
|
840 |
notebook_append_page(notebook, |
notebook_append_page(notebook, |
841 |
goto_cache(cache_context), _("Goto")); |
goto_cache(cache_context), _("Goto")); |
842 |
|
} |
843 |
|
|
844 |
g_signal_connect(notebook_object(notebook), "switch-page", |
g_signal_connect(notebook_object(notebook), "switch-page", |
845 |
G_CALLBACK(on_notebook_page_change), cache_context); |
G_CALLBACK(on_notebook_page_change), cache_context); |
892 |
appdata->cur_cache = cache; |
appdata->cur_cache = cache; |
893 |
gtk_window_set_title(GTK_WINDOW(window), cache->name); |
gtk_window_set_title(GTK_WINDOW(window), cache->name); |
894 |
|
|
895 |
|
/* make sure window can control gps */ |
896 |
|
g_signal_connect(G_OBJECT(window), "focus-in-event", |
897 |
|
G_CALLBACK(on_main_focus_change), appdata); |
898 |
|
|
899 |
|
g_signal_connect(G_OBJECT(window), "focus-out-event", |
900 |
|
G_CALLBACK(on_main_focus_change), appdata); |
901 |
|
|
902 |
/* create cache visualization widget */ |
/* create cache visualization widget */ |
903 |
appdata->cur_view = cache_view(appdata, cache); |
appdata->cur_view = cache_view(appdata, cache); |
904 |
gtk_container_add(GTK_CONTAINER(window), appdata->cur_view); |
gtk_container_add(GTK_CONTAINER(window), appdata->cur_view); |