Diff of /trunk/src/misc.c

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

revision 216 by harbaum, Thu Nov 26 14:32:41 2009 UTC revision 218 by harbaum, Fri Nov 27 08:58:48 2009 UTC
# Line 33  Line 33 
33  #include <hildon/hildon-picker-dialog.h>  #include <hildon/hildon-picker-dialog.h>
34  #endif  #endif
35    
36    #ifdef FREMANTLE
37    #define PICKER_DIALOG
38    #endif
39    
40  char strlastchr(char *str) {  char strlastchr(char *str) {
41    return str[strlen(str)]-1;    return str[strlen(str)]-1;
42  }  }
# Line 535  GtkWidget *left_label_new(char *str) { Line 539  GtkWidget *left_label_new(char *str) {
539    return widget;    return widget;
540  }  }
541    
542  static void pos_set(GtkMenuItem *item, float lat, float lon) {  static void pos_set(GtkWidget *item, float lat, float lon) {
543    char str[32];    char str[32];
544    
545    pos_lat_str(str, sizeof(str)-1, lat);    pos_lat_str(str, sizeof(str)-1, lat);
# Line 547  static void pos_set(GtkMenuItem *item, f Line 551  static void pos_set(GtkMenuItem *item, f
551    gtk_entry_set_text(GTK_ENTRY(lon_entry), str);    gtk_entry_set_text(GTK_ENTRY(lon_entry), str);
552  }  }
553    
554  static void cb_gps(GtkMenuItem *item, gpointer data) {  static void cb_gps(GtkWidget *item, gpointer data) {
555    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
556      gint id = (gint)g_object_get_data(G_OBJECT(item), "id");
557      pos_t *pos = NULL;
558    
559    pos_t *refpos = get_pos(appdata);    if(!id)
560    if(!refpos) pos_set(item, NAN, NAN);      pos = gps_get_pos(appdata);
561    else        pos_set(item, refpos->lat, refpos->lon);    else if(id == 1)
562        pos = &appdata->home;
563      else {
564        location_t *location = appdata->location;
565        while(location && id > 2) {
566          location = location->next;
567          id--;
568        }
569    
570        if(id == 2)
571          pos = &location->pos;
572      }
573    
574      if(!pos) pos_set(item, NAN, NAN);
575      else     pos_set(item, pos->lat, pos->lon);
576  }  }
577    
578  static void cb_geomath(GtkMenuItem *item, gpointer data) {  static void cb_geomath(GtkWidget *item, gpointer data) {
579    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
580    
581    pos_set(item, appdata->geomath.lat, appdata->geomath.lon);    pos_set(item, appdata->geomath.lat, appdata->geomath.lon);
582  }  }
583    
584  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
585  static void cb_map(GtkMenuItem *item, gpointer data) {  static void cb_map(GtkWidget *item, gpointer data) {
586    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
587    
588    pos_set(item, appdata->map.pos.lat, appdata->map.pos.lon);    pos_set(item, appdata->map.pos.lat, appdata->map.pos.lon);
589  }  }
590  #endif  #endif
591    
592  static const gchar *menu_item_get_label(GtkMenuItem *menu_item) {  static void cb_cache(GtkWidget *item, gpointer data) {
   GList *children, *l;  
   GtkWidget *child;  
   children = gtk_container_get_children (GTK_CONTAINER (menu_item));  
   for (l = g_list_first (children); l != NULL;  
        l = g_list_next (l)) {  
     child = (GtkWidget *)l->data;  
     if (GTK_IS_LABEL (child)) {  
       return gtk_label_get_label (GTK_LABEL (child));  
     }  
   }  
   return NULL;  
 }  
   
 static void cb_cache(GtkMenuItem *item, gpointer data) {  
   const char *label = menu_item_get_label(item);  
593    appdata_t *appdata = (appdata_t*)data;    appdata_t *appdata = (appdata_t*)data;
594    
595    cache_t *cache = appdata->cur_cache;    cache_t *cache = appdata->cur_cache;
596    g_assert(cache);    g_assert(cache);
597    
598    if(!strcmp(label, cache->id))    gint id = (gint)g_object_get_data(G_OBJECT(item), "id");
599    
600      if(!id)
601      pos_set(item, cache->pos.lat, cache->pos.lon);      pos_set(item, cache->pos.lat, cache->pos.lon);
602    else {    else {
603      wpt_t *wpt = cache->wpt;      wpt_t *wpt = cache->wpt;
604      while(wpt) {      while(wpt && id > 1) {
       if(!strcmp(label, wpt->id)) {  
         pos_set(item, wpt->pos.lat, wpt->pos.lon);  
         return;  
       }  
   
605        wpt = wpt->next;        wpt = wpt->next;
606          id--;
607      }      }
608    
609        if(id == 1)
610          pos_set(item, wpt->pos.lat, wpt->pos.lon);
611    }    }
612  }  }
613    
614    #ifndef PICKER_DIALOG
615  static GtkWidget *menu_add(GtkWidget *menu, appdata_t *appdata,  static GtkWidget *menu_add(GtkWidget *menu, appdata_t *appdata,
616                             GtkWidget *icon, char *menu_str,                             GtkWidget *icon, char *menu_str,
617                             void(*func)(GtkMenuItem*, gpointer),                             void(*func)(GtkWidget*, gpointer), gint id,
618                             GtkWidget *lon_entry, GtkWidget *lat_entry) {                             GtkWidget *lon_entry, GtkWidget *lat_entry) {
619    
620    GtkWidget *item = gtk_image_menu_item_new_with_label(menu_str);    GtkWidget *item = gtk_image_menu_item_new_with_label(menu_str);
# Line 617  static GtkWidget *menu_add(GtkWidget *me Line 624  static GtkWidget *menu_add(GtkWidget *me
624    
625    g_object_set_data(G_OBJECT(item), "lat_entry", (gpointer)lat_entry);    g_object_set_data(G_OBJECT(item), "lat_entry", (gpointer)lat_entry);
626    g_object_set_data(G_OBJECT(item), "lon_entry", (gpointer)lon_entry);    g_object_set_data(G_OBJECT(item), "lon_entry", (gpointer)lon_entry);
627      g_object_set_data(G_OBJECT(item), "id", (gpointer)id);
628    
629    if(func)    if(func)
630      gtk_signal_connect(GTK_OBJECT(item), "activate",      gtk_signal_connect(GTK_OBJECT(item), "activate",
# Line 632  static GtkWidget *popup_menu_create(appd Line 640  static GtkWidget *popup_menu_create(appd
640    GtkWidget *menu = gtk_menu_new();    GtkWidget *menu = gtk_menu_new();
641    
642    menu_add(menu, appdata, icon_get_widget(ICON_POS, 18),    menu_add(menu, appdata, icon_get_widget(ICON_POS, 18),
643             _("Current position (GPS)"), cb_gps, lon_entry, lat_entry);             _("GPS position"), cb_gps, 0, lon_entry, lat_entry);
644    
645      menu_add(menu, appdata, icon_get_widget(ICON_POS, 21),
646               _("Home"), cb_gps, 1, lon_entry, lat_entry);
647    
648      location_t *location = appdata->location;
649      gint id = 2;
650      while(location) {
651        menu_add(menu, appdata, icon_get_widget(ICON_POS, 21),
652                   location->name, cb_gps, id++, lon_entry, lat_entry);
653    
654        location = location->next;
655      }
656    
657    menu_add(menu, appdata, icon_get_widget(ICON_POS, 19),    menu_add(menu, appdata, icon_get_widget(ICON_POS, 19),
658             _("Geomath projection"), cb_geomath, lon_entry, lat_entry);             _("Geomath projection"), cb_geomath, 0, lon_entry, lat_entry);
659  #ifdef ENABLE_OSM_GPS_MAP  #ifdef ENABLE_OSM_GPS_MAP
660    menu_add(menu, appdata, icon_get_widget(ICON_POS, 20),    menu_add(menu, appdata, icon_get_widget(ICON_POS, 20),
661             _("Map position"), cb_map, lon_entry, lat_entry);             _("Map position"), cb_map, 0, lon_entry, lat_entry);
662  #endif  #endif
663    
   printf("popup cache present: %s\n", appdata->cur_cache?"Yes":"No");  
   
664    if(appdata->cur_cache) {    if(appdata->cur_cache) {
665      cache_t *cache = appdata->cur_cache;      cache_t *cache = appdata->cur_cache;
666    
667        char *name = cache->name;
668        if(!name) name = cache->id;
669    
670      if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {      if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {
671        menu_add(menu, appdata, icon_get_widget(ICON_POS, cache->type + 6),        menu_add(menu, appdata, icon_get_widget(ICON_POS, cache->type + 6),
672                 cache->id, cb_cache, lon_entry, lat_entry);                 name, cb_cache, 0, lon_entry, lat_entry);
673      }      }
674    
     printf("appending cache waypoints\n");  
675      wpt_t *wpt = cache->wpt;      wpt_t *wpt = cache->wpt;
676        gint id = 1;
677      while(wpt) {      while(wpt) {
678        GtkWidget *icon = NULL;        GtkWidget *icon = NULL;
679        if(wpt->sym != WPT_SYM_UNKNOWN)        if(wpt->sym != WPT_SYM_UNKNOWN)
680          icon = icon_get_widget(ICON_POS, wpt->sym);          icon = icon_get_widget(ICON_POS, wpt->sym);
681    
682        menu_add(menu, appdata, icon, wpt->id, cb_cache,        char *name = wpt->desc;
683          if(!name) name = wpt->cmt;
684          if(!name) name = wpt->id;
685    
686          menu_add(menu, appdata, icon, name, cb_cache, id++,
687                 lon_entry, lat_entry);                 lon_entry, lat_entry);
688    
689        wpt = wpt->next;        wpt = wpt->next;
# Line 687  static void on_popup_destroy(GtkWidget * Line 713  static void on_popup_destroy(GtkWidget *
713    GtkWidget *menu = g_object_get_data(G_OBJECT(widget), "menu");    GtkWidget *menu = g_object_get_data(G_OBJECT(widget), "menu");
714    gtk_widget_destroy(menu);    gtk_widget_destroy(menu);
715  }  }
   
 GtkWidget *coo_popup(appdata_t *appdata,  
                      GtkWidget *lat_entry, GtkWidget *lon_entry) {  
   
   GtkWidget *button = gtk_button_new();  
 #ifdef FREMANTLE  
   hildon_gtk_widget_set_theme_size(button,  
           (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));  
716  #endif  #endif
717    
718    gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_POS, 17));  #ifdef PICKER_DIALOG
   
   gtk_widget_set_tooltip_text(button, _("Preset coordinates"));  
719    
720    gtk_signal_connect(GTK_OBJECT(button), "button-press-event",  enum {
721                       (GtkSignalFunc)on_popup_button_press, appdata);    PICKER_COL_ICON = 0,
722      PICKER_COL_NAME,
723      PICKER_COL_ID,
724      PICKER_COL_CB,
725      PICKER_NUM_COLS
726    };
727    
728    static void picker_add(GtkListStore *store,  appdata_t *appdata,
729                           GdkPixbuf *icon, char *menu_str,
730                           void(*func)(GtkWidget*, gpointer), gint id) {
731      GtkTreeIter     iter;
732    
733      /* Append a row and fill in some data */
734      gtk_list_store_append (store, &iter);
735    
736      gtk_list_store_set(store, &iter,
737                         PICKER_COL_ICON, icon,
738                         PICKER_COL_NAME, menu_str,
739                         PICKER_COL_ID, id,
740                         PICKER_COL_CB, func,
741                         -1);
742    }
743    
744    static void on_picker_activated(GtkTreeView        *treeview,
745                                    GtkTreePath        *path,
746                                    GtkTreeViewColumn  *col,
747                                    gpointer            userdata) {
748      GtkTreeIter   iter;
749      GtkTreeModel *model = gtk_tree_view_get_model(treeview);
750    
751      if(gtk_tree_model_get_iter(model, &iter, path)) {
752        gint id;
753        void(*func)(GtkWidget*, gpointer);
754        gtk_tree_model_get(model, &iter,
755                           PICKER_COL_ID, &id,
756                           PICKER_COL_CB, &func,
757                           -1);
758    
759        /* set id on widget as callbacks expect it this way */
760        g_object_set_data(G_OBJECT(treeview), "id", (gpointer)id);
761        func(GTK_WIDGET(treeview), userdata);
762    
763        /* xyz */
764        gtk_dialog_response(GTK_DIALOG(gtk_widget_get_toplevel(
765                        GTK_WIDGET(treeview))), GTK_RESPONSE_ACCEPT);
766    
767    gtk_signal_connect(GTK_OBJECT(button), "destroy",    }
                      (GtkSignalFunc)on_popup_destroy, appdata);  
   
   g_object_set_data(G_OBJECT(button), "menu",  
                     popup_menu_create(appdata, lat_entry, lon_entry));  
   
   return button;  
 }  
   
 GtkWidget *entry_new(void) {  
 #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)  
   return gtk_entry_new();  
 #else  
   return hildon_entry_new(HILDON_SIZE_AUTO);  
 #endif  
768  }  }
769    
770  gboolean pos_differ(pos_t *pos1, pos_t *pos2) {  static GtkWidget *picker_create(appdata_t *appdata,
771    int lat1 = (60000 * pos1->lat)+0.5, lon1 = (60000 * pos1->lon)+0.5;                                  GtkWidget *lat_entry, GtkWidget *lon_entry) {
772    int lat2 = (60000 * pos2->lat)+0.5, lon2 = (60000 * pos2->lon)+0.5;    GtkCellRenderer *renderer;
773      GtkListStore    *store;
   return((lat1 != lat2) || (lon1 != lon2));  
 }  
774    
775  #ifdef FREMANTLE    GtkWidget *view = gtk_tree_view_new();
 void selection_changed (HildonTouchSelector * selector,  
                    gpointer *user_data) {  
   gchar *current_selection = NULL;  
776    
777    current_selection = hildon_touch_selector_get_current_text (selector);    g_object_set_data(G_OBJECT(view), "lat_entry", (gpointer)lat_entry);
778    g_debug ("Current selection : %s", current_selection);    g_object_set_data(G_OBJECT(view), "lon_entry", (gpointer)lon_entry);
 }  
779    
780  static GtkWidget *create_customized_selector() {    /* --- "Icon" column --- */
781    GtkWidget *selector = NULL;    renderer = gtk_cell_renderer_pixbuf_new();
782    GSList *icon_list = NULL;    gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
783    GtkListStore *store_icons = NULL;        -1, "Icon", renderer, "pixbuf", PICKER_COL_ICON, NULL);
784    GSList *item = NULL;  
785    GtkCellRenderer *renderer = NULL;    /* --- "Name" column --- */
786    HildonTouchSelectorColumn *column = NULL;    renderer = gtk_cell_renderer_text_new();
787      g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL );
788      GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
789                     "Name", renderer, "text", PICKER_COL_NAME, NULL);
790      gtk_tree_view_column_set_expand(column, TRUE);
791      gtk_tree_view_insert_column(GTK_TREE_VIEW(view), column, -1);
792    
793      store = gtk_list_store_new(PICKER_NUM_COLS,
794                                 GDK_TYPE_PIXBUF,
795                                 G_TYPE_STRING,
796                                 G_TYPE_INT,
797                                 G_TYPE_POINTER);
798    
799      picker_add(store, appdata, icon_get(ICON_POS, 18),
800                 _("GPS position"), cb_gps, 0);
801    
802      picker_add(store, appdata, icon_get(ICON_POS, 21),
803                 _("Home"), cb_gps, 1);
804    
805      location_t *location = appdata->location;
806      gint id = 2;
807      while(location) {
808        picker_add(store, appdata, icon_get(ICON_POS, 21),
809                   location->name, cb_gps, id++);
810    
811    selector = hildon_touch_selector_new ();      location = location->next;
812      }
813    
814    icon_list = gtk_stock_list_ids ();    picker_add(store, appdata, icon_get(ICON_POS, 19),
815                 _("Geomath projection"), cb_geomath, 0);
816    #ifdef ENABLE_OSM_GPS_MAP
817      picker_add(store, appdata, icon_get(ICON_POS, 20),
818                 _("Map position"), cb_map, 0);
819    #endif
820    
821    store_icons = gtk_list_store_new (1, G_TYPE_STRING);    if(appdata->cur_cache) {
822    for (item = icon_list; item; item = g_slist_next (item)) {      cache_t *cache = appdata->cur_cache;
     GtkTreeIter iter;  
     gchar *label = item->data;  
823    
824      gtk_list_store_append (store_icons, &iter);      char *name = cache->name;
825      gtk_list_store_set (store_icons, &iter, 0, label, -1);      if(!name) name = cache->id;
     g_free (label);  
   }  
   g_slist_free (icon_list);  
826    
827    renderer = gtk_cell_renderer_pixbuf_new ();      if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {
828    gtk_cell_renderer_set_fixed_size (renderer, -1, 100);        picker_add(store, appdata, icon_get(ICON_POS, cache->type + 6),
829                     name, cb_cache, 0);
830        }
831    
832    column = hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector),      wpt_t *wpt = cache->wpt;
833                                                  GTK_TREE_MODEL (store_icons),      gint id = 1;
834                                                  renderer, "stock-id", 0, NULL);      while(wpt) {
835          GdkPixbuf *icon = NULL;
836          if(wpt->sym != WPT_SYM_UNKNOWN)
837            icon = icon_get(ICON_POS, wpt->sym);
838    
839    g_object_set (G_OBJECT (column), "text-column", 0, NULL);        char *name = wpt->desc;
840          if(!name) name = wpt->cmt;
841          if(!name) name = wpt->id;
842    
843    hildon_touch_selector_set_column_selection_mode (HILDON_TOUCH_SELECTOR (selector),        picker_add(store, appdata, icon, name, cb_cache, id++);
844                                                     HILDON_TOUCH_SELECTOR_SELECTION_MODE_SINGLE);        wpt = wpt->next;
845        }
846      }
847    
848    
849    g_signal_connect (G_OBJECT (selector), "changed",    gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
850                      G_CALLBACK (selection_changed), NULL);    g_object_unref(store);
851    
852    return selector;    /* make list react on clicks */
853      g_signal_connect(view, "row-activated",
854                       (GCallback)on_picker_activated, appdata);
855    
856    #if 0
857      g_signal_connect(view, "destroy",
858                       (GCallback)cachelist_destroy, ce);
859    #endif
860    
861      /* put this inside a scrolled view */
862    #ifndef USE_PANNABLE_AREA
863      GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
864      gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
865                                     GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
866      gtk_container_add(GTK_CONTAINER(scrolled_window), view);
867      return scrolled_window;
868    #else
869      GtkWidget *pannable_area = hildon_pannable_area_new();
870      gtk_container_add(GTK_CONTAINER(pannable_area), view);
871      return pannable_area;
872    #endif
873  }  }
874    
875  static gint on_picker_request(GtkWidget *button, GdkEventButton *event,  static gint on_picker_button_press(GtkWidget *button,
876                                gpointer data) {                     GdkEventButton *event, gpointer data) {
877      appdata_t *appdata = (appdata_t*)data;
878    
879      gpointer lat_entry = g_object_get_data(G_OBJECT(button), "lat_entry");
880      gpointer lon_entry = g_object_get_data(G_OBJECT(button), "lon_entry");
881    
882    if(event->type == GDK_BUTTON_PRESS) {    if(event->type == GDK_BUTTON_PRESS) {
883      GtkWidget *dialog = hildon_picker_dialog_new(NULL);      GtkWidget *dialog =
884      GtkWidget *selector = create_customized_selector();        gtk_dialog_new_with_buttons(_("Preset coordinates"),
885      hildon_picker_dialog_set_selector(HILDON_PICKER_DIALOG(dialog),            GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(button))),
886                        HILDON_TOUCH_SELECTOR(selector));                                    GTK_DIALOG_MODAL,
887              GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
888              NULL);
889    
890        gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 200);
891    
892      hildon_touch_selector_set_active(HILDON_TOUCH_SELECTOR (selector), 1, -1);      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),
893                                    picker_create(appdata, lat_entry, lon_entry));
894    
895      gtk_widget_show_all(dialog);      gtk_widget_show_all(dialog);
896      gtk_dialog_run(GTK_DIALOG(dialog));      gtk_dialog_run(GTK_DIALOG(dialog));
# Line 798  static gint on_picker_request(GtkWidget Line 900  static gint on_picker_request(GtkWidget
900    }    }
901    return FALSE;    return FALSE;
902  }  }
903    #endif
904    
905  GtkWidget *picker_button_new(void) {  GtkWidget *coo_popup(appdata_t *appdata,
906    GtkWidget *button;                       GtkWidget *lat_entry, GtkWidget *lon_entry) {
907    
908  #if 1    GtkWidget *button = gtk_button_new();
   button = gtk_button_new();  
   hildon_gtk_widget_set_theme_size(button,  
           (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));  
909    
910    gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_POS, 17));    gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_POS, 17));
911    
912      gtk_widget_set_tooltip_text(button, _("Preset coordinates"));
913    
914    #ifndef PICKER_DIALOG
915    gtk_signal_connect(GTK_OBJECT(button), "button-press-event",    gtk_signal_connect(GTK_OBJECT(button), "button-press-event",
916                       (GtkSignalFunc)on_picker_request, NULL);                       (GtkSignalFunc)on_popup_button_press, appdata);
917    
918  #else    gtk_signal_connect(GTK_OBJECT(button), "destroy",
919    button = hildon_picker_button_new(HILDON_SIZE_AUTO,                       (GtkSignalFunc)on_popup_destroy, appdata);
                                     HILDON_BUTTON_ARRANGEMENT_VERTICAL);  
