-#include "misc.h"
-#include "aweather-gui.h"
-#include "aweather-plugin.h"
-#include "gis-opengl.h"
-#include "location.h"
-
-/* Needed prototpes */
-gboolean on_gui_key_press(GtkWidget *widget, GdkEventKey *event, AWeatherGui *self);
-static void site_setup(AWeatherGui *self);
-static void time_setup(AWeatherGui *self);
-
-/****************
- * GObject code *
- ****************/
-G_DEFINE_TYPE(AWeatherGui, aweather_gui, GTK_TYPE_WINDOW);
-static void aweather_gui_init(AWeatherGui *self)
-{
- g_debug("AWeatherGui: init");
-
- /* Setup window */
- self->builder = gtk_builder_new();
- GError *error = NULL;
- if (!gtk_builder_add_from_file(self->builder, DATADIR "/aweather/main.ui", &error))
- g_error("Failed to create gtk builder: %s", error->message);
- gtk_widget_reparent(aweather_gui_get_widget(self, "body"), GTK_WIDGET(self));
-
- /* GIS things */
- GtkWidget *drawing = aweather_gui_get_widget(self, "drawing");
- self->world = gis_world_new();
- self->view = gis_view_new();
- self->opengl = gis_opengl_new(self->world, self->view, GTK_DRAWING_AREA(drawing));
-
- /* Plugins */
- self->plugins = NULL;
- // TODO: set/load these with prefereces
- aweather_gui_load_plugin(self, "example");
- //aweather_gui_load_plugin(self, "radar");
- //aweather_gui_load_plugin(self, "ridge");
- self->gtk_plugins = GTK_LIST_STORE(aweather_gui_get_object(self, "plugins"));
- GDir *dir = g_dir_open(PLUGINDIR, 0, NULL);
- const gchar *name;
- GtkTreeIter iter;
- while ((name = g_dir_read_name(dir))) {
- if (g_pattern_match_simple("*.so", name)) {
- gtk_list_store_append(self->gtk_plugins, &iter);
- gtk_list_store_set(self->gtk_plugins, &iter, 0, name, 1, FALSE, -1);
- }
- }
-
- /* Misc, helpers */
- site_setup(self);
- time_setup(self);
-
- /* Connect signals */
- gtk_builder_connect_signals(self->builder, self);
- g_signal_connect(self, "key-press-event",
- G_CALLBACK(on_gui_key_press), self);
- g_signal_connect_swapped(self->world, "offline",
- G_CALLBACK(gtk_toggle_action_set_active),
- aweather_gui_get_object(self, "offline"));