From f21f94748e256058ee09dfe145c06c28473695fb Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sat, 9 May 2009 05:28:57 +0000 Subject: [PATCH] adding GUI for sites and times --- src/.vimrc | 1 + src/Makefile.am | 2 +- src/aweather.c | 74 ++++++++++++-- src/location.c | 236 +++++++++++++++++++++++++++++++++++++++++++++ src/location.h | 28 ++++++ src/plugin-radar.c | 5 +- src/site.c | 6 -- src/site.h | 6 -- 8 files changed, 338 insertions(+), 20 deletions(-) create mode 100644 src/location.c create mode 100644 src/location.h delete mode 100644 src/site.c delete mode 100644 src/site.h diff --git a/src/.vimrc b/src/.vimrc index 1e1d189..5de2904 100644 --- a/src/.vimrc +++ b/src/.vimrc @@ -1 +1,2 @@ set makeprg=make\ test +set tw=100 diff --git a/src/Makefile.am b/src/Makefile.am index ac91542..8940848 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ bin_PROGRAMS = aweather aweather_SOURCES = \ aweather.c aweather.h \ - site.c site.h \ + location.c location.h \ opengl.c opengl.h \ plugin-radar.c plugin-radar.h \ plugin-ridge.c plugin-ridge.h \ diff --git a/src/aweather.c b/src/aweather.c index a732eb2..f6f4341 100644 --- a/src/aweather.c +++ b/src/aweather.c @@ -3,11 +3,15 @@ #include #include +#include "location.h" #include "opengl.h" #include "plugin-radar.h" #include "plugin-ridge.h" #include "plugin-example.h" +/************************ + * GtkBuilder callbacks * + ************************/ gboolean on_window_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { if (event->keyval == GDK_q) @@ -15,6 +19,63 @@ gboolean on_window_key_press_event(GtkWidget *widget, GdkEventKey *event, gpoint return TRUE; } +void on_site_changed() { + g_message("site changed"); +} + +/***************** + * Setup helpers * + *****************/ +static void combo_sensitive(GtkCellLayout *cell_layout, GtkCellRenderer *cell, + GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) +{ + gboolean sensitive = !gtk_tree_model_iter_has_child(tree_model, iter); + g_object_set(cell, "sensitive", sensitive, NULL); +} + +static void site_setup(GtkBuilder *builder) +{ + GtkTreeIter state, city; + GtkTreeStore *store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + for (int i = 0; cities[i].label; i++) { + if (cities[i].type == LOCATION_STATE) { + gtk_tree_store_append(store, &state, NULL); + gtk_tree_store_set (store, &state, 0, cities[i].label, + 1, cities[i].code, -1); + } else { + gtk_tree_store_append(store, &city, &state); + gtk_tree_store_set (store, &city, 0, cities[i].label, + 1, cities[i].code, -1); + } + } + + GtkWidget *combo = GTK_WIDGET(gtk_builder_get_object(builder, "site")); + GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 0, NULL); + gtk_combo_box_set_model(GTK_COMBO_BOX(combo), GTK_TREE_MODEL(store)); + gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(combo), renderer, + combo_sensitive, NULL, NULL); + + //g_signal_connect(G_OBJECT(loc_sel), "changed", G_CALLBACK(loc_changed), NULL); + //gtk_box_pack_start(GTK_BOX(selectors), loc_sel, FALSE, FALSE, 0); +} + +static void time_setup(GtkBuilder *builder) +{ + GtkWidget *view = GTK_WIDGET(gtk_builder_get_object(builder, "time")); + GtkCellRenderer *rend = gtk_cell_renderer_text_new(); + GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes( + "Time", rend, 0, "text", NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(view), col); + + GtkTreeStore *store = gtk_tree_store_new(1, G_TYPE_STRING); + gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store)); +} + +/******** + * Main * + ********/ int main(int argc, char *argv[]) { @@ -30,21 +91,22 @@ int main(int argc, char *argv[]) GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "window")); GtkWidget *drawing = GTK_WIDGET(gtk_builder_get_object(builder, "drawing")); GtkWidget *tabs = GTK_WIDGET(gtk_builder_get_object(builder, "tabs")); - if (window == NULL) g_error("window is null"); - if (drawing == NULL) g_error("drawing is null"); - if (tabs == NULL) g_error("tabs is null"); /* Set up darwing area */ GdkGLConfig *glconfig = gdk_gl_config_new_by_mode( GDK_GL_MODE_RGBA | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_ALPHA); if (!glconfig) - g_assert_not_reached(); + g_error("Failed to create glconfig"); if (!gtk_widget_set_gl_capability(drawing, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE)) - g_assert_not_reached(); + g_error("GL lacks required capabilities"); + + /* Load components */ + site_setup(builder); + time_setup(builder); + opengl_init(GTK_DRAWING_AREA(drawing), GTK_NOTEBOOK(tabs)); /* Load plugins */ - opengl_init (GTK_DRAWING_AREA(drawing), GTK_NOTEBOOK(tabs)); radar_init (GTK_DRAWING_AREA(drawing), GTK_NOTEBOOK(tabs)); ridge_init (GTK_DRAWING_AREA(drawing), GTK_NOTEBOOK(tabs)); example_init(GTK_DRAWING_AREA(drawing), GTK_NOTEBOOK(tabs)); diff --git a/src/location.c b/src/location.c new file mode 100644 index 0000000..14634dc --- /dev/null +++ b/src/location.c @@ -0,0 +1,236 @@ +#include +#include + +#include "location.h" + +city_t cities[] = { + {LOCATION_STATE, NULL, "Alabama", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BMX", "Birmingham", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MXX", "E. Alabama", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EOX", "Fort Rucker", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MOB", "Mobile", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HTX", "Nrn. Alabama", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Alaska", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ABC", "Bethel", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ACG", "Biorka Is.", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "APD", "Fairbanks", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AHG", "Kenai", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AKC", "King Salmon", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AIH", "Middleton Is.", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AEC", "Nome", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "APD", "Pedro Dome", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ACG", "Sitka", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Arizona", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FSX", "Flagstaff", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "IWA", "Phoenix", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EMX", "Tucson", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "YUX", "Yuma", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Arkansas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LZK", "Little Rock", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SRX", "W. Ark./Ft. Smith", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "California", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BBX", "Beale AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EYX", "Edwards AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BHX", "Eureka", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HNX", "Hanford", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "VTX", "Los Angeles", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DAX", "Sacramento", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "NKX", "San Diego", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MUX", "San Francisco", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HNX", "San Joaquin Vly.", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SOX", "Santa Ana Mtns", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "VBX", "Vandenberg AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Colorado", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FTG", "Denver/Boulder", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GJX", "Grand Junction", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "PUX", "Pueblo", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Delaware", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DOX", "Dover AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Florida", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EVX", "Eglin AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "JAX", "Jacksonville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BYX", "Key West", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MLB", "Melbourne", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AMX", "Miami", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EVX", "NW Florida", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TLH", "Tallahassee", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TBW", "Tampa Bay Area", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Georgia", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FFC", "Atlanta", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "VAX", "Moody AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FFC", "Peachtree City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "JGX", "Robins AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Guam", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GUA", "Andersen AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Hawaii", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HKI", "Kauai", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HKM", "Kohala", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HMO", "Molokai", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HWA", "South Shore", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Idaho", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CBX", "Boise", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SFX", "Pocatello", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Illinois", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ILX", "Central IL", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LOT", "Chicago", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Indiana", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "VWX", "Evansville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "IND", "Indianapolis", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "IWX", "Nrn. Indiana", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Iowa", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DMX", "Des Moines", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DVN", "Quad Cities", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Kansas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DDC", "Dodge City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GLD", "Goodland", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TWX", "Topeka", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ICT", "Wichita", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Kentucky", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HPX", "Fort Cambell", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "JKL", "Jackson", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LVX", "Louisville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "PAH", "Paducah", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Louisiana", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "POE", "Fort Polk", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LCH", "Lake Charles", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LIX", "New Orleans", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SHV", "Shreveport", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Maine", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CBW", "Caribou", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GYX", "Portland", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Maryland", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LWX", "Baltimore", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Massachusetts", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BOX", "Boston", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Michigan", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DTX", "Detroit", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "APX", "Gaylord", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GRR", "Grand Rapids", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MQT", "Marquette", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Minnesota", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DLH", "Duluth", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MPX", "Minneapolis", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Mississippi", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GWX", "Columbus AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DGX", "Jackson/Brandon", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Missouri", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EAX", "Kansas City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SGF", "Springfield", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LSX", "St. Louis", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Montana", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BLX", "Billings", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GGW", "Glasgow", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TFX", "Great Falls", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MSX", "Missoula", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Nebraska", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "UEX", "Hastings", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LNX", "North Platte", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "OAX", "Omaha", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Nevada", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LRX", "Elko", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ESX", "Las Vegas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RGX", "Reno", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "New Jersey", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DIX", "Mt. Holly", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "New Mexico", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ABX", "Albuquerque", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FDX", "Cannon AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HDX", "Holloman AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "New York", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ENX", "Albany", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BGM", "Binghamton", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BUF", "Buffalo", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TYX", "Montague", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "OKX", "New York City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "OKX", "Upton", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "North Carolina", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RAX", "Durham", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MHX", "Morehead City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RAX", "Raleigh", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LTX", "Wilmington", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "North Dakota", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BIS", "Bismarck", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MVX", "Grand Forks", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MBX", "Minot AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Ohio", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ILN", "Cincinnati", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CLE", "Cleveland", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ILN", "Dayton", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ILN", "Wilmington", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Oklahoma", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FDR", "Frederick", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "TLX", "Oklahoma City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "INX", "Tulsa", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "VNX", "Vance AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Oregon", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MAX", "Medford", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "PDT", "Pendleton", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RTX", "Portland", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Pennsylvania", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DIX", "Philadelphia", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "PBZ", "Pittsburgh", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CCX", "State College", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Puerto Rico", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "JUA", "Puerto Rico/V.I.", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "South Carolina", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CLX", "Charleston", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CAE", "Columbia", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GSP", "Greenville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GSP", "Spartanburg", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GSP", "Greer", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "South Dakota", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ABR", "Aberdeen", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "UDX", "Rapid City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FSD", "Sioux falls", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Tennessee", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MRX", "Knoxville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "NQA", "Memphis", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MRX", "Morristown", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "OHX", "Nashville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MRX", "Tri Cities", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Texas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AMA", "Amarillo", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EWX", "Austin", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "BRO", "Brownsville", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GRK", "Central Texas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CRP", "Corpus Christi", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FWS", "Dallas", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DYX", "Dyess AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EPZ", "El Paso", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FWS", "Fort Worth", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HGX", "Galveston", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "HGX", "Houston", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "DFX", "Laughlin AFB", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LBB", "Lubbock", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MAF", "Midland/Odessa", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "SJT", "San Angelo", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "EWX", "San Antonio", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Utah", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ICX", "Cedar City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MTX", "Salt Lake City", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Vermont", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CXX", "Burlington", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Virginia", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FCX", "Blacksburg", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AKQ", "Norfolk", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AKQ", "Richmond", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "FCX", "Roanoke", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LWX", "Sterling", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "AKQ", "Wakefield", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Washington", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ATX", "Seattle", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "OTX", "Spokane", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ATX", "Tacoma", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Washington DC", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "LWX", "Washington", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "West Virginia", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RLX", "Charleston", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Wisconsin", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "GRB", "Green Bay", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "ARX", "La Crosse", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "MKX", "Milwaukee", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_STATE, NULL, "Wyoming", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "CYS", "Cheyenne", {0, 0, 0, 0, 0, 0, 0, 0}}, + {LOCATION_CITY, "RIW", "Riverton", {0, 0, 0, 0, 0, 0, 0, 0}}, + {0, NULL, NULL, {0, 0, 0, 0, 0, 0, 0, 0}}, +}; diff --git a/src/location.h b/src/location.h new file mode 100644 index 0000000..0dde55c --- /dev/null +++ b/src/location.h @@ -0,0 +1,28 @@ +#ifndef SITE_H +#define SITE_H + +enum { + LOCATION_CITY, + LOCATION_STATE +}; + +typedef struct { + int type; + char *code; + char *label; + struct { + gint north; + gint ne; + gint east; + gint se; + gint south; + gint sw; + gint west; + gint nw; + } neighbors; +} city_t; + +extern city_t cities[]; + + +#endif diff --git a/src/plugin-radar.c b/src/plugin-radar.c index 317cea5..6adcfa9 100644 --- a/src/plugin-radar.c +++ b/src/plugin-radar.c @@ -192,6 +192,7 @@ gboolean radar_init(GtkDrawingArea *_drawing, GtkNotebook *config) g_print("No sweeps found\n"); /* Add configuration tab */ + GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL); GtkWidget *hbox = gtk_hbox_new(TRUE, 0); GtkWidget *button = NULL; int vi = 0, si = 0; @@ -211,7 +212,9 @@ gboolean radar_init(GtkDrawingArea *_drawing, GtkNotebook *config) } } GtkWidget *label = gtk_label_new("Radar"); - gtk_notebook_append_page(GTK_NOTEBOOK(config), hbox, label); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), hbox); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_notebook_append_page(GTK_NOTEBOOK(config), scroll, label); /* Set up OpenGL Stuff */ g_signal_connect(drawing, "expose-event", G_CALLBACK(expose), NULL); diff --git a/src/site.c b/src/site.c deleted file mode 100644 index 99d1fed..0000000 --- a/src/site.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void setup_panel() -{ -} diff --git a/src/site.h b/src/site.h deleted file mode 100644 index bc37546..0000000 --- a/src/site.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SITE_H -#define SITE_H - -void setup_sidebar(); - -#endif -- 2.41.0