--- trunk/src/main.c 2009/07/05 17:38:06 21
+++ trunk/src/main.c 2009/12/02 20:05:52 226
@@ -15,10 +15,14 @@
* along with GPXView. If not, see .
*/
-#include
+#define __USE_GNU
#include
+
+#include
#include
+#include
+
#include
#include
@@ -29,13 +33,18 @@
#ifdef USE_MAEMO
#include
+#if MAEMO_VERSION_MAJOR >= 5
+#include
+#include
+#include
+#endif
#endif
#include
extern char *strcasestr (__const char *__haystack, __const char *__needle);
-#ifdef USE_BREAD_CRUMB_TRAIL
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
static void crumb_add(appdata_t *appdata, char *name, int level,
gpointer user_data);
@@ -92,13 +101,18 @@
}
}
+#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
GtkWidget *dialog = gtk_message_dialog_new(
GTK_WINDOW(NULL),
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- buf);
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE, buf);
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR"));
+#else
+ GtkWidget *dialog =
+ hildon_note_new_information(GTK_WINDOW(NULL), buf);
+#endif
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
@@ -138,39 +152,50 @@
gtk_widget_show_all (GTK_WIDGET(dialog));
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) {
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+
+ if(filename) {
+ gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));
- gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window));
-
- if(!whole_dir)
- gpx = gpx_parse(dialog, filename);
- else {
- /* cur trailing '/' if present */
- if(strlastchr(filename) == '/')
- filename[strlen(filename)] = 0;
-
- gpx = gpx_parse_dir(dialog, filename);
- }
-
- gpx_busy_dialog_destroy(dialog);
-
- /* save path if gpx was successfully loaded */
- if(gpx) {
- char *r = strrchr(filename, '/');
-
- /* there is a delimiter, use everything left of it as path */
- if(r && !whole_dir) {
- *r = 0;
- if(appdata->path) free(appdata->path);
- appdata->path = strdup(filename);
- /* restore path ... just in case ... */
- *r = '/';
+ if(!whole_dir)
+ gpx = gpx_parse(dialog, filename, appdata->username);
+ else {
+ /* cur trailing '/' if present */
+ if(strlastchr(filename) == '/')
+ filename[strlen(filename)] = 0;
+
+ gpx = gpx_parse_dir(dialog, filename, appdata->username);
}
- if(whole_dir)
- appdata->path = strdup(filename);
- }
+ gpx_busy_dialog_destroy(dialog);
+
+ /* save path if gpx was successfully loaded */
+ if(gpx) {
+ char *r = strrchr(filename, '/');
+
+ /* there is a delimiter, use everything left of it as path */
+ if(r && !whole_dir) {
+ *r = 0;
+ if(appdata->path) free(appdata->path);
+ appdata->path = strdup(filename);
+ /* restore path ... just in case ... */
+ *r = '/';
+ }
+
+ if(whole_dir)
+ appdata->path = strdup(filename);
+ } else
+ errorf(_("Load error"));
- g_free (filename);
+ g_free (filename);
+ } else {
+#ifndef USE_MAEMO
+ errorf(_("Error accessing the file."));
+#else
+ errorf(_("Error accessing the file. This may happen if the file "
+ "resides on a remote file system. Please copy the file onto "
+ "the device (e.g. onto the memory card) and try again."));
+#endif
+ }
}
gtk_widget_destroy (dialog);
@@ -194,7 +219,20 @@
CACHELIST_NUM_COLS
} ;
-void cachelist_view_onRowActivated(GtkTreeView *treeview,
+void cachelist_goto_cache(appdata_t *appdata, cache_t *cache) {
+#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
+ cache_dialog(appdata, cache);
+#else
+ crumb_add(appdata, cache->name, CRUMB_CACHE, cache);
+
+ gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
+ appdata->cur_view = cache_view(appdata, cache);
+ gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
+ gtk_widget_show_all(appdata->vbox);
+#endif
+}
+
+static void cachelist_view_onRowActivated(GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *col,
gpointer userdata) {
@@ -202,19 +240,16 @@
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
+#ifdef USE_MAEMO
+ /* check if a cache is already selected and ignore click if yes */
+ /* (was probably a double click) */
+ if(appdata->cur_cache) return;
+#endif
+
if(gtk_tree_model_get_iter(model, &iter, path)) {
cache_t *cache;
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);
-#ifndef USE_BREAD_CRUMB_TRAIL
- cache_dialog(appdata, cache);
-#else
- gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
- appdata->cur_view = cache_view(appdata, cache);
- gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
- gtk_widget_show_all(appdata->vbox);
-
- crumb_add(appdata, cache->name, CRUMB_CACHE, cache);
-#endif
+ cachelist_goto_cache(appdata, cache);
}
}
@@ -257,13 +292,6 @@
cache_t *sel_cache);
void cachelist_redraw(appdata_t *appdata) {
-#ifndef USE_MAEMO
- // gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
- // appdata->cur_view = gpxlist_create_view_and_model(appdata, NULL);
- // gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
- // gtk_widget_show_all(appdata->vbox);
-#else
-
if(!appdata->cur_view) {
printf("cachelist redraw: no active view\n");
return;
@@ -281,8 +309,6 @@
if(redraw) {
GtkWidget *container = appdata->vbox;
- printf("redraw %d\n", redraw);
-
#ifdef USE_STACKABLE_WINDOW
HildonWindowStack *stack = hildon_window_stack_get_default();
container = hildon_window_stack_peek(stack);
@@ -309,7 +335,6 @@
gtk_widget_show_all(container);
}
-#endif
}
@@ -317,19 +342,19 @@
printf("cachelist timer fired!\n");
-#ifdef USE_MAEMO
appdata_t *appdata = (appdata_t*)data;
if(appdata->cur_cache)
return TRUE;
+#ifdef USE_MAEMO
if(appdata->cachelist_disable_screensaver)
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK)
fprintf(stderr, "error with display blank\n");
+#endif
if(appdata->cachelist_update)
cachelist_redraw(appdata);
-#endif
return TRUE;
}
@@ -451,10 +476,12 @@
if(tint > 8) tint = 8;
/* cache type includes "solved" flag in lowest bit */
- int type = (cache->type<<8) +
- (cache->notes?4:0) +
- ((cache->notes && cache->notes->override)?1:0) +
- ((cache->notes && cache->notes->found)?2:0);
+ int type = cache->type<<8;
+ if(cache->notes) type |= 4;
+ if(cache->notes && cache->notes->override) type |= 1;
+ if(cache->notes && cache->notes->found) type |= 2;
+ if(cache->found) type |= 2;
+ if(cache->mine) type |= 8;
if((!(type & 2)) || !appdata->cachelist_hide_found) {
@@ -570,24 +597,34 @@
static void search_result_free(gpx_t *result);
void on_cachelist_destroy(GtkWidget *widget, appdata_t *appdata) {
+ printf("cachelist destroy\n");
+
+ HildonWindowStack *stack = hildon_window_stack_get_default();
+ appdata->window = HILDON_WINDOW(hildon_window_stack_peek(stack));
+
if(appdata->search_results) {
search_result_free(appdata->search_results);
appdata->search_results = NULL;
}
appdata->cur_gpx = NULL;
+#ifdef ENABLE_OSM_GPS_MAP
+ map_update(appdata);
+#endif
+
/* restore cur_view */
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");
}
void cachelist_dialog(appdata_t *appdata, gpx_t *gpx) {
GtkWidget *window = hildon_stackable_window_new();
-
+ appdata->window = HILDON_WINDOW(window);
+
/* store last "cur_view" in window */
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);
appdata->cur_gpx = gpx;
- char *title = g_strdup_printf("GPXView - %s", gpx->name);
+ char *title = g_strdup_printf("%s - GPXView", gpx->name);
gtk_window_set_title(GTK_WINDOW(window), title);
g_free(title);
@@ -602,6 +639,10 @@
G_CALLBACK(on_cachelist_destroy), appdata);
gtk_widget_show_all(window);
+
+#ifdef ENABLE_OSM_GPS_MAP
+ map_update(appdata);
+#endif
}
#endif
#endif
@@ -634,7 +675,7 @@
return icon_get(ICON_FILE, 0);
}
-static void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) {
+void gpxlist_set(GtkListStore *store, GtkTreeIter *iter, gpx_t *gpx) {
char date_str[32], cnum[32];
if(gpx->year && gpx->month && gpx->day) {
@@ -659,7 +700,7 @@
GPXLIST_COL_OPEN, !gpx->closed,
GPXLIST_COL_CACHES, gpx->closed?NULL:cnum,
#ifdef USE_PANNABLE_AREA
- GPXLIST_COL_DELETE, icon_get(ICON_MISC, 7),
+ GPXLIST_COL_DELETE, icon_get(ICON_MISC, 4),
#endif
GPXLIST_COL_DATA, gpx,
-1);
@@ -705,6 +746,26 @@
gconf_save_closed_name(appdata, gpx->filename, gpx->name);
}
+void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx) {
+#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
+#ifdef USE_STACKABLE_WINDOW
+ if(!appdata->cur_gpx)
+#endif
+ cachelist_dialog(appdata, gpx);
+#ifdef USE_STACKABLE_WINDOW
+ else
+ printf("selected gpx, but cachelist window already present\n");
+#endif
+#else
+ gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
+ appdata->cur_view = cachelist_create(appdata, gpx, NULL);
+ gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
+ gtk_widget_show_all(appdata->vbox);
+
+ crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx);
+#endif
+}
+
static void gpxlist_view_onRowActivated(GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *col,
@@ -713,6 +774,12 @@
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
+#ifdef USE_MAEMO
+ /* check if a cache is already selected and ignore click if yes */
+ /* (was probably a double click) */
+ if(appdata->cur_gpx) return;
+#endif
+
if (gtk_tree_model_get_iter(model, &iter, path)) {
gpx_t *gpx;
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1);
@@ -725,11 +792,13 @@
if(col_name && !strcmp(col_name, "Del")) {
printf("clicked delete\n");
+#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
/* ask user what he wants */
GtkWidget *dialog = gtk_message_dialog_new(
GTK_WINDOW(appdata->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_CANCEL,
_("Do you want to close this entry only or do "
"you want to remove it completely from the list?"));
@@ -738,11 +807,44 @@
_("Close"), 2,
NULL);
+ gtk_window_set_title(GTK_WINDOW(dialog), _("Close or remove entry?"));
+#else
+
+ GtkWidget *dialog =
+ gtk_dialog_new_with_buttons(_("Close or remove entry?"),
+ GTK_WINDOW(appdata->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ _("Remove"), 1,
+ _("Close"), 2,
+ NULL);
+
+ GtkWidget *content_area =
+ gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+ GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(hbox),
+ gtk_image_new_from_stock( GTK_STOCK_DIALOG_QUESTION,
+ GTK_ICON_SIZE_DIALOG),
+ FALSE, FALSE, 0);
+
+ GtkWidget *label = gtk_label_new(
+ _("Do you want to close this entry only or do "
+ "you want to remove it completely from the list?"));
+
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD);
+
+ gtk_box_pack_start_defaults(GTK_BOX(hbox), label);
+ gtk_container_add (GTK_CONTAINER (content_area), hbox);
+
+ gtk_widget_show_all (dialog);
+#endif
+
if(gpx->closed)
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE);
- gtk_window_set_title(GTK_WINDOW(dialog), _("Remove entry?"));
-
/* set the active flag again if the user answered "no" */
switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
@@ -772,9 +874,9 @@
gpx_t *new = NULL;
if(g_file_test(gpx->filename, G_FILE_TEST_IS_DIR))
- new = gpx_parse_dir(dialog, gpx->filename);
+ new = gpx_parse_dir(dialog, gpx->filename, appdata->username);
else
- new = gpx_parse(dialog, gpx->filename);
+ new = gpx_parse(dialog, gpx->filename, appdata->username);
if(new) {
gpx_t **prev = &(appdata->gpx);
@@ -810,27 +912,34 @@
gpx_busy_dialog_destroy(dialog);
}
-#ifndef USE_BREAD_CRUMB_TRAIL
-#ifdef USE_STACKABLE_WINDOW
- if(!appdata->cur_gpx)
-#endif
- cachelist_dialog(appdata, gpx);
-#ifdef USE_STACKABLE_WINDOW
- else
- printf("selected gpx, but cachelist window already present\n");
-#endif
-#else
- gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
- appdata->cur_view = cachelist_create(appdata, gpx, NULL);
- gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
- gtk_widget_show_all(appdata->vbox);
-
- crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx);
-#endif
+
+ gpxlist_goto_cachelist(appdata, gpx);
}
}
}
+/* search gpx file in gpx list */
+gboolean gpxlist_find(appdata_t *appdata, GtkTreeIter *iter, gpx_t *gpx) {
+ GtkTreeModel *model =
+ gtk_tree_view_get_model(GTK_TREE_VIEW(appdata->gpxview));
+
+ gboolean found =
+ gtk_tree_model_get_iter_first(model, iter);
+
+ while(found) {
+ gpx_t *this_gpx;
+ gtk_tree_model_get(model, iter, GPXLIST_COL_DATA, &this_gpx, -1);
+
+ if(gpx == this_gpx)
+ return TRUE;
+
+ found = gtk_tree_model_iter_next(model, iter);
+ }
+
+ return FALSE;
+}
+
+
#ifndef USE_PANNABLE_AREA
static gboolean
view_selection_func(GtkTreeSelection *selection, GtkTreeModel *model,
@@ -881,7 +990,11 @@
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),
-1, "Icon", renderer,
"pixbuf", GPXLIST_COL_ICON,
- // "sensitive", GPXLIST_COL_OPEN,
+#ifdef USE_PANNABLE_AREA
+ /* at least one entry needs to be sensitive. */
+ /* This is the delete icon if the PANNABLE_AREA is used */
+ "sensitive", GPXLIST_COL_OPEN,
+#endif
NULL);
/* --- "FileName" column --- */
@@ -937,7 +1050,7 @@
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),
-1, "Del", renderer,
"pixbuf", GPXLIST_COL_DELETE,
- "sensitive", GPXLIST_COL_OPEN,
+ // "sensitive", GPXLIST_COL_OPEN,
NULL);
#endif
@@ -957,7 +1070,7 @@
GtkTreeIter iter;
gtk_list_store_append(appdata->gpxstore, &iter);
gpxlist_set(appdata->gpxstore, &iter, gpx);
-
+
if(gpx == sel_gpx) {
sel_iter = iter;
sel_iter_valid = TRUE;
@@ -1001,7 +1114,7 @@
}
/* add last entry in gpx list to visual representation */
-static void gpxlist_add(appdata_t *appdata, gpx_t *new) {
+void gpxlist_add(appdata_t *appdata, gpx_t *new) {
GtkTreeIter iter;
gtk_list_store_append(appdata->gpxstore, &iter);
@@ -1011,18 +1124,41 @@
gpx_t **gpx = &appdata->gpx;
while(*gpx) gpx = &((*gpx)->next);
*gpx = new;
+
+ /* select new iter */
+ GtkTreeSelection *selection =
+ gtk_tree_view_get_selection(GTK_TREE_VIEW(appdata->gpxview));
+ gtk_tree_selection_select_iter(selection, &iter);
+ GtkTreePath *path =
+ gtk_tree_model_get_path(GTK_TREE_MODEL(appdata->gpxstore), &iter);
+ gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(appdata->gpxview),
+ path, NULL, TRUE, 0.0, 0.0);
+ gtk_tree_path_free(path);
}
/******************** end of gpxlist ********************/
/******************** begin of menu *********************/
+typedef struct {
+ appdata_t *appdata;
+ GtkWidget *dialog;
+} about_context_t;
+
+#ifdef ENABLE_BROWSER_INTERFACE
+void on_paypal_button_clicked(GtkButton *button, about_context_t *context) {
+ gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT);
+ browser_url(context->appdata,
+ "https://www.paypal.com/cgi-bin/webscr"
+ "?cmd=_s-xclick&hosted_button_id=7400558");
+}
+#endif
+
static void
cb_menu_about(GtkWidget *window, gpointer data) {
- GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
+ about_context_t context;
- gtk_about_dialog_set_name(about, "GPXView");
- gtk_about_dialog_set_version(about, VERSION);
+ context.appdata = (appdata_t *)data;
#ifdef ENABLE_LIBLOCATION
char *uses = "uses liblocation";
@@ -1032,25 +1168,47 @@
char *uses = "uses gpsd";
#endif
- char *str = g_strdup_printf("%s\n\n(%s)",
- _("GPXView (c) 2008-2009 by\n"
- "Till Harbaum \n"
- "Mailing list: gpxview-users@garage.maemo.org"),
- _(uses)
- );
-
- gtk_about_dialog_set_copyright(about, str);
- g_free(str);
-
- gtk_about_dialog_set_website(about,
- _("http://www.harbaum.org/till/maemo"));
-
- gtk_about_dialog_set_comments(about,
- _("Geocaching.com GPX file viewer"));
-
- gtk_widget_show_all(GTK_WIDGET(about));
- gtk_dialog_run(GTK_DIALOG(about));
- gtk_widget_destroy(GTK_WIDGET(about));
+ const gchar *authors[] = {
+ "Till Harbaum ",
+ "John Stowers ",
+ "GCVote: Guido Wegener ",
+ NULL };
+
+ context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,
+ "name", "GPXView",
+ "version", VERSION,
+ "copyright", _("Copyright 2008-2009"),
+ "authors", authors,
+ "website", _("http://www.harbaum.org/till/maemo"),
+ "comments", _(uses),
+ NULL);
+
+#ifdef ENABLE_BROWSER_INTERFACE
+ /* add a way to donate to the project */
+ GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0);
+
+ GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
+ gtk_box_pack_start(GTK_BOX(hbox),
+ gtk_label_new(_("Do you like GPXView?")),
+ FALSE, FALSE, 0);
+
+ GtkWidget *button = gtk_button_new();
+ gtk_button_set_image(GTK_BUTTON(button),
+ icon_get_widget(ICON_MISC, 5));
+ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(on_paypal_button_clicked), &context);
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+
+ gtk_container_add(GTK_CONTAINER(alignment), hbox);
+ gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox),
+ alignment);
+
+ gtk_widget_show_all(alignment);
+#endif
+
+ gtk_dialog_run(GTK_DIALOG(context.dialog));
+ gtk_widget_destroy(context.dialog);
}
#if defined(USE_MAEMO) && defined(HILDON_HELP)
@@ -1222,8 +1380,8 @@
else if(cache->long_description && (what & SEARCH_DESC) &&
strcasestr(cache->long_description, phrase))
hit = 1;
- else if(cache->owner && (what & SEARCH_OWNER) &&
- strcasestr(cache->owner, phrase))
+ else if(cache->owner && cache->owner->name && (what & SEARCH_OWNER) &&
+ strcasestr(cache->owner->name, phrase))
hit = 1;
if(hit) {
@@ -1252,11 +1410,38 @@
GtkWidget *in_id, *in_name, *in_desc, *in_owner, *in_finds;
} search_context_t;
+
+static GtkWidget *check_button_new_with_label(char *label) {
+#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
+ return gtk_check_button_new_with_label(label);
+#else
+ GtkWidget *cbut =
+ hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+ gtk_button_set_label(GTK_BUTTON(cbut), label);
+ return cbut;
+#endif
+}
+
+static void check_button_set_active(GtkWidget *button, gboolean active) {
+#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
+#else
+ hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active);
+#endif
+}
+
+static gboolean check_button_get_active(GtkWidget *button) {
+#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
+ return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+#else
+ return hildon_check_button_get_active(HILDON_CHECK_BUTTON(button));
+#endif
+}
+
static void callback_finds_toggled(GtkWidget *widget, gpointer data ) {
search_context_t *context = (search_context_t*)data;
- gboolean in_finds = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(context->in_finds));
+ gboolean in_finds = check_button_get_active(context->in_finds);
gtk_widget_set_sensitive(context->entry, !in_finds);
gtk_widget_set_sensitive(context->in_id, !in_finds);
@@ -1286,24 +1471,20 @@
GtkWidget *table = gtk_table_new(2, 2, TRUE);
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8);
- context.in_id = gtk_check_button_new_with_label(_("Waypoint IDs"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_id),
- appdata->search & SEARCH_ID);
+ context.in_id = check_button_new_with_label(_("Waypoint IDs"));
+ check_button_set_active(context.in_id, appdata->search & SEARCH_ID);
gtk_table_attach_defaults(GTK_TABLE(table), context.in_id, 0, 1, 0, 1);
- context.in_name = gtk_check_button_new_with_label(_("Names"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_name),
- appdata->search & SEARCH_NAME);
+ context.in_name = check_button_new_with_label(_("Names"));
+ check_button_set_active(context.in_name, appdata->search & SEARCH_NAME);
gtk_table_attach_defaults(GTK_TABLE(table), context.in_name, 1, 2, 0, 1);
- context.in_desc = gtk_check_button_new_with_label(_("Descriptions"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_desc),
- appdata->search & SEARCH_DESC);
+ context.in_desc = check_button_new_with_label(_("Descriptions"));
+ check_button_set_active(context.in_desc, appdata->search & SEARCH_DESC);
gtk_table_attach_defaults(GTK_TABLE(table), context.in_desc, 0, 1, 1, 2);
- context.in_owner = gtk_check_button_new_with_label(_("Owner"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_owner),
- appdata->search & SEARCH_OWNER);
+ context.in_owner = check_button_new_with_label(_("Owner"));
+ check_button_set_active(context.in_owner, appdata->search & SEARCH_OWNER);
gtk_table_attach_defaults(GTK_TABLE(table), context.in_owner, 1, 2, 1, 2);
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
@@ -1312,8 +1493,10 @@
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),
gtk_label_new(_("Search for:")));
+ context.entry = entry_new();
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),
- context.entry = gtk_entry_new());
+ context.entry);
+
if(appdata->search_str)
gtk_entry_set_text(GTK_ENTRY(context.entry), appdata->search_str);
@@ -1324,9 +1507,8 @@
GtkWidget *hbox = gtk_hbox_new(FALSE, 5);
- context.in_finds = gtk_check_button_new_with_label(_("Search finds for"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_finds),
- appdata->search & SEARCH_FINDS);
+ context.in_finds = check_button_new_with_label(_("Search finds for"));
+ check_button_set_active(context.in_finds, appdata->search & SEARCH_FINDS);
gtk_box_pack_start_defaults(GTK_BOX(hbox), context.in_finds);
g_signal_connect(G_OBJECT(context.in_finds), "toggled",
G_CALLBACK(callback_finds_toggled), &context);
@@ -1366,27 +1548,27 @@
HILDON_NUMBER_EDITOR(context.spinner));
#endif
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_finds)))
+ if(check_button_get_active(context.in_finds))
appdata->search |= SEARCH_FINDS;
else
appdata->search &= ~SEARCH_FINDS;
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_id)))
+ if(check_button_get_active(context.in_id))
appdata->search |= SEARCH_ID;
else
appdata->search &= ~SEARCH_ID;
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_name)))
+ if(check_button_get_active(context.in_name))
appdata->search |= SEARCH_NAME;
else
appdata->search &= ~SEARCH_NAME;
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_desc)))
+ if(check_button_get_active(context.in_desc))
appdata->search |= SEARCH_DESC;
else
appdata->search &= ~SEARCH_DESC;
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_owner)))
+ if(check_button_get_active(context.in_owner))
appdata->search |= SEARCH_OWNER;
else
appdata->search &= ~SEARCH_OWNER;
@@ -1399,7 +1581,7 @@
printf("Search for %s (flags = %x)...\n", p, appdata->search);
-#ifndef USE_BREAD_CRUMB_TRAIL
+#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
gpx_t *found =
search_do(appdata, appdata->gpx, p, appdata->search, FALSE);
@@ -1433,7 +1615,7 @@
gtk_widget_destroy(dialog);
}
-void on_window_destroy (GtkWidget *widget, gpointer data);
+static void on_window_destroy (GtkWidget *widget, gpointer data);
#ifndef USE_MAEMO
static void
@@ -1493,19 +1675,13 @@
cb_menu_export_log(GtkWidget *widget, gpointer data) {
appdata_t *appdata = (appdata_t*)data;
notes_log_export(appdata);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
-#ifdef USE_MAEMO
+#ifdef ENABLE_MAEMO_MAPPER
static void
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) {
appdata_t *appdata = (appdata_t*)data;
mmpoi_export(appdata);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
#endif
@@ -1513,136 +1689,167 @@
cb_menu_export_garmin(GtkWidget *widget, gpointer data) {
appdata_t *appdata = (appdata_t*)data;
garmin_export(appdata);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
+#ifdef ENABLE_OSM_GPS_MAP
+static void
+cb_menu_map(GtkWidget *window, gpointer data) {
+ map((appdata_t *)data);
+}
+#endif
+
static void
cb_menu_geomath(GtkWidget *window, gpointer data) {
geomath_dialog((appdata_t *)data);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
static void
cb_menu_geotext(GtkWidget *window, gpointer data) {
geotext_dialog((appdata_t *)data);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
static void
cb_menu_precpos(GtkWidget *window, gpointer data) {
precise_position((appdata_t *)data);
-#ifdef USE_STACKABLE_WINDOW
- hildon_window_stack_pop_1 (hildon_window_stack_get_default());
-#endif
}
-#ifdef USE_STACKABLE_WINDOW
-static GtkWidget *export_menu_create(appdata_t *appdata) {
- GtkWidget *button;
- HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());
+static void
+cb_menu_geotoad(GtkWidget *window, gpointer data) {
+ geotoad((appdata_t *)data);
+}
- button = hildon_button_new_with_text(
- HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Export to Maemo Mapper"),
- _("Save a Maemo Mapper POI file"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_export_mmpoi), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
+#ifdef USE_STACKABLE_WINDOW
+typedef struct {
+ char *label, *desc;
+ GtkSignalFunc activate_cb;
+} menu_entry_t;
- button = hildon_button_new_with_text(
- HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Export Field Notes"),
- _("Save a Garmin Field Notes file"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_export_log), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
+typedef struct {
+ const char *title;
+ const menu_entry_t *menu;
+ int len;
+} submenu_t;
- button = hildon_button_new_with_text(
- HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Export Garmin GPX"),
- _("Save modified waypoints in GPX file"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_export_garmin), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
+#define COLUMNS 1
- gtk_widget_show_all(GTK_WIDGET(menu));
+void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) {
- return GTK_WIDGET(menu);
+ /* force closing of submenu dialog */
+ gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE);
+ gtk_widget_hide(menu);
+
+ /* let gtk clean up */
+ while(gtk_events_pending())
+ gtk_main_iteration();
}
-/* the export submenu */
-void on_export_clicked(GtkButton *button, appdata_t *appdata) {
- if(!appdata->export_menu)
- appdata->export_menu = export_menu_create(appdata);
+static GtkWidget *app_submenu_create(appdata_t *appdata,
+ const submenu_t *submenu) {
- /* draw a popup menu */
- hildon_app_menu_popup(HILDON_APP_MENU(appdata->export_menu),
- GTK_WINDOW(hildon_window_stack_peek(
- hildon_window_stack_get_default())));
-}
+ /* create a oridinary dialog box */
+ GtkWidget *dialog = gtk_dialog_new();
+ gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title));
+ gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),
+ GTK_WINDOW(appdata->window));
+ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
-static GtkWidget *tools_menu_create(appdata_t *appdata) {
- GtkWidget *button;
- HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());
+ GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE);
+ int x = 0, y = 0;
- /* the following doesn't have an effect */
- // gtk_window_set_title(GTK_WINDOW(menu), "Tools");
+ const menu_entry_t *menu_entries = submenu->menu;
+ while(menu_entries->label) {
+ GtkWidget *button = NULL;
- button = hildon_button_new_with_text(
+ button = hildon_button_new_with_text(
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Geomath"),
- _("Geocoordinate calculation"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_geomath), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
+ _(menu_entries->label), _(menu_entries->desc));
+ /* try to center both texts */
+ hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5);
+ hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5);
- button = hildon_button_new_with_text(
- HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Geotext"),
- _("Text analysis"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_geotext), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
-
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(on_submenu_entry_clicked), dialog);
+
+ g_signal_connect(button, "clicked",
+ menu_entries->activate_cb, appdata);
+
+ gtk_table_attach_defaults(GTK_TABLE(table), button, x, x+1, y, y+1);
+
+ x++;
+ if(x == COLUMNS) { x = 0; y++; }
- button = hildon_button_new_with_text(
- HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- _("Precise Position"),
- _("Calculate a precise GPS position"));
- g_signal_connect(button, "clicked",
- G_CALLBACK(cb_menu_precpos), appdata);
- hildon_app_menu_append(menu, GTK_BUTTON(button));
+ menu_entries++;
+ }
- gtk_widget_show_all(GTK_WIDGET(menu));
+ gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
- return GTK_WIDGET(menu);
+ return dialog;
}
+/* popup the dialog shaped submenu */
+static void submenu_popup(GtkWidget *menu) {
+ gtk_widget_show_all(menu);
+ gtk_dialog_run(GTK_DIALOG(menu));
+ gtk_widget_hide(menu);
+}
+
+static void submenu_cleanup(GtkWidget *menu) {
+ gtk_widget_destroy(menu);
+}
+
+static const menu_entry_t submenu_export_entries[] = {
+#ifdef ENABLE_MAEMO_MAPPER
+ { "Export to Maemo Mapper" , "Save a Maemo Mapper POI file",
+ G_CALLBACK(cb_menu_export_mmpoi) },
+#endif
+ { "Export Field Notes", "Save a Garmin Field Notes file",
+ G_CALLBACK(cb_menu_export_log) },
+ { "Export Garmin GPX", "Save modified waypoints in GPX file",
+ G_CALLBACK(cb_menu_export_garmin) },
+ { NULL, NULL, NULL }
+};
+
+static const submenu_t submenu_export = {
+ "Export", submenu_export_entries,
+ sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1
+};
+
+/* the export submenu */
+void on_export_clicked(GtkButton *button, appdata_t *appdata) {
+ if(!appdata->export_menu)
+ appdata->export_menu = app_submenu_create(appdata, &submenu_export);
+
+ submenu_popup(appdata->export_menu);
+}
+
+static const menu_entry_t submenu_tools_entries[] = {
+ { "Geomath", "Geocoordinate calculation",
+ G_CALLBACK(cb_menu_geomath) },
+ { "Geotext", "Text analysis",
+ G_CALLBACK(cb_menu_geotext) },
+ { "Precise Position", "Calculate a precise GPS position",
+ G_CALLBACK(cb_menu_precpos) },
+ { "GeoToad", "Use GeoToad online downloader",
+ G_CALLBACK(cb_menu_geotoad) },
+ { NULL, NULL, NULL }
+};
+
+static const submenu_t submenu_tools = {
+ "Tools", submenu_tools_entries,
+ sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1
+};
+
/* the tools submenu */
void on_tools_clicked(GtkButton *button, appdata_t *appdata) {
if(!appdata->tools_menu)
- appdata->tools_menu = tools_menu_create(appdata);
+ appdata->tools_menu = app_submenu_create(appdata, &submenu_tools);
- /* draw a popup menu */
- hildon_app_menu_popup(HILDON_APP_MENU(appdata->tools_menu),
- GTK_WINDOW(hildon_window_stack_peek(
- hildon_window_stack_get_default())));
+ submenu_popup(appdata->tools_menu);
}
-
HildonAppMenu *menu_create(appdata_t *appdata, int mode) {
GtkWidget *button;
HildonAppMenu *menu = HILDON_APP_MENU(hildon_app_menu_new());
@@ -1668,9 +1875,7 @@
g_signal_connect_after(button, "clicked",
G_CALLBACK(cb_menu_adddir), appdata);
hildon_app_menu_append(menu, GTK_BUTTON(button));
- }
- if(mode == MENU_GPXLIST) {
button = gtk_button_new_with_label(_("Export"));
g_signal_connect_after(button, "clicked",
G_CALLBACK(on_export_clicked), appdata);
@@ -1687,6 +1892,13 @@
G_CALLBACK(on_tools_clicked), appdata);
hildon_app_menu_append(menu, GTK_BUTTON(button));
+#ifdef ENABLE_OSM_GPS_MAP
+ button = gtk_button_new_with_label(_("Map"));
+ g_signal_connect_after(button, "clicked",
+ G_CALLBACK(cb_menu_map), appdata);
+ hildon_app_menu_append(menu, GTK_BUTTON(button));
+#endif
+
#ifdef HILDON_HELP
button = gtk_button_new_with_label(_("Help"));
g_signal_connect_after(button, "clicked",
@@ -1704,7 +1916,7 @@
GtkWidget *menu, *item;
menu = gtk_menu_new();
-#ifdef USE_BREAD_CRUMB_TRAIL
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
appdata->menu_import =
#endif
item = gtk_menu_item_new_with_label(_("Import"));
@@ -1734,7 +1946,7 @@
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata);
#endif
-#ifdef USE_BREAD_CRUMB_TRAIL
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
appdata->menu_export =
#endif
item = gtk_menu_item_new_with_label(_("Export"));
@@ -1742,7 +1954,7 @@
submenu = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
-#ifdef USE_MAEMO
+#ifdef ENABLE_MAEMO_MAPPER
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") );
gtk_menu_append(GTK_MENU_SHELL(submenu), item);
g_signal_connect(item, "activate",
@@ -1759,7 +1971,7 @@
g_signal_connect(item, "activate",
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata);
-#ifdef USE_BREAD_CRUMB_TRAIL
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
appdata->menu_search =
#endif
item = gtk_menu_item_new_with_label( _("Search") );
@@ -1768,11 +1980,8 @@
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
-#ifndef NO_COPY_N_PASTE
/* ----------- copy'n paste submenu ----------------- */
- appdata->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_can_store(appdata->clipboard, NULL, 0);
-
+#ifndef NO_COPY_N_PASTE
item = gtk_menu_item_new_with_label(_("Edit"));
gtk_menu_append(GTK_MENU_SHELL(menu), item);
submenu = gtk_menu_new();
@@ -1799,6 +2008,13 @@
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
+#ifdef ENABLE_OSM_GPS_MAP
+ item = gtk_menu_item_new_with_label( _("Map") );
+ gtk_menu_append(GTK_MENU_SHELL(menu), item);
+ g_signal_connect(item, "activate",
+ GTK_SIGNAL_FUNC(cb_menu_map), appdata);
+#endif
+
item = gtk_menu_item_new_with_label(_("Tools"));
gtk_menu_append(GTK_MENU_SHELL(menu), item);
submenu = gtk_menu_new();
@@ -1819,6 +2035,11 @@
g_signal_connect(item, "activate",
GTK_SIGNAL_FUNC(cb_menu_precpos), appdata);
+ item = gtk_menu_item_new_with_label( _("GeoToad") );
+ gtk_menu_append(GTK_MENU_SHELL(submenu), item);
+ g_signal_connect(item, "activate",
+ GTK_SIGNAL_FUNC(cb_menu_geotoad), appdata);
+
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
#if defined(USE_MAEMO) && defined(HILDON_HELP)
@@ -1858,10 +2079,14 @@
/********************* end of menu **********************/
void cleanup(appdata_t *appdata) {
+ gconf_save_state(appdata);
+
gpx_free_all(appdata->gpx);
- if(appdata->path) free(appdata->path);
- if(appdata->image_path) free(appdata->image_path);
- if(appdata->search_str) free(appdata->search_str);
+
+#ifdef USE_STACKABLE_WINDOW
+ if(appdata->export_menu) submenu_cleanup(appdata->export_menu);
+ if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu);
+#endif
gnome_vfs_shutdown();
icons_free();
@@ -1891,10 +2116,9 @@
puts("everything is gone");
}
-void on_window_destroy (GtkWidget *widget, gpointer data) {
+static void on_window_destroy (GtkWidget *widget, gpointer data) {
appdata_t *appdata = (appdata_t*)data;
- gconf_save_state(appdata);
gtk_main_quit();
appdata->window = NULL;
}
@@ -1954,7 +2178,7 @@
return handled;
}
-#ifdef USE_BREAD_CRUMB_TRAIL
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
typedef struct {
int level;
appdata_t *appdata;
@@ -2046,6 +2270,10 @@
gtk_widget_show_all(crumb->appdata->vbox);
g_free(data);
+
+#ifdef ENABLE_OSM_GPS_MAP
+ map_update(crumb->appdata);
+#endif
}
static void crumb_add(appdata_t *appdata, char *name, int level,
@@ -2086,8 +2314,16 @@
#endif
}
+#ifdef USE_BREAD_CRUMB_TRAIL
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct),
name, crumb, (GDestroyNotify)crumb_back);
+#else
+ bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back);
+#endif
+
+#ifdef ENABLE_OSM_GPS_MAP
+ map_update(appdata);
+#endif
}
#endif // USE_BREAD_CRUMB_TRAIL
@@ -2099,18 +2335,6 @@
return;
}
-#ifndef USE_MAEMO
- // in non-maemo setup this can only affect the main screen as
- // the menu is blocked while a dialog is open. also the main
- // screen is always present
- if(appdata->gpxlist_items != appdata->cur_items) {
- /* re-do the main screen */
- gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
- appdata->cur_view = gpxlist_create_view_and_model(appdata, NULL);
- gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
- gtk_widget_show_all(appdata->vbox);
- }
-#else
/* a cache screen cannot be changed from the settings and thus doesn't */
/* need to be redrawn */
if(appdata->cur_cache) {
@@ -2165,7 +2389,6 @@
gtk_widget_show_all(container);
}
-#endif // USE_MAEMO
}
int main(int argc, char *argv[]) {
@@ -2186,6 +2409,10 @@
gtk_init (&argc, &argv);
+ misc_init();
+
+ curl_global_init(CURL_GLOBAL_ALL);
+
#ifdef USE_MAEMO
printf("Installing osso context for \"org.harbaum." APP "\"\n");
appdata.osso_context = osso_initialize("org.harbaum."APP,
@@ -2194,8 +2421,10 @@
fprintf(stderr, "error initiating osso context\n");
}
+#ifdef ENABLE_MAEMO_MAPPER
dbus_register(&appdata);
#endif
+#endif
icons_init();
@@ -2219,7 +2448,7 @@
/* Create a Window. */
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* Set a decent default size for the window. */
- gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300);
+ gtk_window_set_default_size(GTK_WINDOW(appdata.window), 640, 480);
#endif
#if MAEMO_VERSION_MAJOR == 5
@@ -2232,9 +2461,12 @@
g_signal_connect(G_OBJECT(appdata.window), "key_press_event",
G_CALLBACK(on_window_key_press), &appdata);
+ /* prepare clipboard */
+ appdata.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_can_store(appdata.clipboard, NULL, 0);
+
appdata.vbox = gtk_vbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);
-
#ifndef USE_STACKABLE_WINDOW
menu_create(&appdata);
#else
@@ -2248,6 +2480,16 @@
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0);
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct));
+#else
+#ifdef BCT
+ /* on non-hildon machines we use some custom made breadcrumbtrail */
+ /* replacement */
+ appdata.bct = bct_new();
+ gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0);
+#endif
+#endif
+
+#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT)
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL);
#endif