Commit fab44dfe authored by Sean Davis's avatar Sean Davis 🕶

Fix full debug builds except for symbol_names declaration

parent 99c7f228
......@@ -490,7 +490,6 @@ text_timezone_changed(const GtkWidget *entry,
static void
create_location_page(xfceweather_dialog *dialog)
{
GtkWidget *palign, *page, *hbox, *vbox, *label, *image, *sep;
GtkWidget *button_loc_change;
/* location name */
......@@ -860,8 +859,6 @@ combo_apparent_temperature_changed(GtkWidget *combo,
static void
create_units_page(xfceweather_dialog *dialog)
{
GtkWidget *palign, *page, *hbox, *vbox, *label, *sep;
/* temperature */
dialog->combo_unit_temperature = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "combo_unit_temperature"));
......@@ -1036,12 +1033,9 @@ check_round_values_toggled(GtkWidget *button,
static void
create_appearance_page(xfceweather_dialog *dialog)
{
GtkWidget *palign, *page, *sep, *hbox, *vbox, *label, *image;
GtkSizeGroup *sg;
GtkSettings *default_settings;
icon_theme *theme;
gchar *text;
gint i;
guint i;
/* icon theme */
dialog->combo_icon_theme = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "combo_icon_theme"));
......@@ -1539,13 +1533,12 @@ check_scrollbox_animate_toggled(GtkWidget *button,
static void
create_scrollbox_page(xfceweather_dialog *dialog)
{
GtkWidget *palign, *page, *hbox, *table, *scroll, *label, *image, *sep;
GtkSizeGroup *sg_misc, *sg_button;
GtkWidget *button;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
data_types type;
gint i, n;
guint i;
gint n;
/* show scrollbox */
dialog->check_scrollbox_show = GTK_WIDGET (gtk_builder_get_object (GTK_BUILDER (dialog->builder), "check_scrollbox_show"));
......@@ -1645,7 +1638,7 @@ setup_units(xfceweather_dialog *dialog,
}
void
static void
setup_notebook_signals(xfceweather_dialog *dialog)
{
/* location page */
......
......@@ -667,11 +667,13 @@ interpolate_gchar_value(gchar *value_start,
val_start = string_to_double(value_start, 0);
val_end = string_to_double(value_end, 0);
if (radian)
if (radian) {
if (val_end > val_start && val_end - val_start > 180)
val_start += 360;
else if (val_start > val_end && val_start - val_end > 180)
val_end += 360;
}
val_result = interpolate_value(val_start, val_end,
start_t, end_t, between_t);
if (radian && val_result >= 360)
......@@ -912,7 +914,7 @@ astrodata_clean(GArray *astrodata)
{
xml_astro *astro;
time_t now_t = time(NULL);
gint i;
guint i;
if (G_UNLIKELY(astrodata == NULL))
return;
......@@ -989,9 +991,9 @@ find_smallest_interval(xml_weather *wd,
{
GArray *before = pdr->before, *after = pdr->after;
xml_time *ts_before, *ts_after, *found;
gint i, j;
guint i, j;
for (i = before->len - 1; i >= 0; i--) {
for (i = before->len - 1; i > 0; i--) {
ts_before = g_array_index(before, xml_time *, i);
for (j = 0; j < after->len; j++) {
ts_after = g_array_index(after, xml_time *, j);
......@@ -1009,7 +1011,7 @@ find_smallest_incomplete_interval(xml_weather *wd,
time_t end_t)
{
xml_time *timeslice, *found = NULL;
gint i;
guint i;
weather_debug("Searching for the smallest incomplete interval.");
/* search for all timeslices with interval data that have end time end_t */
......@@ -1031,37 +1033,6 @@ find_smallest_incomplete_interval(xml_weather *wd,
}
/*
* Given an array of point data, find two points for which
* corresponding interval data can be found so that the interval is as
* big as possible, returning NULL if such interval data doesn't
* exist.
*/
static xml_time *
find_largest_interval(xml_weather *wd,
const point_data_results *pdr)
{
GArray *before = pdr->before, *after = pdr->after;
xml_time *ts_before = NULL, *ts_after = NULL, *found = NULL;
gint i, j;
for (i = before->len - 1; i >= 0; i--) {
ts_before = g_array_index(before, xml_time *, i);
for (j = after->len - 1; j >= 0; j--) {
ts_after = g_array_index(after, xml_time *, j);
found = get_timeslice(wd, ts_before->start, ts_after->end, NULL);
if (found) {
weather_debug("Found biggest interval:");
weather_dump(weather_dump_timeslice, found);
return found;
}
}
}
weather_debug("Could not find interval.");
return NULL;
}
/* find point data within certain limits around a point in time */
static point_data_results *
find_point_data(const xml_weather *wd,
......@@ -1072,7 +1043,7 @@ find_point_data(const xml_weather *wd,
point_data_results *found;
xml_time *timeslice;
gdouble diff;
gint i;
guint i;
found = g_slice_new0(point_data_results);
found->before = g_array_new(FALSE, TRUE, sizeof(xml_time *));
......@@ -1180,7 +1151,7 @@ get_astro_data_for_day(const GArray *astrodata,
{
xml_astro *astro;
time_t day_t = time(NULL);
gint i;
guint i;
if (G_UNLIKELY(astrodata == NULL))
return NULL;
......@@ -1207,7 +1178,7 @@ get_point_data_for_day(xml_weather *wd,
GArray *found;
xml_time *timeslice;
time_t day_t = time(NULL);
gint i;
guint i;
day_t = day_at_midnight(day_t, day);
......@@ -1250,7 +1221,8 @@ make_forecast_data(xml_weather *wd,
xml_time *ts1, *ts2, *interval = NULL;
struct tm point_tm, start_tm, end_tm, tm1, tm2;
time_t point_t, start_t, end_t;
gint min = 0, max = 0, point = 0, i, j;
gint min = 0, max = 0, point = 0;
guint i, j;
g_assert(wd != NULL);
if (G_UNLIKELY(wd == NULL))
......
......@@ -32,6 +32,8 @@
#define YESNO(bool) ((bool) ? "yes" : "no")
#if GLIB_CHECK_VERSION(2,32,0)
#else
static void
weather_dummy_log_handler(const gchar *log_domain,
const GLogLevelFlags log_level,
......@@ -40,11 +42,12 @@ weather_dummy_log_handler(const gchar *log_domain,
{
/* Swallow all messages */
}
#endif
void
weather_debug_init(const gchar *log_domain,
const gboolean debug_mode)
const gboolean w_debug_mode)
{
/*
* GLIB >= 2.32 only shows debug messages if G_MESSAGES_DEBUG contains the
......@@ -56,7 +59,7 @@ weather_debug_init(const gchar *log_domain,
gchar *debug_env_new;
gint i = 0, j = 0;
if (debug_mode) {
if (w_debug_mode) {
debug_env = g_getenv("G_MESSAGES_DEBUG");
if (log_domain == NULL)
......@@ -77,7 +80,7 @@ weather_debug_init(const gchar *log_domain,
g_free(debug_env_new_array[j++]);
}
#else
if (!debug_mode) {
if (!w_debug_mode) {
g_log_set_handler(log_domain, G_LOG_LEVEL_DEBUG,
weather_dummy_log_handler, NULL);
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
......@@ -207,7 +210,7 @@ weather_dump_astrodata(const GArray *astrodata)
GString *out;
gchar *result, *line;
xml_astro *astro;
gint i;
guint i;
if (!astrodata || astrodata->len <= 0)
return g_strdup("No astronomical data available.");
......@@ -371,7 +374,7 @@ weather_dump_weatherdata(const xml_weather *wd)
GString *out;
xml_time *timeslice;
gchar *result, *tmp;
gint i;
guint i;
if (G_UNLIKELY(wd == NULL))
return g_strdup("No weather data.");
......
......@@ -43,9 +43,9 @@ G_BEGIN_DECLS
#define weather_dump(func, data) \
if (G_UNLIKELY(debug_mode)) { \
gchar *msg = func(data); \
weather_debug("%s", msg); \
g_free(msg); \
gchar *dump_msg = func(data); \
weather_debug("%s", dump_msg); \
g_free(dump_msg); \
}
void weather_debug_init(const gchar *log_domain,
......
......@@ -43,7 +43,7 @@ icon_missing(const icon_theme *theme,
const gchar *suffix)
{
gchar *missing, *icon;
gint i;
guint i;
icon = g_strconcat(sizedir, G_DIR_SEPARATOR_S, symbol_name, suffix, NULL);
for (i = 0; i < theme->missing_icons->len; i++) {
......@@ -347,7 +347,7 @@ find_themes_in_dir(const gchar *path)
if (dir) {
themes = g_array_new(FALSE, TRUE, sizeof(icon_theme *));
while (dirname = g_dir_read_name(dir)) {
while ((dirname = g_dir_read_name(dir))) {
themedir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
path, dirname);
theme = icon_theme_load_info(themedir);
......
......@@ -78,7 +78,7 @@ get_timeslice(xml_weather *wd,
guint *index)
{
xml_time *timeslice;
gint i;
guint i;
g_assert(wd != NULL);
if (G_UNLIKELY(wd == NULL))
......@@ -103,7 +103,7 @@ get_astro(const GArray *astrodata,
guint *index)
{
xml_astro *astro;
gint i;
guint i;
g_assert(astrodata != NULL);
if (G_UNLIKELY(astrodata == NULL))
......@@ -598,15 +598,17 @@ parse_timezone(xmlNode *cur_node)
xmlDoc *
get_xml_document(SoupMessage *msg)
{
if (G_LIKELY(msg && msg->response_body && msg->response_body->data))
if (G_LIKELY(msg && msg->response_body && msg->response_body->data)) {
if (g_utf8_validate(msg->response_body->data, -1, NULL)) {
/* force parsing as UTF-8, the XML encoding header may lie */
return xmlReadMemory(msg->response_body->data,
strlen(msg->response_body->data),
NULL, "UTF-8", 0);
} else
} else {
return xmlParseMemory(msg->response_body->data,
strlen(msg->response_body->data));
}
}
return NULL;
}
......@@ -774,7 +776,7 @@ void
xml_weather_free(xml_weather *wd)
{
xml_time *timeslice;
gint i;
guint i;
g_assert(wd != NULL);
if (G_UNLIKELY(wd == NULL))
......@@ -800,7 +802,7 @@ xml_weather_clean(xml_weather *wd)
{
xml_time *timeslice;
time_t now_t = time(NULL);
gint i;
guint i;
if (G_UNLIKELY(wd == NULL || wd->timeslices == NULL))
return;
......@@ -834,7 +836,7 @@ void
astrodata_free(GArray *astrodata)
{
xml_astro *astro;
gint i;
guint i;
if (G_UNLIKELY(astrodata == NULL))
return;
......
......@@ -208,7 +208,7 @@ gtk_scrollbox_draw_event(GtkWidget *widget,
{
GtkScrollbox *self = GTK_SCROLLBOX(widget);
PangoLayout *layout;
gint width, height;
gint height;
PangoRectangle logical_rect;
gboolean result = FALSE;
PangoMatrix matrix = PANGO_MATRIX_INIT;
......@@ -229,20 +229,12 @@ gtk_scrollbox_draw_event(GtkWidget *widget,
gtk_widget_get_allocation (GTK_WIDGET (widget), &allocation);
if (self->orientation == GTK_ORIENTATION_HORIZONTAL) {
width = allocation.x
+ (allocation.width
- PANGO_PIXELS(logical_rect.width)) / 2;
height = allocation.y
+ (allocation.height
- PANGO_PIXELS(logical_rect.height)) / 2
+ (self->fade == FADE_IN || self->fade == FADE_OUT
? self->offset : 0);
} else {
width = allocation.x
+ (allocation.width
- PANGO_PIXELS(logical_rect.height)) / 2
+ (self->fade == FADE_IN || self->fade == FADE_OUT
? self->offset : 0);
height = allocation.y
+ (allocation.height
- PANGO_PIXELS(logical_rect.width)) / 2;
......
......@@ -851,17 +851,16 @@ static GtkWidget *
add_forecast_cell(plugin_data *data,
GArray *daydata,
gint day,
gint daytime)
gint time_of_day)
{
GtkWidget *box, *label, *image;
GdkPixbuf *icon;
const GdkColor black = {0, 0x0000, 0x0000, 0x0000};
gchar *wind_speed, *wind_direction, *value, *rawvalue;
xml_time *fcdata;
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
fcdata = make_forecast_data(data->weatherdata, daydata, day, daytime);
fcdata = make_forecast_data(data->weatherdata, daydata, day, time_of_day);
if (fcdata == NULL)
return box;
......@@ -873,7 +872,7 @@ add_forecast_cell(plugin_data *data,
/* symbol */
rawvalue = get_data(fcdata, data->units, SYMBOL,
FALSE, data->night_time);
icon = get_icon(data->icon_theme, rawvalue, 48, (daytime == NIGHT));
icon = get_icon(data->icon_theme, rawvalue, 48, (time_of_day == NIGHT));
g_free(rawvalue);
image = gtk_image_new_from_pixbuf(icon);
gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(image), TRUE, TRUE, 0);
......@@ -884,7 +883,7 @@ add_forecast_cell(plugin_data *data,
rawvalue = get_data(fcdata, data->units, SYMBOL,
FALSE, data->night_time);
value = g_strdup_printf("%s",
translate_desc(rawvalue, (daytime == NIGHT)));
translate_desc(rawvalue, (time_of_day == NIGHT)));
g_free(rawvalue);
label = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(label), value);
......@@ -934,8 +933,8 @@ make_forecast(plugin_data *data)
GArray *daydata;
xml_astro *astro;
gchar *dayname, *text;
gint i;
daytime daytime;
guint i;
daytime time_of_day;
GdkScreen *screen = gdk_screen_get_default ();
GtkCssProvider *provider = gtk_css_provider_new ();
......@@ -989,8 +988,8 @@ make_forecast(plugin_data *data)
daydata = get_point_data_for_day(data->weatherdata, i);
/* get forecast data for each daytime */
for (daytime = MORNING; daytime <= NIGHT; daytime++) {
forecast_box = add_forecast_cell(data, daydata, i, daytime);
for (time_of_day = MORNING; time_of_day <= NIGHT; time_of_day++) {
forecast_box = add_forecast_cell(data, daydata, i, time_of_day);
weather_widget_set_border_width (GTK_WIDGET (forecast_box), 4);
gtk_widget_set_hexpand (GTK_WIDGET (forecast_box), TRUE);
gtk_widget_set_vexpand (GTK_WIDGET (forecast_box), TRUE);
......@@ -1003,11 +1002,11 @@ make_forecast(plugin_data *data)
if (data->forecast_layout == FC_LAYOUT_CALENDAR)
gtk_grid_attach (GTK_GRID (grid),
GTK_WIDGET(ebox),
i+1, 1+daytime, 1, 1);
i+1, 1+time_of_day, 1, 1);
else
gtk_grid_attach (GTK_GRID (grid),
GTK_WIDGET(ebox),
1+daytime, i+1, 1, 1);
1+time_of_day, i+1, 1, 1);
}
g_array_free(daydata, FALSE);
}
......
......@@ -143,7 +143,7 @@ static const symbol_desc symbol_to_desc[] = {
* for a list of symbols. For a list of symbols with descriptions,
* see http://om.yr.no/forklaring/symbol.
*/
gint
static gint
replace_symbol_id(gint id)
{
/* Symbol ids greater than 100 are used for indicating polar
......@@ -186,7 +186,7 @@ replace_symbol_id(gint id)
const gchar *
get_symbol_for_id(gint id)
get_symbol_for_id(guint id)
{
if (G_UNLIKELY(id < 1))
return NODATA;
......@@ -205,14 +205,16 @@ const gchar *
translate_desc(const gchar *desc,
const gboolean nighttime)
{
gint i;
guint i;
for (i = 0; i < NUM_SYMBOLS; i++)
if (!strcmp(desc, symbol_to_desc[i].symbol))
for (i = 0; i < NUM_SYMBOLS; i++) {
if (!strcmp(desc, symbol_to_desc[i].symbol)) {
if (nighttime)
return _(symbol_to_desc[i].night_desc);
else
return _(symbol_to_desc[i].desc);
}
}
return desc;
}
......@@ -220,11 +222,13 @@ translate_desc(const gchar *desc,
const gchar *
translate_moon_phase(const gchar *moon_phase)
{
gint i;
guint i;
for (i = 0; i < NUM_MOON_PHASES; i++)
if (!strcmp(moon_phase, moon_phases[i]))
for (i = 0; i < NUM_MOON_PHASES; i++) {
if (!strcmp(moon_phase, moon_phases[i])) {
return _(moon_phases[i]);
}
}
return moon_phase;
}
......
......@@ -24,7 +24,7 @@
G_BEGIN_DECLS
const gchar *get_symbol_for_id(gint id);
const gchar *get_symbol_for_id(guint id);
const gchar *translate_desc(const gchar *desc,
gboolean nighttime);
......
......@@ -324,7 +324,7 @@ update_scrollbox(plugin_data *data,
GString *out;
gchar *label = NULL;
data_types type;
gint i = 0, j = 0;
guint i = 0, j = 0;
gtk_scrollbox_clear_new(GTK_SCROLLBOX(data->scrollbox));
if (data->weatherdata && data->weatherdata->current_conditions) {
......@@ -792,6 +792,21 @@ constrain_to_limits(gint *i,
}
static void
constrain_to_ulimits(guint *i,
const guint min,
const guint max)
{
g_assert(i != NULL);
if (G_UNLIKELY(i == NULL))
return;
if (*i < min)
*i = min;
if (*i > max)
*i = max;
}
static void
xfceweather_read_config(XfcePanelPlugin *plugin,
plugin_data *data)
......@@ -881,7 +896,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
data->forecast_days = xfce_rc_read_int_entry(rc, "forecast_days",
DEFAULT_FORECAST_DAYS);
constrain_to_limits(&data->forecast_days, 1, MAX_FORECAST_DAYS);
constrain_to_ulimits(&data->forecast_days, 1, MAX_FORECAST_DAYS);
value = xfce_rc_read_entry(rc, "theme_dir", NULL);
if (data->icon_theme)
......@@ -891,7 +906,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
data->show_scrollbox = xfce_rc_read_bool_entry(rc, "show_scrollbox", TRUE);
data->scrollbox_lines = xfce_rc_read_int_entry(rc, "scrollbox_lines", 1);
constrain_to_limits(&data->scrollbox_lines, 1, MAX_SCROLLBOX_LINES);
constrain_to_ulimits(&data->scrollbox_lines, 1, MAX_SCROLLBOX_LINES);
value = xfce_rc_read_entry(rc, "scrollbox_font", NULL);
if (value) {
......@@ -933,7 +948,7 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
XfceRc *rc;
gchar label[10];
gchar *file, *value;
gint i;
guint i;
if (!(file = xfce_panel_plugin_save_location(plugin, TRUE)))
return;
......@@ -1050,7 +1065,7 @@ write_cache_file(plugin_data *data)
gchar *file, *start, *end, *point, *now, *value;
gchar *date_format = "%Y-%m-%dT%H:%M:%SZ";
time_t now_t = time(NULL);
gint i, j;
guint i, j;
file = make_cache_filename(data);
if (G_UNLIKELY(file == NULL))
......@@ -1169,7 +1184,7 @@ static void
read_cache_file(plugin_data *data)
{
GKeyFile *keyfile;
GError **err;
GError *err = NULL;
xml_weather *wd;
xml_time *timeslice = NULL;
xml_location *loc = NULL;
......@@ -1216,10 +1231,10 @@ read_cache_file(plugin_data *data)
"reading cache file aborted.");
return;
}
msl = g_key_file_get_integer(keyfile, group, "msl", err);
msl = g_key_file_get_integer(keyfile, group, "msl", &err);
if (!err)
num_timeslices = g_key_file_get_integer(keyfile, group,
"timeslices", err);
"timeslices", &err);
if (err || strcmp(lat, data->lat) || strcmp(lon, data->lon) ||
msl != data->msl || num_timeslices < 1) {
CACHE_FREE_VARS();
......@@ -1599,7 +1614,7 @@ xfceweather_dialog_response(GtkWidget *dlg,
plugin_data *data = (plugin_data *) dialog->pd;
icon_theme *theme;
gboolean result;
gint i;
guint i;
if (response == GTK_RESPONSE_HELP) {
/* show help */
......@@ -1822,7 +1837,7 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
SoupURI *soup_proxy_uri;
const gchar *proxy_uri;
const gchar *proxy_user;
GtkWidget *refresh, *refresh_icon;
GtkWidget *refresh;
GdkPixbuf *icon = NULL;
data_types lbl;
......@@ -1930,9 +1945,6 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
/* add refresh button to right click menu, for people who missed
the middle mouse click feature */
refresh = gtk_menu_item_new_with_mnemonic(_("Re_fresh"));
refresh_icon = gtk_image_new_from_icon_name("view-refresh",
GTK_ICON_SIZE_MENU);
//gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(refresh), refresh_icon);
gtk_widget_show(refresh);
g_signal_connect(G_OBJECT(refresh), "activate",
G_CALLBACK(mi_click), data);
......
......@@ -86,7 +86,7 @@ typedef struct {
gint panel_size;
guint panel_rows;
GtkOrientation panel_orientation;
XfcePanelPluginMode panel_orientation;
gboolean single_row;
xml_weather *weatherdata;
GArray *astrodata;
......@@ -102,7 +102,7 @@ typedef struct {
GtkWidget *scrollbox;
gboolean show_scrollbox;
gint scrollbox_lines;
guint scrollbox_lines;
gchar *scrollbox_font;
GdkRGBA scrollbox_color;
gboolean scrollbox_use_color;
......@@ -123,7 +123,7 @@ typedef struct {
icon_theme *icon_theme;
tooltip_styles tooltip_style;
forecast_layouts forecast_layout;
gint forecast_days;
guint forecast_days;
gboolean round;
} plugin_data;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment