]> Pileus Git - aweather/blobdiff - src/plugins/radar.c
(Re)Add a workaround for tab positions on Win32
[aweather] / src / plugins / radar.c
index 5680d2f1cace465d4f72da5213be4b29d34612a9..4b86240607a39f7f62e28d5d7cd723c45beac117 100644 (file)
@@ -465,12 +465,18 @@ gboolean _conus_update_end(gpointer _conus)
        /* Load and pixbuf */
        GError *error = NULL;
        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(conus->path, &error);
-       guchar    *pixels = gdk_pixbuf_get_pixels(pixbuf);
-       gint       width  = gdk_pixbuf_get_width(pixbuf);
-       gint       height = gdk_pixbuf_get_height(pixbuf);
-       gint       pxsize = gdk_pixbuf_get_has_alpha(pixbuf) ? 4 : 3;
+       if (!pixbuf || error) {
+               g_warning("GisPluginRadar: _conus_update_end - error loading pixbuf");
+               _gtk_bin_set_child(GTK_BIN(conus->config), gtk_label_new("Error loading pixbuf"));
+               g_remove(conus->path);
+               goto out;
+       }
 
        /* Split pixels into east/west parts */
+       guchar *pixels = gdk_pixbuf_get_pixels(pixbuf);
+       gint    width  = gdk_pixbuf_get_width(pixbuf);
+       gint    height = gdk_pixbuf_get_height(pixbuf);
+       gint    pxsize = gdk_pixbuf_get_has_alpha(pixbuf) ? 4 : 3;
        guchar *pixels_west = g_malloc(4*(width/2)*height);
        guchar *pixels_east = g_malloc(4*(width/2)*height);
        _conus_update_end_split(pixels, pixels_west, pixels_east,
@@ -696,7 +702,8 @@ static void gis_plugin_radar_init(GisPluginRadar *self)
        self->sites      = g_hash_table_new_full(g_str_hash, g_str_equal,
                                NULL, (GDestroyNotify)radar_site_free);
        self->config     = gtk_notebook_new();
-       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(self->config), GTK_POS_LEFT);
+       /* Need to position on the top because of Win32 bug */
+       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(self->config), GTK_POS_BOTTOM);
 }
 static void gis_plugin_radar_dispose(GObject *gobject)
 {