static int list_callback (SsdWidget widget, const char *new_value, const void *value, void *context) {

   RoadMapAddressSearch *search = (RoadMapAddressSearch *)context;

   if ((strlen(new_value) > 3) &&
       !strcmp(new_value + strlen(new_value) - 3, " - ")) {

       char str[255];

       ssd_generic_list_dialog_hide ();

       strcpy(str, new_value);
       str[strlen(str) - 2] = '\0';

       ssd_dialog_set_value ("input", str);

       str[strlen(str) - 1] = '\0';
       search->prefix = strdup(str);

       return 1;
   }

   search->callback (new_value, search->data);
   free (search);

   ssd_generic_list_dialog_hide ();

   return 1;
}
static void delete_callback(int exit_code, void *context){
		/* We got a full address */

    if (exit_code != dec_yes)
         return;

   	roadmap_history_delete_entry (context );
    	roadmap_history_save ();
   	ssd_generic_list_dialog_hide ();
   	roadmap_address_history();
}
static int history_callback (SsdWidget widget, const char *new_value, const void *value,
										    void *data) {
   RoadMapAddressDialog *context = (RoadMapAddressDialog *)data;

   if (!new_value[0] || !strcmp(new_value, roadmap_lang_get ("Other city"))) {
      roadmap_address_search_dialog
         (NULL, roadmap_address_city_result, data);

   } else if (!strchr(new_value, ',')) {
      /* We only got a city */
      if (context->city_name) free(context->city_name);

      context->city_name = strdup (new_value);
      roadmap_address_search_dialog
         (context->city_name, roadmap_address_street_result, data);
   } else {
      /* We got a full address */
      char *argv[4];

      roadmap_history_get ('A', (void *) ssd_dialog_get_data ("list"), argv);

      context->navigate = 1;
      if (context->city_name) free(context->city_name);
      if (context->street_name) free(context->street_name);
      context->city_name = strdup (argv[2]);
      context->street_name = strdup (argv[1]);


      if (roadmap_address_show (context->city_name, context->street_name,
                                argv[0], context)) {
         ssd_generic_list_dialog_hide ();
      }
      context->navigate = 0;

      return 1;
   }

   ssd_generic_list_dialog_hide ();

   return 1;
}
Beispiel #4
0
static int roadmap_car_call_back (SsdWidget widget, const char *new_value, const void *value, void *context) {

   roadmap_car_list_dialog *list_context = (roadmap_car_list_dialog *)context;
   RoadMapConfigDescriptor CarCfg =
                  ROADMAP_CONFIG_ITEM("Trip", "Car");
           
   roadmap_config_declare
        ("user", &CarCfg, "car_blue", NULL);
   roadmap_config_set (&CarCfg, value);              
   ssd_generic_list_dialog_hide ();

   if (list_context->callback)
   		(*list_context->callback)();

   return 1;
}