920    
921    hildon_button_set_title(HILDON_BUTTON(button), "Test");    g_object_set_data(G_OBJECT(button), "menu",
922    hildon_picker_button_set_selector(HILDON_PICKER_BUTTON(button),                      popup_menu_create(appdata, lat_entry, lon_entry));
923                      HILDON_TOUCH_SELECTOR(create_customized_selector()));  #else
924    #ifdef FREMANTLE
925      hildon_gtk_widget_set_theme_size(button,
926            (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
927  #endif  #endif
928    
929      g_object_set_data(G_OBJECT(button), "lat_entry", (gpointer)lat_entry);
930      g_object_set_data(G_OBJECT(button), "lon_entry", (gpointer)lon_entry);
931    
932      gtk_signal_connect(GTK_OBJECT(button), "button-press-event",
933                         (GtkSignalFunc)on_picker_button_press, appdata);
934    #endif
935    
936    return button;    return button;
937  }  }
938    
939    GtkWidget *entry_new(void) {
940    #if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5)
941      return gtk_entry_new();
942    #else
943      return hildon_entry_new(HILDON_SIZE_AUTO);
944  #endif  #endif
945    }
946    
947    gboolean pos_differ(pos_t *pos1, pos_t *pos2) {
948      int lat1 = (60000 * pos1->lat)+0.5, lon1 = (60000 * pos1->lon)+0.5;
949      int lat2 = (60000 * pos2->lat)+0.5, lon2 = (60000 * pos2->lon)+0.5;
950    
951      return((lat1 != lat2) || (lon1 != lon2));
952    }
953    

Legend:
Removed from v.216  
changed lines
  Added in v.218