Diff of /trunk/src/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 128 by harbaum, Tue Sep 29 07:31:18 2009 UTC revision 189 by harbaum, Tue Nov 17 09:07:17 2009 UTC
# Line 19  Line 19 
19  #include <string.h>  #include <string.h>
20  #include <math.h>  #include <math.h>
21    
22    #include <curl/curl.h>
23    
24  #include <time.h>  #include <time.h>
25  #include <sys/time.h>  #include <sys/time.h>
26    
# Line 29  Line 31 
31    
32  #ifdef USE_MAEMO  #ifdef USE_MAEMO
33  #include <hildon/hildon-banner.h>  #include <hildon/hildon-banner.h>
34    #if MAEMO_VERSION_MAJOR >= 5
35    #include <hildon/hildon-note.h>
36    #include <hildon/hildon-check-button.h>
37    #endif
38  #endif  #endif
39    
40  #include <locale.h>  #include <locale.h>
# Line 92  void errorf(const char *fmt, ...) { Line 98  void errorf(const char *fmt, ...) {
98      }      }
99    }    }
100    
101    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
102    GtkWidget *dialog = gtk_message_dialog_new(    GtkWidget *dialog = gtk_message_dialog_new(
103                             GTK_WINDOW(NULL),                             GTK_WINDOW(NULL),
104                             GTK_DIALOG_DESTROY_WITH_PARENT,                             GTK_DIALOG_DESTROY_WITH_PARENT,
 #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)  
105                             GTK_MESSAGE_ERROR,                             GTK_MESSAGE_ERROR,
 #else  
                            GTK_MESSAGE_OTHER,  
 #endif  
106                             GTK_BUTTONS_CLOSE, buf);                             GTK_BUTTONS_CLOSE, buf);
107    
108    gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR"));    gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR"));
109    #else
110      GtkWidget *dialog =
111        hildon_note_new_information(GTK_WINDOW(NULL), buf);
112    #endif
113    
114    gtk_dialog_run(GTK_DIALOG(dialog));    gtk_dialog_run(GTK_DIALOG(dialog));
115    gtk_widget_destroy(dialog);    gtk_widget_destroy(dialog);
# Line 209  enum { Line 216  enum {
216    CACHELIST_NUM_COLS    CACHELIST_NUM_COLS
217  } ;  } ;
218    
219  void cachelist_view_onRowActivated(GtkTreeView        *treeview,  void cachelist_goto_cache(appdata_t *appdata, cache_t *cache) {
220    #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
221        cache_dialog(appdata, cache);
222    #else
223        gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
224        appdata->cur_view = cache_view(appdata, cache);
225        gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
226        gtk_widget_show_all(appdata->vbox);
227    
228        crumb_add(appdata, cache->name, CRUMB_CACHE, cache);
229    #endif
230    }
231    
232    static void cachelist_view_onRowActivated(GtkTreeView        *treeview,
233                                     GtkTreePath        *path,                                     GtkTreePath        *path,
234                                     GtkTreeViewColumn  *col,                                     GtkTreeViewColumn  *col,
235                                     gpointer            userdata) {                                     gpointer            userdata) {
# Line 226  void cachelist_view_onRowActivated(GtkTr Line 246  void cachelist_view_onRowActivated(GtkTr
246    if(gtk_tree_model_get_iter(model, &iter, path)) {    if(gtk_tree_model_get_iter(model, &iter, path)) {
247      cache_t *cache;      cache_t *cache;
248      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);      gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1);
249  #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)      cachelist_goto_cache(appdata, cache);
     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  
250    }    }
251  }  }
252    
# Line 278  static GtkWidget *cachelist_create(appda Line 289  static GtkWidget *cachelist_create(appda
289                                     cache_t *sel_cache);                                     cache_t *sel_cache);
290    
291  void cachelist_redraw(appdata_t *appdata) {  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  
   
292    if(!appdata->cur_view) {    if(!appdata->cur_view) {
293      printf("cachelist redraw: no active view\n");      printf("cachelist redraw: no active view\n");
294      return;      return;
# Line 302  void cachelist_redraw(appdata_t *appdata Line 306  void cachelist_redraw(appdata_t *appdata
306    if(redraw) {    if(redraw) {
307      GtkWidget *container = appdata->vbox;      GtkWidget *container = appdata->vbox;
308    
     printf("redraw %d\n", redraw);  
   
309  #ifdef USE_STACKABLE_WINDOW  #ifdef USE_STACKABLE_WINDOW
310      HildonWindowStack *stack = hildon_window_stack_get_default();      HildonWindowStack *stack = hildon_window_stack_get_default();
311      container = hildon_window_stack_peek(stack);      container = hildon_window_stack_peek(stack);
# Line 330  void cachelist_redraw(appdata_t *appdata Line 332  void cachelist_redraw(appdata_t *appdata
332    
333      gtk_widget_show_all(container);      gtk_widget_show_all(container);
334    }    }
 #endif  
335  }  }
336    
337    
# Line 338  static gboolean cachelist_update(gpointe Line 339  static gboolean cachelist_update(gpointe
339    
340    printf("cachelist timer fired!\n");    printf("cachelist timer fired!\n");
341    
 #ifdef USE_MAEMO  
342    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
343    
344    if(appdata->cur_cache)    if(appdata->cur_cache)
345      return TRUE;      return TRUE;
346    
347    #ifdef USE_MAEMO
348    if(appdata->cachelist_disable_screensaver)    if(appdata->cachelist_disable_screensaver)
349      if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK)      if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK)
350        fprintf(stderr, "error with display blank\n");        fprintf(stderr, "error with display blank\n");
351    #endif
352    
353    if(appdata->cachelist_update)    if(appdata->cachelist_update)
354      cachelist_redraw(appdata);      cachelist_redraw(appdata);
355    
 #endif  
   
