]> Pileus Git - aweather/blobdiff - src/plugins/radar.c
Convert GtkBox and GtkScale to GTK 3 version
[aweather] / src / plugins / radar.c
index 8e5abfc4d1225b8a055c2a1e5723c9b4f97dfd8d..2c40b9eaa05ca66bf660196a274154ffcd4deebb 100644 (file)
@@ -30,7 +30,9 @@
 #include "level2.h"
 #include "../aweather-location.h"
 
-static void _gtk_bin_set_child(GtkBin *bin, GtkWidget *new)
+#include "compat.h"
+
+static void aweather_bin_set_child(GtkBin *bin, GtkWidget *new)
 {
        GtkWidget *old = gtk_bin_get_child(bin);
        if (old)
@@ -123,15 +125,16 @@ gboolean _site_update_end(gpointer _site)
                g_warning("RadarSite: update_end - %s", site->message);
                const char *fmt = "http://forecast.weather.gov/product.php?site=NWS&product=FTM&format=TXT&issuedby=%s";
                char       *uri = g_strdup_printf(fmt, site->city->code+1);
-               GtkWidget  *box = gtk_vbox_new(TRUE, 0);
+               GtkWidget  *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
                GtkWidget  *msg = gtk_label_new(site->message);
                GtkWidget  *btn = gtk_link_button_new_with_label(uri, "View Radar Status");
+               gtk_box_set_homogeneous(GTK_BOX(box), TRUE);
                gtk_box_pack_start(GTK_BOX(box), msg, TRUE, TRUE, 0);
                gtk_box_pack_start(GTK_BOX(box), btn, TRUE, TRUE, 0);
-               _gtk_bin_set_child(GTK_BIN(site->config), box);
+               aweather_bin_set_child(GTK_BIN(site->config), box);
                g_free(uri);
        } else {
-               _gtk_bin_set_child(GTK_BIN(site->config),
+               aweather_bin_set_child(GTK_BIN(site->config),
                                aweather_level2_get_config(site->level2));
        }
        site->status = STATUS_LOADED;
@@ -211,7 +214,7 @@ void _site_update(RadarSite *site)
        /* Add a progress bar */
        GtkWidget *progress = gtk_progress_bar_new();
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), "Loading...");
-       _gtk_bin_set_child(GTK_BIN(site->config), progress);
+       aweather_bin_set_child(GTK_BIN(site->config), progress);
 
        /* Remove old volume */
        g_debug("RadarSite: update - remove - %s", site->city->code);
@@ -450,7 +453,7 @@ gboolean _conus_update_end(gpointer _conus)
        /* Check error status */
        if (conus->message) {
                g_warning("Conus: update_end - %s", conus->message);
-               _gtk_bin_set_child(GTK_BIN(conus->config), gtk_label_new(conus->message));
+               aweather_bin_set_child(GTK_BIN(conus->config), gtk_label_new(conus->message));
                goto out;
        }
 
@@ -459,7 +462,7 @@ gboolean _conus_update_end(gpointer _conus)
        GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(conus->path, &error);
        if (!pixbuf || error) {
                g_warning("Conus: update_end - error loading pixbuf: %s", conus->path);
-               _gtk_bin_set_child(GTK_BIN(conus->config), gtk_label_new("Error loading pixbuf"));
+               aweather_bin_set_child(GTK_BIN(conus->config), gtk_label_new("Error loading pixbuf"));
                g_remove(conus->path);
                goto out;
        }
@@ -483,7 +486,7 @@ gboolean _conus_update_end(gpointer _conus)
 
        /* Update GUI */
        gchar *label = g_path_get_basename(conus->path);
-       _gtk_bin_set_child(GTK_BIN(conus->config), gtk_label_new(label));
+       aweather_bin_set_child(GTK_BIN(conus->config), gtk_label_new(label));
        grits_viewer_queue_draw(conus->viewer);
        g_free(label);
 
@@ -558,7 +561,7 @@ void _conus_update(RadarConus *conus)
        /* Add a progress bar */
        GtkWidget *progress = gtk_progress_bar_new();
        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), "Loading...");
-       _gtk_bin_set_child(GTK_BIN(conus->config), progress);
+       aweather_bin_set_child(GTK_BIN(conus->config), progress);
 
        g_thread_new("conus-update-thread", _conus_update_thread, conus);
 }
@@ -680,7 +683,7 @@ out:
 }
 
 static void _update_hidden(GtkNotebook *notebook,
-               GtkNotebookPage *page, guint page_num, gpointer viewer)
+               gpointer _, guint page_num, gpointer viewer)
 {
        g_debug("GritsPluginRadar: _update_hidden - 0..%d = %d",
                        gtk_notebook_get_n_pages(notebook), page_num);