diff options
author | Colomban Wendling <[email protected]> | 2023-11-15 15:10:11 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2024-02-04 18:37:58 +0100 |
commit | 62fabfc793b545250dafaf37f75650cbfdce095f (patch) | |
tree | 813bd86b3926f24be1f17a1830f2f3d65fd4ec8a /applets | |
parent | f98be9734446e1b620312b69dc8fa8ed0f0997d9 (diff) | |
download | mate-panel-62fabfc793b545250dafaf37f75650cbfdce095f.tar.bz2 mate-panel-62fabfc793b545250dafaf37f75650cbfdce095f.tar.xz |
Reduce scope of variables
Mostly found by cppcheck.
origin commit was:
https://github.com/mate-desktop/mate-panel/commit/96c7ebc
Diffstat (limited to 'applets')
-rw-r--r-- | applets/clock/calendar-window.c | 4 | ||||
-rw-r--r-- | applets/clock/clock.c | 15 | ||||
-rw-r--r-- | applets/notification_area/na-grid.c | 5 | ||||
-rw-r--r-- | applets/notification_area/status-notifier/sn-host-v0.c | 3 | ||||
-rw-r--r-- | applets/notification_area/status-notifier/sn-item-v0.c | 3 | ||||
-rw-r--r-- | applets/notification_area/system-tray/na-tray-manager.c | 3 |
6 files changed, 14 insertions, 19 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); diff --git a/applets/notification_area/na-grid.c b/applets/notification_area/na-grid.c index 9698be6c..9a4c45d9 100644 --- a/applets/notification_area/na-grid.c +++ b/applets/notification_area/na-grid.c @@ -317,8 +317,6 @@ na_grid_realize (GtkWidget *widget) NaGrid *self = NA_GRID (widget); GdkScreen *screen; GdkDisplay *display; - GtkOrientation orientation; - NaHost *tray_host; GSettings *settings; GTK_WIDGET_CLASS (na_grid_parent_class)->realize (widget); @@ -328,6 +326,9 @@ na_grid_realize (GtkWidget *widget) screen = gtk_widget_get_screen (GTK_WIDGET (self)); if (GDK_IS_X11_DISPLAY (display)) { + GtkOrientation orientation; + NaHost *tray_host; + orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (self)); tray_host = na_tray_new_for_screen (screen, orientation); g_object_bind_property (self, "orientation", diff --git a/applets/notification_area/status-notifier/sn-host-v0.c b/applets/notification_area/status-notifier/sn-host-v0.c index 64da5da9..4ad6b359 100644 --- a/applets/notification_area/status-notifier/sn-host-v0.c +++ b/applets/notification_area/status-notifier/sn-host-v0.c @@ -193,7 +193,6 @@ register_host_cb (GObject *source_object, GError *error; SnHostV0 *v0; gchar **items; - gint i; error = NULL; sn_watcher_v0_gen_call_register_host_finish (SN_WATCHER_V0_GEN (source_object), @@ -224,7 +223,7 @@ register_host_cb (GObject *source_object, items = sn_watcher_v0_gen_dup_registered_items (v0->watcher); if (items) { - for (i = 0; items[i] != NULL; i++) + for (gint i = 0; items[i] != NULL; i++) add_registered_item (v0, items[i]); } diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c index fd963c31..9deab9d3 100644 --- a/applets/notification_area/status-notifier/sn-item-v0.c +++ b/applets/notification_area/status-notifier/sn-item-v0.c @@ -244,7 +244,6 @@ update (SnItemV0 *v0) GtkImage *image; SnTooltip *tip; gint icon_size; - gboolean visible; const gchar *icon_name; SnIconPixmap **icon_pixmap; @@ -362,7 +361,7 @@ update (SnItemV0 *v0) /* TODO: hide "Passive" items with a setting? */ /*Special case mate-polkit*/ if (g_strcmp0 (v0->status, "password-dialog") != 0){ - visible = g_strcmp0 (v0->status, "Passive") != 0; + gboolean visible = g_strcmp0 (v0->status, "Passive") != 0; gtk_widget_set_visible (GTK_WIDGET (v0), visible); } else diff --git a/applets/notification_area/system-tray/na-tray-manager.c b/applets/notification_area/system-tray/na-tray-manager.c index d4f27ff3..2bb679d8 100644 --- a/applets/notification_area/system-tray/na-tray-manager.c +++ b/applets/notification_area/system-tray/na-tray-manager.c @@ -537,7 +537,6 @@ na_tray_manager_unmanage (NaTrayManager *manager) { #ifdef GDK_WINDOWING_X11 GdkDisplay *display; - guint32 timestamp; GtkWidget *invisible; GdkWindow *window; @@ -556,7 +555,7 @@ na_tray_manager_unmanage (NaTrayManager *manager) if (gdk_selection_owner_get_for_display (display, manager->selection_atom) == window) { - timestamp = gdk_x11_get_server_time (window); + guint32 timestamp = gdk_x11_get_server_time (window); gdk_selection_owner_set_for_display (display, NULL, manager->selection_atom, |