356    return TRUE;    return TRUE;
357  }  }
358    
# Line 598  void on_cachelist_destroy(GtkWidget *wid Line 598  void on_cachelist_destroy(GtkWidget *wid
598    }    }
599    appdata->cur_gpx = NULL;    appdata->cur_gpx = NULL;
600    
601    #ifdef ENABLE_OSM_GPS_MAP
602      map_update(appdata);
603    #endif
604    
605    /* restore cur_view */    /* restore cur_view */
606    appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");    appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view");
607  }  }
# Line 624  void cachelist_dialog(appdata_t *appdata Line 628  void cachelist_dialog(appdata_t *appdata
628                     G_CALLBACK(on_cachelist_destroy), appdata);                     G_CALLBACK(on_cachelist_destroy), appdata);
629    
630    gtk_widget_show_all(window);    gtk_widget_show_all(window);
631    
632    #ifdef ENABLE_OSM_GPS_MAP
633      map_update(appdata);
634    #endif
635  }  }
636  #endif  #endif
637  #endif  #endif
# Line 681  static void gpxlist_set(GtkListStore *st Line 689  static void gpxlist_set(GtkListStore *st
689                       GPXLIST_COL_OPEN, !gpx->closed,                       GPXLIST_COL_OPEN, !gpx->closed,
690                       GPXLIST_COL_CACHES, gpx->closed?NULL:cnum,                       GPXLIST_COL_CACHES, gpx->closed?NULL:cnum,
691  #ifdef USE_PANNABLE_AREA  #ifdef USE_PANNABLE_AREA
692                       GPXLIST_COL_DELETE, icon_get(ICON_MISC, 7),                       GPXLIST_COL_DELETE, icon_get(ICON_MISC, 4),
693  #endif  #endif
694                       GPXLIST_COL_DATA, gpx,                       GPXLIST_COL_DATA, gpx,
695                       -1);                       -1);
# Line 727  static void gpxlist_close(appdata_t *app Line 735  static void gpxlist_close(appdata_t *app
735    gconf_save_closed_name(appdata, gpx->filename, gpx->name);    gconf_save_closed_name(appdata, gpx->filename, gpx->name);
736  }  }
737    
738    void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx) {
739    #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)
740    #ifdef USE_STACKABLE_WINDOW
741      if(!appdata->cur_gpx)
742    #endif
743        cachelist_dialog(appdata, gpx);
744    #ifdef USE_STACKABLE_WINDOW
745      else
746        printf("selected gpx, but cachelist window already present\n");
747    #endif
748    #else
749      gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view);
750      appdata->cur_view = cachelist_create(appdata, gpx, NULL);
751      gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view);
752      gtk_widget_show_all(appdata->vbox);
753    
754      crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx);
755    #endif
756    }
757    
758  static void gpxlist_view_onRowActivated(GtkTreeView *treeview,  static void gpxlist_view_onRowActivated(GtkTreeView *treeview,
759                            GtkTreePath        *path,                            GtkTreePath        *path,
760                            GtkTreeViewColumn  *col,                            GtkTreeViewColumn  *col,
# Line 753  static void gpxlist_view_onRowActivated( Line 781  static void gpxlist_view_onRowActivated(
781      if(col_name && !strcmp(col_name, "Del")) {      if(col_name && !strcmp(col_name, "Del")) {
782        printf("clicked delete\n");        printf("clicked delete\n");
783    
784    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
785        /* ask user what he wants */        /* ask user what he wants */
786        GtkWidget *dialog = gtk_message_dialog_new(        GtkWidget *dialog = gtk_message_dialog_new(
787                   GTK_WINDOW(appdata->window),                   GTK_WINDOW(appdata->window),
788                   GTK_DIALOG_DESTROY_WITH_PARENT,                   GTK_DIALOG_DESTROY_WITH_PARENT,
789                   GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL,                   GTK_MESSAGE_QUESTION,
790                     GTK_BUTTONS_CANCEL,
791                   _("Do you want to close this entry only or do "                   _("Do you want to close this entry only or do "
792                     "you want to remove it completely from the list?"));                     "you want to remove it completely from the list?"));
793    
# Line 766  static void gpxlist_view_onRowActivated( Line 796  static void gpxlist_view_onRowActivated(
796                               _("Close"), 2,                               _("Close"), 2,
797                               NULL);                               NULL);
798    
799          gtk_window_set_title(GTK_WINDOW(dialog), _("Close or remove entry?"));
800    #else
801    
802          GtkWidget *dialog =
803            gtk_dialog_new_with_buttons(_("Close or remove entry?"),
804                                GTK_WINDOW(appdata->window),
805                                GTK_DIALOG_DESTROY_WITH_PARENT,
806                                GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
807                                _("Remove"), 1,
808                                _("Close"), 2,
809                                NULL);
810    
811          GtkWidget *content_area =
812            gtk_dialog_get_content_area (GTK_DIALOG (dialog));
813    
814          GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
815    
816          gtk_box_pack_start(GTK_BOX(hbox),
817             gtk_image_new_from_stock( GTK_STOCK_DIALOG_QUESTION,
818                                       GTK_ICON_SIZE_DIALOG),
819                             FALSE, FALSE, 0);
820    
821          GtkWidget *label = gtk_label_new(
822                      _("Do you want to close this entry only or do "
823                        "you want to remove it completely from the list?"));
824    
825          gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
826          gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD);
827    
828          gtk_box_pack_start_defaults(GTK_BOX(hbox), label);
829          gtk_container_add (GTK_CONTAINER (content_area), hbox);
830    
831          gtk_widget_show_all (dialog);
832    #endif
833    
834        if(gpx->closed)        if(gpx->closed)
835          gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE);          gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE);
836    
       gtk_window_set_title(GTK_WINDOW(dialog), _("Remove entry?"));  
   
