Commit d06db615 authored by Harald Judt's avatar Harald Judt

Reformat source code: weather-summary

parent 3cee110b
......@@ -31,69 +31,88 @@
#include "weather-icon.h"
static gboolean lnk_clicked (GtkTextTag *tag, GObject *obj,
GdkEvent *event, GtkTextIter *iter,
static gboolean
lnk_clicked(GtkTextTag *tag,
GObject *obj,
GdkEvent *event,
GtkTextIter *iter,
GtkWidget *textview);
#define BORDER 8
#define APPEND_BTEXT(text) gtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(buffer),\
#define APPEND_BTEXT(text) \
gtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(buffer), \
&iter, text, -1, btag, NULL);
#define APPEND_TEXT_ITEM_REAL(text) gtk_text_buffer_insert(GTK_TEXT_BUFFER(buffer), \
&iter, text, -1);\
g_free (value);
#define APPEND_TEXT_ITEM(text, item) rawvalue = get_data(conditions, data->unit_system, item); \
#define APPEND_TEXT_ITEM_REAL(text) \
gtk_text_buffer_insert(GTK_TEXT_BUFFER(buffer), \
&iter, text, -1); \
g_free(value);
#define APPEND_TEXT_ITEM(text, item) \
rawvalue = get_data(conditions, data->unit_system, item); \
unit = get_unit(data->unit_system, item); \
value = g_strdup_printf("\t%s%s%s%s%s\n", \
text, text ? ": " : "", \
rawvalue, \
strcmp(unit, "°") ? " " : "", \
unit); \
g_free (rawvalue);\
g_free(rawvalue); \
APPEND_TEXT_ITEM_REAL(value);
#define APPEND_LINK_ITEM(prefix, text, url, lnk_tag) \
gtk_text_buffer_insert(GTK_TEXT_BUFFER(buffer), \
&iter, prefix, -1);\
&iter, prefix, -1); \
gtk_text_buffer_insert_with_tags(GTK_TEXT_BUFFER(buffer), \
&iter, text, -1, lnk_tag, NULL);\
&iter, text, -1, lnk_tag, NULL); \
gtk_text_buffer_insert(GTK_TEXT_BUFFER(buffer), \
&iter, "\n", -1);\
&iter, "\n", -1); \
g_object_set_data_full(G_OBJECT(lnk_tag), "url", g_strdup(url), g_free); \
g_signal_connect(G_OBJECT(lnk_tag), "event", \
G_CALLBACK(lnk_clicked), NULL);
static GtkTooltips *tooltips = NULL;
static gboolean lnk_clicked (GtkTextTag *tag, GObject *obj,
GdkEvent *event, GtkTextIter *iter,
static gboolean
lnk_clicked(GtkTextTag *tag,
GObject *obj,
GdkEvent *event,
GtkTextIter *iter,
GtkWidget *textview)
{
if (event->type == GDK_BUTTON_RELEASE) {
const gchar *url = g_object_get_data(G_OBJECT(tag), "url");
gchar *str = g_strdup_printf("exo-open --launch WebBrowser %s", url);
const gchar *url;
gchar *str;
if (event->type == GDK_BUTTON_RELEASE) {
url = g_object_get_data(G_OBJECT(tag), "url");
str = g_strdup_printf("exo-open --launch WebBrowser %s", url);
g_spawn_command_line_async(str, NULL);
g_free(str);
} else if (event->type == GDK_LEAVE_NOTIFY) {
} else if (event->type == GDK_LEAVE_NOTIFY)
gdk_window_set_cursor(gtk_text_view_get_window(GTK_TEXT_VIEW(obj),
GTK_TEXT_WINDOW_TEXT), NULL);
}
GTK_TEXT_WINDOW_TEXT),
NULL);
return FALSE;
}
static gboolean
icon_clicked (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
return lnk_clicked(user_data, NULL, (GdkEvent *)(event), NULL, NULL);
return lnk_clicked(user_data, NULL, (GdkEvent *) (event), NULL, NULL);
}
static GdkCursor *hand_cursor = NULL;
static GdkCursor *text_cursor = NULL;
static gboolean on_icon = FALSE;
static gboolean view_motion_notify(GtkWidget *widget,
static gboolean
view_motion_notify(GtkWidget *widget,
GdkEventMotion *event,
GtkWidget *view)
{
......@@ -112,7 +131,8 @@ static gboolean view_motion_notify(GtkWidget *widget,
for (cur = tags; cur != NULL; cur = cur->next) {
GtkTextTag *tag = cur->data;
if (g_object_get_data(G_OBJECT(tag), "url")) {
gdk_window_set_cursor(gtk_text_view_get_window(GTK_TEXT_VIEW(view),
gdk_window_set_cursor(gtk_text_view_get_window
(GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT), hand_cursor);
return FALSE;
}
......@@ -120,56 +140,71 @@ static gboolean view_motion_notify(GtkWidget *widget,
}
if (!on_icon)
gdk_window_set_cursor(gtk_text_view_get_window(GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT), text_cursor);
GTK_TEXT_WINDOW_TEXT),
text_cursor);
return FALSE;
}
static gboolean icon_motion_notify(GtkWidget *widget,
static gboolean
icon_motion_notify(GtkWidget *widget,
GdkEventMotion *event,
GtkWidget *view)
{
on_icon = TRUE;
gdk_window_set_cursor(gtk_text_view_get_window(GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT), hand_cursor);
GTK_TEXT_WINDOW_TEXT),
hand_cursor);
return FALSE;
}
static gboolean view_leave_notify(GtkWidget *widget,
static gboolean
view_leave_notify(GtkWidget *widget,
GdkEventMotion *event,
GtkWidget *view)
{
on_icon = FALSE;
gdk_window_set_cursor(gtk_text_view_get_window(GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT), text_cursor);
GTK_TEXT_WINDOW_TEXT),
text_cursor);
return FALSE;
}
static GtkWidget *weather_channel_evt = NULL;
static void view_scrolled_cb (GtkAdjustment *adj, GtkWidget *view)
static void
view_scrolled_cb(GtkAdjustment *adj,
GtkWidget *view)
{
if (weather_channel_evt) {
gint x, y, x1, y1;
x1 = view->allocation.width - 191 - 15;
y1 = view->requisition.height - 60 - 15;
gtk_text_view_buffer_to_window_coords(
GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT, x1, y1, &x, &y);
gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(view),
GTK_TEXT_WINDOW_TEXT,
x1, y1, &x, &y);
gtk_text_view_move_child(GTK_TEXT_VIEW(view),
weather_channel_evt, x, y);
}
}
static void view_size_allocate_cb (GtkWidget *widget,
static void
view_size_allocate_cb(GtkWidget *widget,
GtkAllocation *allocation,
gpointer data)
{
view_scrolled_cb(NULL, GTK_WIDGET(data));
}
static gchar *get_logo_path (void)
static gchar *
get_logo_path(void)
{
gchar *dir = g_strconcat(g_get_user_cache_dir(), G_DIR_SEPARATOR_S,
"xfce4", G_DIR_SEPARATOR_S, "weather-plugin", NULL);
"xfce4", G_DIR_SEPARATOR_S, "weather-plugin",
NULL);
g_mkdir_with_parents(dir, 0755);
g_free(dir);
......@@ -179,6 +214,7 @@ static gchar *get_logo_path (void)
G_DIR_SEPARATOR_S, "weather_logo.gif", NULL);
}
static void
logo_fetched (gboolean succeed,
gchar *result,
......@@ -206,7 +242,9 @@ logo_fetched (gboolean succeed,
}
}
static GtkWidget *weather_summary_get_logo(xfceweather_data *data)
static GtkWidget *
weather_summary_get_logo(xfceweather_data *data)
{
GtkWidget *image = gtk_image_new();
GdkPixbuf *pixbuf = NULL;
......@@ -214,10 +252,11 @@ static GtkWidget *weather_summary_get_logo(xfceweather_data *data)
pixbuf = gdk_pixbuf_new_from_file(path, NULL);
g_free(path);
if (pixbuf == NULL) {
weather_http_receive_data ("met.no", "/filestore/met.no-logo.gif",
data->proxy_host, data->proxy_port, logo_fetched, image);
} else {
if (pixbuf == NULL)
weather_http_receive_data("met.no", "/filestore/met.no-logo.gif",
data->proxy_host, data->proxy_port,
logo_fetched, image);
else {
gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf);
g_object_unref(pixbuf);
}
......@@ -225,120 +264,126 @@ static GtkWidget *weather_summary_get_logo(xfceweather_data *data)
return image;
}
static GtkWidget *
create_summary_tab (xfceweather_data *data)
create_summary_tab(xfceweather_data *data)
{
GtkTextBuffer *buffer;
GtkTextIter iter;
GtkTextTag *btag, *ltag0, *ltag1;
gchar *value, *wind, *sun_val, *vis, *rawvalue;
const gchar *unit;
GtkWidget *view, *frame, *scrolled;
GdkColor lnk_color;
GtkWidget *view, *frame, *scrolled, *weather_channel_icon;
GtkAdjustment *adj;
GtkWidget *weather_channel_icon;
GdkColor lnk_color;
xml_time *conditions;
const gchar *unit;
struct tm *start_tm, *end_tm, *point_tm;
gchar *value, *wind, *sun_val, *vis, *rawvalue;
char interval_start[80], interval_end[80], point[80];
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (view), BORDER);
frame = gtk_frame_new (NULL);
scrolled = gtk_scrolled_window_new (NULL, NULL);
view = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE);
gtk_container_set_border_width(GTK_CONTAINER(view), BORDER);
frame = gtk_frame_new(NULL);
scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
gtk_container_add(GTK_CONTAINER(scrolled), view);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (frame), scrolled);
gtk_container_set_border_width(GTK_CONTAINER(frame), BORDER);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(frame), scrolled);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &iter, 0);
btag =
gtk_text_buffer_create_tag (buffer, NULL, "weight", PANGO_WEIGHT_BOLD,
NULL);
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
gtk_text_buffer_get_iter_at_offset(GTK_TEXT_BUFFER(buffer), &iter, 0);
btag = gtk_text_buffer_create_tag(buffer, NULL, "weight",
PANGO_WEIGHT_BOLD, NULL);
gdk_color_parse("#0000ff", &lnk_color);
ltag0 = gtk_text_buffer_create_tag(buffer, "lnk0", "foreground-gdk", &lnk_color, NULL);
ltag1 = gtk_text_buffer_create_tag(buffer, "lnk1", "foreground-gdk", &lnk_color, NULL);
ltag0 = gtk_text_buffer_create_tag(buffer, "lnk0",
"foreground-gdk", &lnk_color, NULL);
ltag1 = gtk_text_buffer_create_tag(buffer, "lnk1",
"foreground-gdk", &lnk_color, NULL);
/* head */
value = g_strdup_printf (_("Weather report for: %s.\n\n"), data->location_name);
APPEND_BTEXT (value);
g_free (value);
value = g_strdup_printf(_("Weather report for: %s.\n\n"),
data->location_name);
APPEND_BTEXT(value);
g_free(value);
conditions = get_current_conditions(data->weatherdata);
APPEND_BTEXT(_("Coordinates\n"));
APPEND_TEXT_ITEM (_("Altitude"), ALTITUDE);
APPEND_TEXT_ITEM (_("Latitude"), LATITUDE);
APPEND_TEXT_ITEM (_("Longitude"), LONGITUDE);
APPEND_TEXT_ITEM(_("Altitude"), ALTITUDE);
APPEND_TEXT_ITEM(_("Latitude"), LATITUDE);
APPEND_TEXT_ITEM(_("Longitude"), LONGITUDE);
APPEND_BTEXT(_("\nTime\n"));
point_tm = localtime(&conditions->point);
strftime (point, 80, "%c", point_tm);
value = g_strdup_printf (_("\tTemperature, wind, atmosphere and cloud data apply to:\n\t%s\n"), point);
APPEND_TEXT_ITEM_REAL (value);
strftime(point, 80, "%c", point_tm);
value = g_strdup_printf
(_("\tTemperature, wind, atmosphere and cloud data apply to:\n\t%s\n"),
point);
APPEND_TEXT_ITEM_REAL(value);
start_tm = localtime(&conditions->start);
strftime (interval_start, 80, "%c", start_tm);
strftime(interval_start, 80, "%c", start_tm);
end_tm = localtime(&conditions->end);
strftime (interval_end, 80, "%c", end_tm);
value = g_strdup_printf (_("\n\tPrecipitation and the weather symbol have been calculated\n\tfor the following time interval:\n\tStart:\t%s\n\tEnd:\t%s\n"),
strftime(interval_end, 80, "%c", end_tm);
value = g_strdup_printf
(_("\n\tPrecipitation and the weather symbol have been calculated\n\tfor the following time interval:\n\tStart:\t%s\n\tEnd:\t%s\n"),
interval_start,
interval_end);
APPEND_TEXT_ITEM_REAL (value);
/* Temperature */
APPEND_BTEXT (_("\nTemperature\n"));
APPEND_TEXT_ITEM (_("Temperature"), TEMPERATURE);
/* Wind */
APPEND_BTEXT (_("\nWind\n"));
rawvalue = get_data (conditions, data->unit_system, WIND_SPEED);
wind = translate_wind_speed (conditions, rawvalue, data->unit_system);
g_free (rawvalue);
rawvalue = get_data (conditions, data->unit_system, WIND_BEAUFORT);
value = g_strdup_printf (_("\t%s: %s (%s on the Beaufort scale)\n"), _("Speed"), wind, rawvalue);
g_free (rawvalue);
g_free (wind);
APPEND_TEXT_ITEM_REAL (value);
rawvalue = get_data (conditions, data->unit_system, WIND_DIRECTION);
wind = translate_wind_direction (rawvalue);
g_free (rawvalue);
rawvalue = get_data (conditions, data->unit_system, WIND_DIRECTION_DEG);
value = g_strdup_printf ("\t%s: %s (%s%s)\n", _("Direction"),
APPEND_TEXT_ITEM_REAL(value);
/* temperature */
APPEND_BTEXT(_("\nTemperature\n"));
APPEND_TEXT_ITEM(_("Temperature"), TEMPERATURE);
/* wind */
APPEND_BTEXT(_("\nWind\n"));
rawvalue = get_data(conditions, data->unit_system, WIND_SPEED);
wind = translate_wind_speed(conditions, rawvalue, data->unit_system);
g_free(rawvalue);
rawvalue = get_data(conditions, data->unit_system, WIND_BEAUFORT);
value = g_strdup_printf(_("\t%s: %s (%s on the Beaufort scale)\n"),
_("Speed"), wind, rawvalue);
g_free(rawvalue);
g_free(wind);
APPEND_TEXT_ITEM_REAL(value);
rawvalue = get_data(conditions, data->unit_system, WIND_DIRECTION);
wind = translate_wind_direction(rawvalue);
g_free(rawvalue);
rawvalue = get_data(conditions, data->unit_system, WIND_DIRECTION_DEG);
value = g_strdup_printf("\t%s: %s (%s%s)\n", _("Direction"),
wind, rawvalue,
get_unit (data->unit_system, WIND_DIRECTION_DEG));
g_free (rawvalue);
g_free (wind);
APPEND_TEXT_ITEM_REAL (value);
get_unit(data->unit_system, WIND_DIRECTION_DEG));
g_free(rawvalue);
g_free(wind);
APPEND_TEXT_ITEM_REAL(value);
/* Precipitation */
APPEND_BTEXT (_("\nPrecipitations\n"));
/* precipitation */
APPEND_BTEXT(_("\nPrecipitations\n"));
APPEND_TEXT_ITEM(_("Precipitations amount"), PRECIPITATIONS);
/* Atmosphere */
APPEND_BTEXT (_("\nAtmosphere\n"));
APPEND_TEXT_ITEM (_("Pressure"), PRESSURE);
APPEND_TEXT_ITEM (_("Humidity"), HUMIDITY);
/* Clouds */
APPEND_BTEXT (_("\nClouds\n"));
APPEND_TEXT_ITEM (_("Fog"), FOG);
APPEND_TEXT_ITEM (_("Low clouds"), CLOUDS_LOW);
APPEND_TEXT_ITEM (_("Medium clouds"), CLOUDS_MED);
APPEND_TEXT_ITEM (_("High clouds"), CLOUDS_HIGH);
APPEND_TEXT_ITEM (_("Cloudiness"), CLOUDINESS);
APPEND_BTEXT (_("\nData from The Norwegian Meteorological Institute\n"));
value = g_strdup ("http://met.no");
/* atmosphere */
APPEND_BTEXT(_("\nAtmosphere\n"));
APPEND_TEXT_ITEM(_("Pressure"), PRESSURE);
APPEND_TEXT_ITEM(_("Humidity"), HUMIDITY);
/* clouds */
APPEND_BTEXT(_("\nClouds\n"));
APPEND_TEXT_ITEM(_("Fog"), FOG);
APPEND_TEXT_ITEM(_("Low clouds"), CLOUDS_LOW);
APPEND_TEXT_ITEM(_("Medium clouds"), CLOUDS_MED);
APPEND_TEXT_ITEM(_("High clouds"), CLOUDS_HIGH);
APPEND_TEXT_ITEM(_("Cloudiness"), CLOUDINESS);
APPEND_BTEXT(_("\nData from The Norwegian Meteorological Institute\n"));
value = g_strdup("http://met.no");
g_object_set_data_full(G_OBJECT(ltag0), "url", value, g_free);
APPEND_LINK_ITEM ("\t", _("Thanks to met.no"), "http://met.no/", ltag1);
APPEND_LINK_ITEM("\t", _("Thanks to met.no"), "http://met.no/", ltag1);
g_signal_connect(G_OBJECT(view), "motion-notify-event",
G_CALLBACK(view_motion_notify), view);
......@@ -349,11 +394,14 @@ create_summary_tab (xfceweather_data *data)
if (weather_channel_icon) {
weather_channel_evt = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(weather_channel_evt), weather_channel_icon);
gtk_text_view_add_child_in_window(GTK_TEXT_VIEW(view), weather_channel_evt,
gtk_container_add(GTK_CONTAINER(weather_channel_evt),
weather_channel_icon);
gtk_text_view_add_child_in_window(GTK_TEXT_VIEW(view),
weather_channel_evt,
GTK_TEXT_WINDOW_TEXT, 0, 0);
gtk_widget_show_all(weather_channel_evt);
adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled));
adj =
gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled));
g_signal_connect(G_OBJECT(adj), "value-changed",
G_CALLBACK(view_scrolled_cb), view);
g_signal_connect(G_OBJECT(view), "size_allocate",
......@@ -379,8 +427,11 @@ create_summary_tab (xfceweather_data *data)
return frame;
}
GtkWidget *
add_forecast_cell(GtkWidget *widget, GdkColor *color) {
add_forecast_cell(GtkWidget *widget,
GdkColor *color)
{
GtkWidget *ebox;
ebox = gtk_event_box_new();
if (color == NULL)
......@@ -393,8 +444,11 @@ add_forecast_cell(GtkWidget *widget, GdkColor *color) {
return ebox;
}
GtkWidget *
add_forecast_header(gchar *text, gdouble angle, GdkColor *color)
add_forecast_header(gchar *text,
gdouble angle,
GdkColor *color)
{
GtkWidget *label, *align;
gchar *str;
......@@ -415,8 +469,9 @@ add_forecast_header(gchar *text, gdouble angle, GdkColor *color)
return add_forecast_cell(align, color);
}
static GtkWidget *
make_forecast (xfceweather_data *data)
make_forecast(xfceweather_data *data)
{
GtkWidget *table, *ebox, *box, *align;
GtkWidget *forecast_box, *label, *image;
......@@ -426,8 +481,8 @@ make_forecast (xfceweather_data *data)
gint i, weekday, daytime;
gchar *dayname, *wind_speed, *wind_direction, *value, *rawvalue;
xml_time *fcdata;
time_t now_t = time(NULL), fcday_t;
struct tm fcday_tm;
time_t now_t = time(NULL), fcday_t;
table = gtk_table_new(data->forecast_days + 1, 5, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 0);
......@@ -454,7 +509,7 @@ make_forecast (xfceweather_data *data)
4, 5, 0, 1);
for (i = 0; i < data->forecast_days; i++) {
/* Forecast day headers */
/* forecast day headers */
fcday_tm = *localtime(&now_t);
fcday_t = time_calc_day(fcday_tm, i);
weekday = localtime(&fcday_t)->tm_wday;
......@@ -471,7 +526,7 @@ make_forecast (xfceweather_data *data)
gtk_table_attach_defaults(GTK_TABLE(table), GTK_WIDGET(ebox),
0, 1, i+1, i+2);
/* Get forecast data for each daytime */
/* get forecast data for each daytime */
for (daytime = MORNING; daytime <= NIGHT; daytime++) {
forecast_box = gtk_vbox_new(FALSE, 0);
align = gtk_alignment_new(0.5, 0.5, 1, 1);
......@@ -491,8 +546,8 @@ make_forecast (xfceweather_data *data)
image = gtk_image_new_from_pixbuf(icon);
gtk_box_pack_start(GTK_BOX(forecast_box), GTK_WIDGET(image),
TRUE, TRUE, 0);
if (G_LIKELY (icon))
g_object_unref (G_OBJECT (icon));
if (G_LIKELY(icon))
g_object_unref(G_OBJECT(icon));
rawvalue = get_data(fcdata, data->unit_system, SYMBOL);
value = g_strdup_printf("%s",
......@@ -508,28 +563,33 @@ make_forecast (xfceweather_data *data)
rawvalue = get_data(fcdata, data->unit_system, TEMPERATURE);
value = g_strdup_printf("%s %s",
rawvalue,
get_unit(data->unit_system, TEMPERATURE));
get_unit(data->unit_system,
TEMPERATURE));
g_free(rawvalue);
label = gtk_label_new(value);
gtk_box_pack_start(GTK_BOX(forecast_box), GTK_WIDGET(label),
TRUE, TRUE, 0);
g_free(value);
rawvalue = get_data(fcdata, data->unit_system, WIND_DIRECTION);
rawvalue = get_data(fcdata, data->unit_system,
WIND_DIRECTION);
wind_direction = translate_wind_direction(rawvalue);
wind_speed = get_data(fcdata, data->unit_system, WIND_SPEED);
value = g_strdup_printf("%s %s %s",
wind_direction,
wind_speed,
get_unit(data->unit_system, WIND_SPEED));
get_unit(data->unit_system,
WIND_SPEED));
g_free(wind_speed);
g_free(wind_direction);
g_free(rawvalue);
label = gtk_label_new(value);
gtk_box_pack_start(GTK_BOX(forecast_box), label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(forecast_box), label,
TRUE, TRUE, 0);
g_free(value);
gtk_widget_set_size_request(GTK_WIDGET(forecast_box), 150, -1);
gtk_widget_set_size_request(GTK_WIDGET(forecast_box),
150, -1);
}
xml_time_free(fcdata);
}
......@@ -542,9 +602,9 @@ make_forecast (xfceweather_data *data)
}
static GtkWidget *
create_forecast_tab (xfceweather_data *data, GtkWidget *window)
create_forecast_tab(xfceweather_data *data,
GtkWidget *window)
{
GtkWidget *ebox, *align, *hbox, *scrolled, *table;
GdkWindow *win;
......@@ -585,9 +645,11 @@ create_forecast_tab (xfceweather_data *data, GtkWidget *window)
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(scrolled), BORDER);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), align);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled),
align);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
if (rect.width <= 720)
gtk_widget_set_size_request(GTK_WIDGET(scrolled), 650, height_max);
else
......@@ -599,8 +661,9 @@ create_forecast_tab (xfceweather_data *data, GtkWidget *window)
}
}
static void
summary_dialog_response (GtkWidget *dlg,
summary_dialog_response(GtkWidget *dlg,
gint response,
GtkWidget *window)
{
......@@ -610,6 +673,7 @@ summary_dialog_response (GtkWidget *dlg,
g_spawn_command_line_async ("exo-open --launch WebBrowser " PLUGIN_WEBSITE, NULL);
}