summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mateweather/src/mateweather-applet.c38
-rw-r--r--mateweather/src/mateweather-pref.c34
-rw-r--r--mateweather/src/mateweather.h6
3 files changed, 44 insertions, 34 deletions
diff --git a/mateweather/src/mateweather-applet.c b/mateweather/src/mateweather-applet.c
index ca07d686..216571e0 100644
--- a/mateweather/src/mateweather-applet.c
+++ b/mateweather/src/mateweather-applet.c
@@ -128,7 +128,7 @@ place_widgets (MateWeatherApplet *gw_applet)
GtkRequisition req;
int total_size = 0;
gboolean horizontal = FALSE;
- int panel_size = gw_applet->size;
+ int panel_size = (int) gw_applet->size;
const gchar *temp = NULL;
const gchar *icon_name = NULL;
@@ -208,20 +208,24 @@ static void change_orient_cb (MatePanelApplet *w, MatePanelAppletOrient o, gpoin
static void size_allocate_cb(MatePanelApplet *w, GtkAllocation *allocation, gpointer data)
{
+ guint size;
MateWeatherApplet *gw_applet = (MateWeatherApplet *)data;
- if ((gw_applet->orient == MATE_PANEL_APPLET_ORIENT_LEFT) || (gw_applet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT)) {
- if (gw_applet->size == allocation->width)
- return;
- gw_applet->size = allocation->width;
- } else {
- if (gw_applet->size == allocation->height)
- return;
- gw_applet->size = allocation->height;
+ switch (gw_applet->orient) {
+ case MATE_PANEL_APPLET_ORIENT_LEFT:
+ case MATE_PANEL_APPLET_ORIENT_RIGHT:
+ size = (guint) allocation->width;
+ break;
+
+ default:
+ size = (guint) allocation->height;
}
- place_widgets(gw_applet);
- return;
+ if (gw_applet->size == size)
+ return;
+
+ gw_applet->size = size;
+ place_widgets (gw_applet);
}
static gboolean clicked_cb (GtkWidget *widget, GdkEventButton *ev, gpointer data)
@@ -294,13 +298,13 @@ applet_destroy (GtkWidget *widget, MateWeatherApplet *gw_applet)
if (gw_applet->details_dialog)
gtk_widget_destroy (gw_applet->details_dialog);
- if (gw_applet->timeout_tag > 0) {
- g_source_remove(gw_applet->timeout_tag);
+ if (gw_applet->timeout_tag != 0) {
+ g_source_remove (gw_applet->timeout_tag);
gw_applet->timeout_tag = 0;
}
- if (gw_applet->suncalc_timeout_tag > 0) {
- g_source_remove(gw_applet->suncalc_timeout_tag);
+ if (gw_applet->suncalc_timeout_tag != 0) {
+ g_source_remove (gw_applet->suncalc_timeout_tag);
gw_applet->suncalc_timeout_tag = 0;
}
@@ -410,13 +414,13 @@ update_finish (WeatherInfo *info, gpointer data)
gint nxtSunEvent;
gw_applet->timeout_tag
- = g_timeout_add_seconds (gw_applet->mateweather_pref.update_interval,
+ = g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
timeout_cb, gw_applet);
if ((info != NULL) && ((nxtSunEvent = weather_info_next_sun_event (info)) >= 0))
{
gw_applet->suncalc_timeout_tag
- = g_timeout_add_seconds (nxtSunEvent,
+ = g_timeout_add_seconds ((guint) nxtSunEvent,
suncalc_timeout_cb, gw_applet);
}
}
diff --git a/mateweather/src/mateweather-pref.c b/mateweather/src/mateweather-pref.c
index 5c087c23..c0408a68 100644
--- a/mateweather/src/mateweather-pref.c
+++ b/mateweather/src/mateweather-pref.c
@@ -170,13 +170,17 @@ static gboolean update_dialog(MateWeatherPref* pref)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_update_btn), gw_applet->mateweather_pref.update_enabled);
soft_set_sensitive(pref->priv->basic_update_spin, gw_applet->mateweather_pref.update_enabled);
- gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->basic_temp_combo), gw_applet->mateweather_pref.temperature_unit - 2);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_temp_combo),
+ (gint) gw_applet->mateweather_pref.temperature_unit - 2);
- gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->basic_speed_combo), gw_applet->mateweather_pref.speed_unit - 2);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_speed_combo),
+ (gint) gw_applet->mateweather_pref.speed_unit - 2);
- gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->basic_pres_combo), gw_applet->mateweather_pref.pressure_unit - 2);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_pres_combo),
+ (gint) gw_applet->mateweather_pref.pressure_unit - 2);
- gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->basic_dist_combo), gw_applet->mateweather_pref.distance_unit - 2);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pref->priv->basic_dist_combo),
+ (gint) gw_applet->mateweather_pref.distance_unit - 2);
#ifdef RADARMAP
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pref->priv->basic_radar_btn), gw_applet->mateweather_pref.radar_enabled);
@@ -335,12 +339,16 @@ on_auto_update_toggled (GtkToggleButton *button,
if (gw_applet->mateweather_pref.update_enabled)
{
- gw_applet->timeout_tag = g_timeout_add_seconds(gw_applet->mateweather_pref.update_interval, timeout_cb, gw_applet);
- nxtSunEvent = weather_info_next_sun_event(gw_applet->mateweather_info);
+ gw_applet->timeout_tag
+ = g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
+ timeout_cb, gw_applet);
+ nxtSunEvent = weather_info_next_sun_event (gw_applet->mateweather_info);
if (nxtSunEvent >= 0)
{
- gw_applet->suncalc_timeout_tag = g_timeout_add_seconds(nxtSunEvent, suncalc_timeout_cb, gw_applet);
+ gw_applet->suncalc_timeout_tag
+ = g_timeout_add_seconds ((guint) nxtSunEvent,
+ suncalc_timeout_cb, gw_applet);
}
}
}
@@ -536,7 +544,9 @@ on_update_interval_changed (GtkSpinButton *button,
if (gw_applet->mateweather_pref.update_enabled)
{
- gw_applet->timeout_tag = g_timeout_add_seconds(gw_applet->mateweather_pref.update_interval, timeout_cb, gw_applet);
+ gw_applet->timeout_tag
+ = g_timeout_add_seconds ((guint) gw_applet->mateweather_pref.update_interval,
+ timeout_cb, gw_applet);
}
}
@@ -592,14 +602,10 @@ static gboolean find_location(GtkTreeModel* model, GtkTreeIter* iter, const gcha
GtkTreeIter iter_parent;
gchar* aux_loc;
gboolean valid;
- int len;
+ size_t len;
- len = strlen (location);
-
- if (len <= 0)
- {
+ if ((len = strlen (location)) == 0)
return FALSE;
- }
do {
diff --git a/mateweather/src/mateweather.h b/mateweather/src/mateweather.h
index fa492849..4e4b923b 100644
--- a/mateweather/src/mateweather.h
+++ b/mateweather/src/mateweather.h
@@ -35,9 +35,9 @@ typedef struct _MateWeatherApplet {
GtkWidget* image;
MatePanelAppletOrient orient;
- gint size;
- gint timeout_tag;
- gint suncalc_timeout_tag;
+ guint size;
+ guint timeout_tag;
+ guint suncalc_timeout_tag;
/* preferences */
MateWeatherPrefs mateweather_pref;