837        /* set the active flag again if the user answered "no" */        /* set the active flag again if the user answered "no" */
838        switch(gtk_dialog_run(GTK_DIALOG(dialog))) {        switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
839    
# Line 838  static void gpxlist_view_onRowActivated( Line 901  static void gpxlist_view_onRowActivated(
901    
902          gpx_busy_dialog_destroy(dialog);          gpx_busy_dialog_destroy(dialog);
903        }        }
904  #if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT)  
905  #ifdef USE_STACKABLE_WINDOW        gpxlist_goto_cachelist(appdata, gpx);
       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  
906      }      }
907    }    }
908  }  }
# Line 909  static GtkWidget *gpxlist_create_view_an Line 957  static GtkWidget *gpxlist_create_view_an
957    gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),    gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),
958                    -1, "Icon", renderer,                    -1, "Icon", renderer,
959                    "pixbuf", GPXLIST_COL_ICON,                    "pixbuf", GPXLIST_COL_ICON,
960                //                  "sensitive", GPXLIST_COL_OPEN,  #ifdef USE_PANNABLE_AREA
961            /* at least one entry needs to be sensitive. */
962            /* This is the delete icon if the PANNABLE_AREA is used */
963                      "sensitive", GPXLIST_COL_OPEN,
964    #endif
965                    NULL);                    NULL);
966    
967    /* --- "FileName" column --- */    /* --- "FileName" column --- */
# Line 965  static GtkWidget *gpxlist_create_view_an Line 1017  static GtkWidget *gpxlist_create_view_an
1017    gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),    gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview),
1018                    -1, "Del", renderer,                    -1, "Del", renderer,
1019                    "pixbuf", GPXLIST_COL_DELETE,                    "pixbuf", GPXLIST_COL_DELETE,
1020                    "sensitive", GPXLIST_COL_OPEN,                //                  "sensitive", GPXLIST_COL_OPEN,
1021                    NULL);                    NULL);
1022  #endif  #endif
1023    
# Line 1076  cb_menu_about(GtkWidget *window, gpointe Line 1128  cb_menu_about(GtkWidget *window, gpointe
1128    const gchar *authors[] = {    const gchar *authors[] = {
1129      "Till Harbaum <till@harbaum.org>",      "Till Harbaum <till@harbaum.org>",
1130      "John Stowers <john.stowers@gmail.com>",      "John Stowers <john.stowers@gmail.com>",
1131        "GCVote: Guido Wegener <guido.wegener@gmx.de>",
1132      NULL };      NULL };
1133    
1134    context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,    context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG,
# Line 1098  cb_menu_about(GtkWidget *window, gpointe Line 1151  cb_menu_about(GtkWidget *window, gpointe
1151    
1152    GtkWidget *button = gtk_button_new();    GtkWidget *button = gtk_button_new();
1153    gtk_button_set_image(GTK_BUTTON(button),    gtk_button_set_image(GTK_BUTTON(button),
1154                         icon_get_widget(ICON_MISC, 8));                         icon_get_widget(ICON_MISC, 5));
1155    gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);    gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1156    g_signal_connect(button, "clicked",    g_signal_connect(button, "clicked",
1157                     G_CALLBACK(on_paypal_button_clicked), &context);                     G_CALLBACK(on_paypal_button_clicked), &context);
# Line 1284  gpx_t *search_do(appdata_t *appdata, gpx Line 1337  gpx_t *search_do(appdata_t *appdata, gpx
1337        else if(cache->long_description && (what & SEARCH_DESC) &&        else if(cache->long_description && (what & SEARCH_DESC) &&
1338                strcasestr(cache->long_description, phrase))                strcasestr(cache->long_description, phrase))
1339          hit = 1;          hit = 1;
1340        else if(cache->owner && (what & SEARCH_OWNER) &&        else if(cache->owner && cache->owner->name && (what & SEARCH_OWNER) &&
1341                strcasestr(cache->owner, phrase))                strcasestr(cache->owner->name, phrase))
1342          hit = 1;          hit = 1;
1343    
1344        if(hit) {        if(hit) {
# Line 1314  typedef struct { Line 1367  typedef struct {
1367    GtkWidget *in_id, *in_name, *in_desc, *in_owner, *in_finds;    GtkWidget *in_id, *in_name, *in_desc, *in_owner, *in_finds;
1368  } search_context_t;  } search_context_t;
1369    
1370    
1371    static GtkWidget *check_button_new_with_label(char *label) {
1372    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
1373      return gtk_check_button_new_with_label(label);
1374    #else
1375      GtkWidget *cbut =
1376        hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
1377      gtk_button_set_label(GTK_BUTTON(cbut), label);
1378      return cbut;
1379    #endif
1380    }
1381    
1382    static void check_button_set_active(GtkWidget *button, gboolean active) {
1383    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
1384      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active);
1385    #else
1386      hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active);
1387    #endif
1388    }
1389    
1390    static gboolean check_button_get_active(GtkWidget *button) {
1391    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
1392      return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
1393    #else
1394      return hildon_check_button_get_active(HILDON_CHECK_BUTTON(button));
1395    #endif
1396    }
1397    
1398  static void callback_finds_toggled(GtkWidget *widget, gpointer data ) {  static void callback_finds_toggled(GtkWidget *widget, gpointer data ) {
1399    search_context_t *context = (search_context_t*)data;    search_context_t *context = (search_context_t*)data;
1400    
1401    gboolean in_finds = gtk_toggle_button_get_active(    gboolean in_finds = check_button_get_active(context->in_finds);
           GTK_TOGGLE_BUTTON(context->in_finds));  
1402    
1403    gtk_widget_set_sensitive(context->entry,    !in_finds);    gtk_widget_set_sensitive(context->entry,    !in_finds);
1404    gtk_widget_set_sensitive(context->in_id,    !in_finds);    gtk_widget_set_sensitive(context->in_id,    !in_finds);
# Line 1348  cb_menu_search(GtkWidget *window, gpoint Line 1428  cb_menu_search(GtkWidget *window, gpoint
1428    GtkWidget *table = gtk_table_new(2, 2, TRUE);    GtkWidget *table = gtk_table_new(2, 2, TRUE);
1429    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8);    gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8);
1430    
1431    context.in_id = gtk_check_button_new_with_label(_("Waypoint IDs"));    context.in_id = check_button_new_with_label(_("Waypoint IDs"));
1432    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_id),    check_button_set_active(context.in_id, appdata->search & SEARCH_ID);
                                appdata->search & SEARCH_ID);  
