64 GtkTreeSelection *selection;
65 GtkCellRenderer *renderer;
66 GtkTreeViewColumn *column;
87 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
88 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store),
89 0, GTK_SORT_ASCENDING);
91 find_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
92 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
find_view));
93 g_object_unref(store);
94 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(
find_view));
95 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(
find_view),
FALSE);
97 renderer = gtk_cell_renderer_text_new();
98 column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
100 gtk_tree_view_column_set_sort_order(column, GTK_SORT_ASCENDING);
101 gtk_tree_view_append_column(GTK_TREE_VIEW(
find_view), column);
103 sw = gtk_scrolled_window_new(NULL, NULL);
104 g_object_set(sw,
"margin", 2, NULL);
105 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
106 GTK_SHADOW_ETCHED_IN);
107 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
108 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
109 gtk_container_add(GTK_CONTAINER(sw),
find_view);
114 label = g_object_new(GTK_TYPE_LABEL,
115 "use-underline",
TRUE,
117 "label",
_(
"Ci_ties:"),
118 "xalign", 0.0,
"yalign", 0.5, NULL);
122 g_signal_connect(selection,
"changed",
141 gtk_list_store_clear(store);
145 GValue value = { 0, };
147 gtk_list_store_append(store, &it);
149 g_value_init(&value, G_TYPE_STRING);
151 gtk_list_store_set_value(store, &it, 0, &value);
152 g_value_unset(&value);
154 gtk_list_store_set(store, &it, 1, pcity, -1);
164 if (response == GTK_RESPONSE_ACCEPT) {
165 GtkTreeSelection *selection;
169 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(
find_view));
171 if (gtk_tree_selection_get_selected(selection, &model, &it)) {
174 gtk_tree_model_get(model, &it, 1, &pcity, -1);
203 if (!gtk_tree_selection_get_selected(selection, NULL, &it)) {
207 gtk_tree_model_get(model, &it, 1, &pcity, -1);
const char * city_name_get(const struct city *pcity)
#define city_list_iterate(citylist, pcity)
#define city_list_iterate_end
static struct gui_dialog * find_dialog_shell
static void find_response(struct gui_dialog *dlg, int response, gpointer data)
static GtkWidget * find_view
void popup_find_dialog(void)
static void update_find_dialog(GtkListStore *store)
static void find_destroy_callback(GtkWidget *w, gpointer data)
static void find_selection_callback(GtkTreeSelection *selection, GtkTreeModel *model)
GtkWidget * bottom_notebook
void gtk_tree_view_focus(GtkTreeView *view)
void gui_dialog_destroy(struct gui_dialog *dlg)
void gui_dialog_set_default_response(struct gui_dialog *dlg, int response)
void gui_dialog_raise(struct gui_dialog *dlg)
void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, gpointer user_data, bool check_top)
void gui_dialog_response_set_callback(struct gui_dialog *dlg, GUI_DIALOG_RESPONSE_FUN fun)
GtkWidget * gui_dialog_add_button(struct gui_dialog *dlg, const char *text, int response)
void gui_dialog_show_all(struct gui_dialog *dlg)
void gui_dialog_set_title(struct gui_dialog *dlg, const char *title)
void gui_dialog_set_default_size(struct gui_dialog *dlg, int width, int height)
struct tile * get_center_tile_mapcanvas(void)
void center_tile_mapcanvas(const struct tile *ptile)
#define players_iterate_end
#define players_iterate(_pplayer)