diff options
author | rbuj <[email protected]> | 2020-12-20 19:41:23 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-01-01 01:24:31 +0100 |
commit | 45e7c98dc7793a7ced6f80e049eb747e92d47427 (patch) | |
tree | 9cda6a45befe2e93ea2ebc07f1b8842b061fb7cb | |
parent | 471cd06e802eff12f8d6116d81fd0920018a467e (diff) | |
download | mate-applets-45e7c98dc7793a7ced6f80e049eb747e92d47427.tar.bz2 mate-applets-45e7c98dc7793a7ced6f80e049eb747e92d47427.tar.xz |
mateweather: Remove conversion warnings
-rw-r--r-- | mateweather/src/mateweather-applet.c | 38 | ||||
-rw-r--r-- | mateweather/src/mateweather-pref.c | 34 | ||||
-rw-r--r-- | mateweather/src/mateweather.h | 6 |
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; |