1433    gtk_table_attach_defaults(GTK_TABLE(table), context.in_id, 0, 1, 0, 1);    gtk_table_attach_defaults(GTK_TABLE(table), context.in_id, 0, 1, 0, 1);
1434    
1435    context.in_name = gtk_check_button_new_with_label(_("Names"));    context.in_name = check_button_new_with_label(_("Names"));
1436    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_name),    check_button_set_active(context.in_name, appdata->search & SEARCH_NAME);
                                appdata->search & SEARCH_NAME);  
1437    gtk_table_attach_defaults(GTK_TABLE(table), context.in_name, 1, 2, 0, 1);    gtk_table_attach_defaults(GTK_TABLE(table), context.in_name, 1, 2, 0, 1);
1438    
1439    context.in_desc = gtk_check_button_new_with_label(_("Descriptions"));    context.in_desc = check_button_new_with_label(_("Descriptions"));
1440    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_desc),    check_button_set_active(context.in_desc, appdata->search & SEARCH_DESC);
                                appdata->search & SEARCH_DESC);  
1441    gtk_table_attach_defaults(GTK_TABLE(table), context.in_desc, 0, 1, 1, 2);    gtk_table_attach_defaults(GTK_TABLE(table), context.in_desc, 0, 1, 1, 2);
1442    
1443    context.in_owner = gtk_check_button_new_with_label(_("Owner"));    context.in_owner = check_button_new_with_label(_("Owner"));
1444    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_owner),    check_button_set_active(context.in_owner, appdata->search & SEARCH_OWNER);
                                appdata->search & SEARCH_OWNER);  
