2 "$Id: metaserver.c 9201 2008-06-01 17:32:45Z anmaster $";
36 #include <glade/glade.h>
67 GtkTreeSelection *selection,
70 gboolean path_currently_selected,
87 const gchar *metaserver_txt;
92 GtkTreeViewColumn *column;
93 GtkCellRenderer *renderer;
102 "treeview_metaserver");
104 glade_xml_get_widget(xml_tree,
"metaserver_select");
106 glade_xml_get_widget(xml_tree,
"metaserver_status");
108 glade_xml_get_widget(xml_tree,
"metaserver_text_entry");
116 g_signal_connect ((gpointer) metaserver_entry,
"key_press_event",
121 widget = glade_xml_get_widget(xml_tree,
"button_metaserver_quit");
122 g_signal_connect ((gpointer) widget,
"pressed",
124 g_signal_connect ((gpointer) widget,
"activate",
135 gtk_tree_view_set_model(GTK_TREE_VIEW(treeview_metaserver), GTK_TREE_MODEL(
store_metaserver));
137 renderer = gtk_cell_renderer_text_new ();
138 column = gtk_tree_view_column_new_with_attributes (
"Hostname", renderer,
141 gtk_tree_view_column_set_sort_column_id(column,
LIST_HOSTNAME);
142 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview_metaserver), column);
144 renderer = gtk_cell_renderer_text_new ();
145 column = gtk_tree_view_column_new_with_attributes (
"Updated (Sec)", renderer,
148 gtk_tree_view_column_set_sort_column_id(column,
LIST_IDLETIME);
149 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview_metaserver), column);
151 renderer = gtk_cell_renderer_text_new ();
152 column = gtk_tree_view_column_new_with_attributes (
"Players", renderer,
155 gtk_tree_view_column_set_sort_column_id(column,
LIST_PLAYERS);
156 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview_metaserver), column);
158 renderer = gtk_cell_renderer_text_new ();
159 column = gtk_tree_view_column_new_with_attributes (
"Version", renderer,
162 gtk_tree_view_column_set_sort_column_id(column,
LIST_VERSION);
163 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview_metaserver), column);
165 renderer = gtk_cell_renderer_text_new ();
166 column = gtk_tree_view_column_new_with_attributes (
"Server Comment", renderer,
169 gtk_tree_view_append_column (GTK_TREE_VIEW (treeview_metaserver), column);
171 gtk_widget_realize(metaserver_window);
180 gtk_label_set_text(GTK_LABEL(
metaserver_status),
"Waiting for data from metaserver");
183 if (*metaserver_txt ==
'\0') {
193 gtk_main_iteration_do(
FALSE);
204 if (j == meta_numservers) {
262 char *
name=NULL, *ip=NULL, buf[256], *metaserver_txt;
268 }
else if (*metaserver_txt ==
'\0') {
282 if (!name) name = metaserver_txt;
284 snprintf(buf, 255,
"Trying to connect to %s", name);
290 snprintf(buf, 255,
"Unable to connect to %s!", name);
293 snprintf(buf, 255,
"Connected to %s!", name);
310 char buf[256], *cp, newname[256];
313 snprintf(buf, 255,
"Trying to connect to %s", name);
316 strncpy(newname, name, 255);
319 if ((cp=strchr(newname,
':'))!=NULL) {
326 snprintf(buf, 255,
"Unable to connect to %s!", name);
329 snprintf(buf, 255,
"Connected to %s!", name);
348 GtkTreeViewColumn *column,
355 model = gtk_tree_view_get_model(treeview);
356 if (gtk_tree_model_get_iter(model, &iter, path)) {
373 const gchar *entry_text;
375 entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
void on_window_destroy_event(GtkObject *object, gpointer user_data)
void enable_menu_items(int enable)
int init_connection(char *host, int port)
sint16 use_config[CONFIG_NUMS]
void draw_map(int redraw)