]> Pileus Git - aweather/blobdiff - src/aweather-gui.c
Update command line arguments
[aweather] / src / aweather-gui.c
index c349d120cb290f6d14dcb15e56218f22b740877b..e3ef2ab62afb3cdaebeb9b6f399ade4239dcf3c6 100644 (file)
@@ -402,13 +402,6 @@ static void prefs_setup(AWeatherGui *self)
        gtk_tree_view_append_column(tview, col2);
        g_signal_connect(rend2, "toggled", G_CALLBACK(on_plugin_toggled), self);
        gtk_tree_view_set_model(GTK_TREE_VIEW(tview), GTK_TREE_MODEL(self->gtk_plugins));
-
-       /* Setup auto update enable */
-       gboolean auto_update = grits_prefs_get_boolean(self->prefs, "aweather/update_enab", NULL);
-       GObject *action      = aweather_gui_get_object(self, "update");
-       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), auto_update);
-       g_signal_connect_swapped(self->viewer, "refresh", G_CALLBACK(set_update_timeout), self);
-       set_update_timeout(self);
 }
 
 static void time_setup(AWeatherGui *self)
@@ -441,6 +434,27 @@ static void time_setup(AWeatherGui *self)
                        G_CALLBACK(update_time_widget), self);
 }
 
+static void icons_setup(AWeatherGui *self)
+{
+       gchar *icons[] = {
+               ICONDIR "/hicolor/16x16/apps/aweather.png",
+               ICONDIR "/hicolor/22x22/apps/aweather.png",
+               ICONDIR "/hicolor/24x24/apps/aweather.png",
+               ICONDIR "/hicolor/32x32/apps/aweather.png",
+               ICONDIR "/hicolor/48x48/apps/aweather.png",
+               ICONDIR "/hicolor/scalable/apps/aweather.svg",
+       };
+       GList *list = NULL;
+       for (int i = 0; i < G_N_ELEMENTS(icons); i++) {
+               GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(icons[i], NULL);
+               if (!pixbuf)
+                       g_warning("AWeatherGui: icons_setup - %s failed", icons[i]);
+               list = g_list_prepend(list, pixbuf);
+       }
+       gtk_window_set_default_icon_list(list);
+       g_list_free(list);
+}
+
 
 /***********
  * Methods *
@@ -549,6 +563,7 @@ static void aweather_gui_parser_finished(GtkBuildable *_self, GtkBuilder *builde
        site_setup(self);
        time_setup(self);
        prefs_setup(self);
+       icons_setup(self);
 
        /* Connect signals */
        gtk_builder_connect_signals(self->builder, self);
@@ -557,6 +572,8 @@ static void aweather_gui_parser_finished(GtkBuildable *_self, GtkBuilder *builde
        g_signal_connect_swapped(self->viewer, "offline",
                        G_CALLBACK(gtk_toggle_action_set_active),
                        aweather_gui_get_object(self, "offline"));
+       g_signal_connect_swapped(self->viewer, "refresh",
+                       G_CALLBACK(set_update_timeout), self);
        g_signal_connect_swapped(self->viewer, "realize",
                        G_CALLBACK(aweather_gui_load_plugins), self);
 }