1445    gtk_table_attach_defaults(GTK_TABLE(table), context.in_owner, 1, 2, 1, 2);    gtk_table_attach_defaults(GTK_TABLE(table), context.in_owner, 1, 2, 1, 2);
1446    
1447    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);    gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table);
# Line 1386  cb_menu_search(GtkWidget *window, gpoint Line 1462  cb_menu_search(GtkWidget *window, gpoint
1462    
1463    GtkWidget *hbox = gtk_hbox_new(FALSE, 5);    GtkWidget *hbox = gtk_hbox_new(FALSE, 5);
1464    
1465    context.in_finds = gtk_check_button_new_with_label(_("Search finds for"));    context.in_finds = check_button_new_with_label(_("Search finds for"));
1466    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_finds),    check_button_set_active(context.in_finds, appdata->search & SEARCH_FINDS);
                                appdata->search & SEARCH_FINDS);  
1467    gtk_box_pack_start_defaults(GTK_BOX(hbox), context.in_finds);    gtk_box_pack_start_defaults(GTK_BOX(hbox), context.in_finds);
1468    g_signal_connect(G_OBJECT(context.in_finds), "toggled",    g_signal_connect(G_OBJECT(context.in_finds), "toggled",
1469                     G_CALLBACK(callback_finds_toggled), &context);                     G_CALLBACK(callback_finds_toggled), &context);
# Line 1428  cb_menu_search(GtkWidget *window, gpoint Line 1503  cb_menu_search(GtkWidget *window, gpoint
1503                      HILDON_NUMBER_EDITOR(context.spinner));                      HILDON_NUMBER_EDITOR(context.spinner));
1504  #endif  #endif
1505    
1506      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_finds)))      if(check_button_get_active(context.in_finds))
1507        appdata->search |=  SEARCH_FINDS;        appdata->search |=  SEARCH_FINDS;
1508      else      else
1509        appdata->search &= ~SEARCH_FINDS;        appdata->search &= ~SEARCH_FINDS;
1510    
1511      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_id)))      if(check_button_get_active(context.in_id))
1512        appdata->search |=  SEARCH_ID;        appdata->search |=  SEARCH_ID;
1513      else      else
1514        appdata->search &= ~SEARCH_ID;        appdata->search &= ~SEARCH_ID;
1515    
1516      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_name)))      if(check_button_get_active(context.in_name))
1517        appdata->search |=  SEARCH_NAME;        appdata->search |=  SEARCH_NAME;
1518      else      else
1519        appdata->search &= ~SEARCH_NAME;        appdata->search &= ~SEARCH_NAME;
1520    
1521      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_desc)))      if(check_button_get_active(context.in_desc))
1522        appdata->search |=  SEARCH_DESC;        appdata->search |=  SEARCH_DESC;
1523      else      else
1524        appdata->search &= ~SEARCH_DESC;        appdata->search &= ~SEARCH_DESC;
1525    
1526      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_owner)))      if(check_button_get_active(context.in_owner))
1527        appdata->search |=  SEARCH_OWNER;        appdata->search |=  SEARCH_OWNER;
1528      else      else
1529        appdata->search &= ~SEARCH_OWNER;        appdata->search &= ~SEARCH_OWNER;
# Line 1853  void menu_create(appdata_t *appdata) { Line 1928  void menu_create(appdata_t *appdata) {
1928    
1929    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());    gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new());
1930    
 #ifndef NO_COPY_N_PASTE  
