From: Kaj-Michael Lang Date: Mon, 7 Apr 2008 13:16:31 +0000 (+0300) Subject: Add "Info" button to search dialog, for POI information only for now. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2588cc8150ccc4fd6bb0d0333d6eb9d1dd3edb8e;p=mapper Add "Info" button to search dialog, for POI information only for now. --- diff --git a/src/poi-gui.c b/src/poi-gui.c index 55fa51a..c84b28e 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -125,11 +125,17 @@ GtkCellRenderer *renderer; /* Category ID, Label */ cmb=gtk_combo_box_new_with_model(GTK_TREE_MODEL(gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING))); -/* Set up the view for the combo box. */ -renderer = gtk_cell_renderer_text_new(); +/* Set up the text view for the combo box. */ +renderer=gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(cmb), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(cmb), renderer, "text", 1, NULL); +#if 0 +renderer=gtk_cell_renderer_pixbuf_new(); +column=gtk_tree_view_column_new_with_attributes(_("Icon"), renderer, "pixbuf", CAT_ICON, NULL); +gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column); +#endif + return cmb; } @@ -737,7 +743,7 @@ g_printf("Title: %s\n", title); * */ gboolean -poi_info_dialog(guint poi_id) +poi_info_dialog(GtkWidget *window, guint poi_id) { GtkWidget *dialog; GtkWidget *info; @@ -753,7 +759,7 @@ if (!p) { } dialog=gtk_dialog_new_with_buttons(_("POI"), - GTK_WINDOW(_window), GTK_DIALOG_MODAL, + GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); diff --git a/src/poi-gui.h b/src/poi-gui.h index 2dc7b9d..d87ae89 100644 --- a/src/poi-gui.h +++ b/src/poi-gui.h @@ -51,7 +51,7 @@ gboolean poi_search_dialog(GtkListStore *store, poi_info *poi, gdouble lat, gdou GtkWidget *poi_quick_button_box(poi_quick_data *qpdata); gboolean poi_quick_dialog(gdouble lat, gdouble lon); -gboolean poi_info_dialog(guint poi_id); +gboolean poi_info_dialog(GtkWidget *window, guint poi_id); gboolean poi_category_dialog(guint cat_id); gboolean poi_category_list(); diff --git a/src/search.c b/src/search.c index 820ec88..dae5639 100644 --- a/src/search.c +++ b/src/search.c @@ -53,6 +53,13 @@ #include "search.h" #include "dialogs.h" +typedef enum { + SBTN_INFO=1, + SBTN_GOTO=2, + SBTN_ROUTETO=3, + SBTN_EDIT=4, +} search_action_e; + typedef struct _search_dialog search_dialog; struct _search_dialog { GtkWidget *dialog; @@ -243,9 +250,10 @@ sd.stype=stype; sd.dialog = gtk_dialog_new_with_buttons(_("Search"), GTK_WINDOW(_window), GTK_DIALOG_MODAL, - _("Goto"), 1, - _("Route to"), 2, - _("Edit"), 3, + _("Info"), SBTN_INFO, + _("Goto"), SBTN_GOTO, + _("Route to"), SBTN_ROUTETO, + _("Edit"), SBTN_EDIT, GTK_STOCK_CLOSE, GTK_RESPONSE_REJECT, NULL); @@ -327,25 +335,43 @@ while ((res=gtk_dialog_run(GTK_DIALOG(sd.dialog)))!=GTK_RESPONSE_REJECT) { gdouble lat, lon; switch (res) { - case 1: + case SBTN_INFO: + switch (sd.stype) { + case SEARCH_TYPE_POI: + poi_info_dialog(sd.dialog, search_get_list_item_id(sd.list)); + break; + default: + popup_error(sd.dialog, _("No information available.")); + break; + } + break; + case SBTN_GOTO: if (search_get_list_item_latlon(sd.list, &lat, &lon)==FALSE) { +#ifdef WITH_HILDON + hildon_banner_show_information(sd.dialog, NULL, _("Select a location from the list.")); +#else popup_error(sd.dialog, _("Select a location from the list.")); +#endif } else { map_center_latlon(lat, lon); g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_update_location_from_center, NULL, NULL); } continue; break; - case 2: + case SBTN_ROUTETO: if (search_get_list_item_latlon(sd.list, &_dest.lat, &_dest.lon)==FALSE) { +#ifdef WITH_HILDON + hildon_banner_show_information(sd.dialog, NULL, _("Select a location from the list.")); +#else popup_error(sd.dialog, _("Select a location from the list.")); +#endif } else { _dest.valid=TRUE; g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_update_location_from_center, NULL, NULL); } continue; break; - case 3: + case SBTN_EDIT: switch (sd.stype) { case SEARCH_TYPE_POI: { poi_info *p=NULL;