summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-08-04 13:11:42 +0200
committerraveit65 <[email protected]>2020-09-07 09:11:05 +0200
commit8f8b7316cc7504a4618705c562ead1ae65dabbdc (patch)
treec536e6c8079781851f2456528042e19497ee5315 /applets/clock
parent59da25f28bc2678cc38bc1def53ca1c4dbf9cc0b (diff)
downloadmate-panel-8f8b7316cc7504a4618705c562ead1ae65dabbdc.tar.bz2
mate-panel-8f8b7316cc7504a4618705c562ead1ae65dabbdc.tar.xz
Remove variableScope warnings reported by cppcheck
cppcheck --enable=all . 2> err.txt grep variableScope err.txt
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/calendar-window.c4
-rw-r--r--applets/clock/clock-location-tile.c12
-rw-r--r--applets/clock/clock-location.c5
-rw-r--r--applets/clock/clock-map.c5
-rw-r--r--applets/clock/clock.c21
-rw-r--r--applets/clock/system-timezone.c5
6 files changed, 21 insertions, 31 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index d69e0010..8fe2c77c 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -181,7 +181,6 @@ create_hig_frame (CalendarWindow *calwin,
GCallback callback)
{
GtkWidget *vbox;
- GtkWidget *label;
GtkWidget *hbox;
char *bold_title;
GtkWidget *expander;
@@ -211,9 +210,10 @@ create_hig_frame (CalendarWindow *calwin,
g_signal_connect (hbox, "add", G_CALLBACK (add_child), expander);
if (button_label) {
+ GtkWidget *label;
GtkWidget *button_box;
GtkWidget *button;
- gchar *text;
+ gchar *text;
button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (button_box);
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c
index 4e0d71a2..55bc749a 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -173,14 +173,12 @@ press_on_tile (GtkWidget *widget,
static void
make_current_cb (gpointer data, GError *error)
{
- GtkWidget *dialog;
-
if (error) {
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Failed to set the system timezone"));
+ GtkWidget *dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Failed to set the system timezone"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index 1808c0dd..9dc25e4b 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -76,10 +76,11 @@ clock_location_find_and_ref (GSList *locations,
const gchar *code)
{
GSList *l;
- ClockLocationPrivate *priv;
for (l = locations; l != NULL; l = l->next) {
- priv = clock_location_get_instance_private (l->data);
+
+ ClockLocationPrivate *priv =
+ clock_location_get_instance_private (l->data);
if (priv->latitude == latitude &&
priv->longitude == longitude &&
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 1aa2202e..fc096c60 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -430,7 +430,6 @@ clock_map_place_locations (ClockMap *this)
{
ClockMapPrivate *priv = clock_map_get_instance_private (this);
GSList *locs;
- ClockLocation *loc;
if (priv->location_map_pixbuf) {
g_object_unref (priv->location_map_pixbuf);
@@ -443,10 +442,8 @@ clock_map_place_locations (ClockMap *this)
g_signal_emit (this, signals[NEED_LOCATIONS], 0, &locs);
while (locs) {
- loc = CLOCK_LOCATION (locs->data);
-
+ ClockLocation *loc = CLOCK_LOCATION (locs->data);
clock_map_place_location (this, loc, FALSE);
-
locs = locs->next;
}
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 63c74cac..28b28ac7 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -424,7 +424,6 @@ get_updated_timeformat (ClockData *cd)
*/
char *result;
const char *time_format;
- const char *date_format;
char *clock_format;
const gchar *env_language;
const gchar *env_lc_time;
@@ -462,7 +461,7 @@ get_updated_timeformat (ClockData *cd)
* the day of the month as a decimal number is a single digit,
* it should begin with a 0 in your locale (e.g. "May 01"
* instead of "May 1"). */
- date_format = _("%a %b %e");
+ const char *date_format = _("%a %b %e");
if (use_two_line_format (cd))
/* translators: reverse the order of these arguments
@@ -1152,7 +1151,6 @@ static void
create_cities_section (ClockData *cd)
{
GSList *node;
- ClockLocationTile *city;
GSList *cities;
GSList *l;
@@ -1182,8 +1180,7 @@ create_cities_section (ClockData *cd)
for (l = node; l; l = g_slist_next (l)) {
ClockLocation *loc = l->data;
-
- city = clock_location_tile_new (loc, CLOCK_FACE_SMALL);
+ ClockLocationTile *city = clock_location_tile_new (loc, CLOCK_FACE_SMALL);
g_signal_connect (city, "tile-pressed",
G_CALLBACK (location_tile_pressed_cb), cd);
g_signal_connect (city, "need-clock-format",
@@ -1700,14 +1697,13 @@ static void
set_time_callback (ClockData *cd, GError *error)
{
GtkWidget *window;
- GtkWidget *dialog;
if (error) {
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Failed to set the system time"));
+ GtkWidget *dialog = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Failed to set the system time"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
g_signal_connect (dialog, "response",
@@ -2132,7 +2128,6 @@ static void
locations_changed (ClockData *cd)
{
GSList *l;
- ClockLocation *loc;
glong id;
if (!cd->locations) {
@@ -2150,7 +2145,7 @@ locations_changed (ClockData *cd)
}
for (l = cd->locations; l; l = l->next) {
- loc = l->data;
+ ClockLocation *loc = l->data;
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (loc), "weather-updated"));
if (id == 0) {
diff --git a/applets/clock/system-timezone.c b/applets/clock/system-timezone.c
index bed4aaaf..b1755aa9 100644
--- a/applets/clock/system-timezone.c
+++ b/applets/clock/system-timezone.c
@@ -854,11 +854,10 @@ system_timezone_is_valid (const char *tz)
static char *
system_timezone_find (void)
{
- char *tz;
- int i;
+ int i;
for (i = 0; get_system_timezone_methods[i] != NULL; i++) {
- tz = get_system_timezone_methods[i] ();
+ char *tz = get_system_timezone_methods[i] ();
if (system_timezone_is_valid (tz))
return tz;