1931    /* ----------- copy'n paste submenu ----------------- */    /* ----------- copy'n paste submenu ----------------- */
1932    appdata->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);  #ifndef NO_COPY_N_PASTE
   gtk_clipboard_set_can_store(appdata->clipboard, NULL, 0);  
   
1933    item = gtk_menu_item_new_with_label(_("Edit"));    item = gtk_menu_item_new_with_label(_("Edit"));
1934    gtk_menu_append(GTK_MENU_SHELL(menu), item);    gtk_menu_append(GTK_MENU_SHELL(menu), item);
1935    submenu = gtk_menu_new();    submenu = gtk_menu_new();
# Line 2143  crumb_back(gpointer data) { Line 2215  crumb_back(gpointer data) {
2215    
2216    gtk_widget_show_all(crumb->appdata->vbox);    gtk_widget_show_all(crumb->appdata->vbox);
2217    g_free(data);    g_free(data);
2218    
2219    #ifdef ENABLE_OSM_GPS_MAP
2220      map_update(crumb->appdata);
2221    #endif
2222  }  }
2223    
2224  static void crumb_add(appdata_t *appdata, char *name, int level,  static void crumb_add(appdata_t *appdata, char *name, int level,
# Line 2189  static void crumb_add(appdata_t *appdata Line 2265  static void crumb_add(appdata_t *appdata
2265  #else  #else
2266    bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back);    bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back);
2267  #endif  #endif
2268    
2269    #ifdef ENABLE_OSM_GPS_MAP
2270      map_update(appdata);
2271    #endif
2272  }  }
2273  #endif // USE_BREAD_CRUMB_TRAIL  #endif // USE_BREAD_CRUMB_TRAIL
2274    
# Line 2200  void main_after_settings_redraw(appdata_ Line 2280  void main_after_settings_redraw(appdata_
2280      return;      return;
2281    }    }
2282    
 #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  
