]> Pileus Git - aweather/blobdiff - src/aweather-gui.c
Update for libgis
[aweather] / src / aweather-gui.c
index bd2adb1b6be6efe65649177b2f932033c318117b..42fc9ec59baf5f4ec4168e3bb89e4dea06e2a8f8 100644 (file)
@@ -20,7 +20,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <math.h>
 
-#include <gis/gis.h>
+#include <gis.h>
 
 #include "aweather-gui.h"
 #include "aweather-location.h"
@@ -84,7 +84,6 @@ void on_plugin_toggled(GtkCellRendererToggle *cell, gchar *path_str, AWeatherGui
                aweather_gui_attach_plugin(self, name);
        else
                aweather_gui_deattach_plugin(self, name);
-       gis_prefs_set_boolean_v(self->prefs, name, "enabled", state);
        g_free(name);
 }
 
@@ -178,7 +177,6 @@ void on_offline(GtkToggleAction *action, AWeatherGui *self)
 {
        gboolean value = gtk_toggle_action_get_active(action);
        g_debug("AWeatherGui: on_offline - offline=%d", value);
-       gis_prefs_set_boolean(self->prefs, "gis/offline", value);
        gis_viewer_set_offline(self->viewer, value);
 }
 
@@ -239,6 +237,7 @@ static void prefs_setup(AWeatherGui *self)
                        "Plugin",  rend1, "text",   0, NULL);
        GtkTreeViewColumn *col2  = gtk_tree_view_column_new_with_attributes(
                        "Enabled", rend2, "active", 1, NULL);
+       g_object_set(rend2, "xalign", 0, NULL);
        gtk_tree_view_append_column(tview, col1);
        gtk_tree_view_append_column(tview, col2);
        g_signal_connect(rend2, "toggled", G_CALLBACK(on_plugin_toggled), self);
@@ -437,7 +436,7 @@ GObject *aweather_gui_get_object(AWeatherGui *self, const gchar *name)
 }
 void aweather_gui_attach_plugin(AWeatherGui *self, const gchar *name)
 {
-       GisPlugin *plugin = gis_plugins_load(self->plugins, name,
+       GisPlugin *plugin = gis_plugins_enable(self->plugins, name,
                        self->viewer, self->prefs);
        GtkWidget *body = gis_plugin_get_config(plugin);
        if (body) {
@@ -462,7 +461,7 @@ void aweather_gui_deattach_plugin(AWeatherGui *self, const gchar *name)
                if (tab_name && g_str_equal(name, tab_name))
                        gtk_notebook_remove_page(GTK_NOTEBOOK(config), i);
        }
-       gis_plugins_unload(self->plugins, name);
+       gis_plugins_disable(self->plugins, name);
        gtk_widget_queue_draw(GTK_WIDGET(self->viewer));
 }
 
@@ -479,8 +478,8 @@ static void aweather_gui_init(AWeatherGui *self)
        gchar *config   = g_build_filename(g_get_user_config_dir(), PACKAGE, "config.ini", NULL);
        gchar *defaults = g_build_filename(PKGDATADIR, "defaults.ini", NULL);
        self->prefs   = gis_prefs_new(config, defaults);
-       self->plugins = gis_plugins_new(PLUGINSDIR);
-       self->viewer  = gis_opengl_new(self->plugins);
+       self->plugins = gis_plugins_new(PLUGINSDIR, self->prefs);
+       self->viewer  = gis_opengl_new(self->plugins, self->prefs);
        g_free(config);
        g_free(defaults);
 
@@ -501,7 +500,7 @@ static void aweather_gui_init(AWeatherGui *self)
        for (GList *cur = gis_plugins_available(self->plugins); cur; cur = cur->next) {
                gchar *name = cur->data;
                GError *error = NULL;
-               gboolean enabled = gis_prefs_get_boolean_v(self->prefs, cur->data, "enabled", &error);
+               gboolean enabled = gis_prefs_get_boolean_v(self->prefs, "plugins", cur->data, &error);
                if (error && error->code == G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
                        enabled = TRUE;
                gtk_list_store_append(self->gtk_plugins, &iter);