summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-11-15 15:10:11 +0100
committerLuke from DC <[email protected]>2023-11-21 20:19:58 +0000
commit96c7ebc6dc9e8b8327db04a9570054ee78743353 (patch)
tree5d600712c7b3c035dbe78045641cdad9e358b91a /applets/clock
parent7632b4fe9bb81a440bdde64c8cc45b15e07b1de8 (diff)
downloadmate-panel-96c7ebc6dc9e8b8327db04a9570054ee78743353.tar.bz2
mate-panel-96c7ebc6dc9e8b8327db04a9570054ee78743353.tar.xz
Reduce scope of variables
Mostly found by cppcheck.
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/calendar-window.c4
-rw-r--r--applets/clock/clock.c15
2 files changed, 8 insertions, 11 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index cf6ef670..b4157344 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -543,8 +543,6 @@ void
calendar_window_set_show_weeks (CalendarWindow *calwin,
gboolean show_weeks)
{
- GtkCalendarDisplayOptions options;
-
g_return_if_fail (CALENDAR_IS_WINDOW (calwin));
if (show_weeks == calwin->priv->show_weeks)
@@ -553,6 +551,8 @@ calendar_window_set_show_weeks (CalendarWindow *calwin,
calwin->priv->show_weeks = show_weeks;
if (calwin->priv->calendar) {
+ GtkCalendarDisplayOptions options;
+
options = gtk_calendar_get_display_options (GTK_CALENDAR (calwin->priv->calendar));
if (show_weeks)
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 309d4884..f97e56af 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -2219,9 +2219,6 @@ location_set_current_cb (ClockLocation *loc,
static void
locations_changed (ClockData *cd)
{
- GSList *l;
- glong id;
-
if (!cd->locations) {
if (cd->weather_obox)
gtk_widget_hide (cd->weather_obox);
@@ -2236,8 +2233,9 @@ locations_changed (ClockData *cd)
gtk_widget_show (cd->weather_obox);
}
- for (l = cd->locations; l; l = l->next) {
+ for (GSList *l = cd->locations; l; l = l->next) {
ClockLocation *loc = l->data;
+ glong id;
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (loc), "weather-updated"));
if (id == 0) {
@@ -2514,7 +2512,6 @@ setup_gsettings (ClockData *cd)
static GSList *
parse_gsettings_cities (ClockData *cd, gchar **values)
{
- gint i;
LocationParserData data;
GMarkupParseContext *context;
@@ -2524,7 +2521,7 @@ parse_gsettings_cities (ClockData *cd, gchar **values)
context = g_markup_parse_context_new (&location_parser, 0, &data, NULL);
if (values) {
- for (i = 0; values[i]; i++) {
+ for (gint i = 0; values[i]; i++) {
g_markup_parse_context_parse (context, values[i], strlen(values[i]), NULL);
}
}
@@ -2589,11 +2586,11 @@ system_manager_signal_cb (GDBusProxy *proxy,
GVariant *parameters,
ClockData *cd)
{
- GVariant *variant;
- gboolean active;
-
if (g_strcmp0 (signal_name, "PrepareForSleep") == 0)
{
+ GVariant *variant;
+ gboolean active;
+
variant = g_variant_get_child_value (parameters, 0);
active = g_variant_get_boolean (variant);
g_variant_unref (variant);