2283    /* a cache screen cannot be changed from the settings and thus doesn't */    /* a cache screen cannot be changed from the settings and thus doesn't */
2284    /* need to be redrawn */    /* need to be redrawn */
2285    if(appdata->cur_cache) {    if(appdata->cur_cache) {
# Line 2266  void main_after_settings_redraw(appdata_ Line 2334  void main_after_settings_redraw(appdata_
2334    
2335      gtk_widget_show_all(container);      gtk_widget_show_all(container);
2336    }    }
 #endif // USE_MAEMO  
2337  }  }
2338    
2339  int main(int argc, char *argv[]) {  int main(int argc, char *argv[]) {
# Line 2287  int main(int argc, char *argv[]) { Line 2354  int main(int argc, char *argv[]) {
2354    
2355    gtk_init (&argc, &argv);    gtk_init (&argc, &argv);
2356    
2357      curl_global_init(CURL_GLOBAL_ALL);
2358    
2359  #ifdef USE_MAEMO  #ifdef USE_MAEMO
2360    printf("Installing osso context for \"org.harbaum." APP "\"\n");    printf("Installing osso context for \"org.harbaum." APP "\"\n");
2361    appdata.osso_context = osso_initialize("org.harbaum."APP,    appdata.osso_context = osso_initialize("org.harbaum."APP,
# Line 2322  int main(int argc, char *argv[]) { Line 2391  int main(int argc, char *argv[]) {
2391    /* Create a Window. */    /* Create a Window. */
2392    appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);    appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2393    /* Set a decent default size for the window. */    /* Set a decent default size for the window. */
2394    gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300);    gtk_window_set_default_size(GTK_WINDOW(appdata.window), 640, 480);
2395  #endif  #endif
2396    
2397  #if MAEMO_VERSION_MAJOR == 5  #if MAEMO_VERSION_MAJOR == 5
# Line 2335  int main(int argc, char *argv[]) { Line 2404  int main(int argc, char *argv[]) {
2404    g_signal_connect(G_OBJECT(appdata.window), "key_press_event",    g_signal_connect(G_OBJECT(appdata.window), "key_press_event",
2405                     G_CALLBACK(on_window_key_press), &appdata);                     G_CALLBACK(on_window_key_press), &appdata);
2406    
2407      /* prepare clipboard */
2408      appdata.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
2409      gtk_clipboard_set_can_store(appdata.clipboard, NULL, 0);
2410    
2411    appdata.vbox = gtk_vbox_new(FALSE, 2);    appdata.vbox = gtk_vbox_new(FALSE, 2);
2412    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);    gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox);
2413  #ifndef USE_STACKABLE_WINDOW  #ifndef USE_STACKABLE_WINDOW

Legend:
Removed from v.128  
changed lines
  Added in v.189