]> err.no Git - mapper/commitdiff
Add "Info" button to search dialog, for POI information only for now.
authorKaj-Michael Lang <milang@tal.org>
Mon, 7 Apr 2008 13:16:31 +0000 (16:16 +0300)
committerKaj-Michael Lang <milang@tal.org>
Mon, 7 Apr 2008 13:16:31 +0000 (16:16 +0300)
src/poi-gui.c
src/poi-gui.h
src/search.c

index 55fa51a4da8b38dac72d2106b4f75210a03eb6e5..c84b28e66912e85e2d0bf8c0406ce0d94bd6168a 100644 (file)
@@ -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);
 
index 2dc7b9d473250ea077f884531ec02ea68aaf6008..d87ae899e2220899e63e175943b8c570502cb163 100644 (file)
@@ -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();
index 820ec8889021bd2c38499ed200eaf9573930c2fb..dae5639129d4dad76bf9f1b75b9dd131bfbd470c 100644 (file)
 #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;