summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-26 11:19:59 +0100
committerraveit65 <[email protected]>2021-01-07 18:10:25 +0100
commit7c58d22450c00649e0ff96cf10b26bcdccbc67e6 (patch)
tree334cbfe8ee48403388d816c5741ef0946acc43aa
parent9977c91b407f65ad3f3777b984155a35dc880096 (diff)
downloadmate-panel-7c58d22450c00649e0ff96cf10b26bcdccbc67e6.tar.bz2
mate-panel-7c58d22450c00649e0ff96cf10b26bcdccbc67e6.tar.xz
Local variable shadows outer variable warning reported by cppcheck
-rw-r--r--applets/notification_area/status-notifier/sn-item-v0.c10
-rw-r--r--mate-panel/libpanel-util/panel-icon-chooser.c14
-rw-r--r--mate-panel/panel-multimonitor.c50
3 files changed, 33 insertions, 41 deletions
diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c
index d218abad..16c41c9b 100644
--- a/applets/notification_area/status-notifier/sn-item-v0.c
+++ b/applets/notification_area/status-notifier/sn-item-v0.c
@@ -83,7 +83,7 @@ enum
LAST_PROP
};
-static GParamSpec *properties[LAST_PROP] = { NULL };
+static GParamSpec *obj_properties[LAST_PROP] = { NULL };
G_DEFINE_TYPE (SnItemV0, sn_item_v0, SN_TYPE_ITEM)
@@ -1345,15 +1345,15 @@ sn_item_v0_set_property (GObject *object,
static void
install_properties (GObjectClass *object_class)
{
- properties[PROP_ICON_SIZE] =
+ obj_properties[PROP_ICON_SIZE] =
g_param_spec_int ("icon-size", "Icon size", "Icon size", 0, G_MAXINT, 16,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- properties[PROP_ICON_PADDING] =
+ obj_properties[PROP_ICON_PADDING] =
g_param_spec_int ("icon-padding", "Icon padding", "Icon padding", 0,
G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties (object_class, LAST_PROP, properties);
+ g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
}
static void
@@ -1465,7 +1465,7 @@ sn_item_v0_set_icon_size (SnItemV0 *v0,
if (v0->icon_size != size)
{
v0->icon_size = size;
- g_object_notify_by_pspec (G_OBJECT (v0), properties[PROP_ICON_SIZE]);
+ g_object_notify_by_pspec (G_OBJECT (v0), obj_properties[PROP_ICON_SIZE]);
if (v0->id != NULL)
queue_update (v0);
diff --git a/mate-panel/libpanel-util/panel-icon-chooser.c b/mate-panel/libpanel-util/panel-icon-chooser.c
index 44d64908..e9f0c2ec 100644
--- a/mate-panel/libpanel-util/panel-icon-chooser.c
+++ b/mate-panel/libpanel-util/panel-icon-chooser.c
@@ -357,7 +357,6 @@ _panel_icon_chooser_clicked (GtkButton *button)
GtkWidget *filechooser;
GtkWidget *toplevel;
GtkWindow *parent;
- char *path;
gboolean filechooser_path_set;
if (chooser->priv->filechooser) {
@@ -382,15 +381,11 @@ _panel_icon_chooser_clicked (GtkButton *button)
panel_gtk_file_chooser_add_image_preview (GTK_FILE_CHOOSER (filechooser));
- path = g_build_filename (DATADIR, "icons", NULL);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (filechooser),
- path, NULL);
- g_free (path);
+ DATADIR "/icons", NULL);
- path = g_build_filename (DATADIR, "pixmaps", NULL);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (filechooser),
- path, NULL);
- g_free (path);
+ DATADIR "/pixmaps", NULL);
filechooser_path_set = FALSE;
@@ -428,14 +423,11 @@ _panel_icon_chooser_clicked (GtkButton *button)
}
if (!filechooser_path_set) {
- char *path;
/* FIXME? Use current icon theme? But there might not be a lot
* of icons there...
*/
- path = g_build_filename (DATADIR, "icons", NULL);
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filechooser),
- path);
- g_free (path);
+ DATADIR "/icons");
}
gtk_window_set_destroy_with_parent (GTK_WINDOW (filechooser), TRUE);
diff --git a/mate-panel/panel-multimonitor.c b/mate-panel/panel-multimonitor.c
index d2127436..6ef71e97 100644
--- a/mate-panel/panel-multimonitor.c
+++ b/mate-panel/panel-multimonitor.c
@@ -104,7 +104,7 @@ panel_multimonitor_get_randr_monitors (int *monitors_ret,
Window xroot;
XRRScreenResources *resources;
RROutput primary;
- GArray *geometries;
+ GArray *geometries_array;
int scale;
int i;
@@ -158,9 +158,9 @@ panel_multimonitor_get_randr_monitors (int *monitors_ret,
/* Use scale factor to bring geometries down to device pixels to support HiDPI displays */
scale = gdk_monitor_get_scale_factor (monitor);
- geometries = g_array_sized_new (FALSE, FALSE,
- sizeof (GdkRectangle),
- resources->noutput);
+ geometries_array = g_array_sized_new (FALSE, FALSE,
+ sizeof (GdkRectangle),
+ resources->noutput);
for (i = 0; i < resources->noutput; i++) {
XRROutputInfo *output;
@@ -186,9 +186,9 @@ panel_multimonitor_get_randr_monitors (int *monitors_ret,
if (_panel_multimonitor_output_should_be_first (xdisplay,
resources->outputs[i],
output, primary))
- g_array_prepend_vals (geometries, &rect, 1);
+ g_array_prepend_vals (geometries_array, &rect, 1);
else
- g_array_append_vals (geometries, &rect, 1);
+ g_array_append_vals (geometries_array, &rect, 1);
}
XRRFreeOutputInfo (output);
@@ -196,19 +196,19 @@ panel_multimonitor_get_randr_monitors (int *monitors_ret,
XRRFreeScreenResources (resources);
- if (geometries->len == 0) {
+ if (geometries_array->len == 0) {
/* This can happen in at least one case:
* https://bugzilla.novell.com/show_bug.cgi?id=543876 where all
* monitors appear disconnected (possibly because the screen
* is behing a KVM switch) -- see comment #8.
* There might be other cases too, so we stay on the safe side.
*/
- g_array_free (geometries, TRUE);
+ g_array_free (geometries_array, TRUE);
return FALSE;
}
- *monitors_ret = geometries->len;
- *geometries_ret = (GdkRectangle *) g_array_free (geometries, FALSE);
+ *monitors_ret = geometries_array->len;
+ *geometries_ret = (GdkRectangle *) g_array_free (geometries_array, FALSE);
return TRUE;
}
@@ -221,18 +221,18 @@ panel_multimonitor_get_gdk_monitors (int *monitors_ret,
{
GdkDisplay *display;
int num_monitors;
- GdkRectangle *geometries;
+ GdkRectangle *geometries_array;
int i;
display = gdk_display_get_default ();
num_monitors = gdk_display_get_n_monitors (display);
- geometries = g_new (GdkRectangle, num_monitors);
+ geometries_array = g_new (GdkRectangle, num_monitors);
for (i = 0; i < num_monitors; i++)
- gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &(geometries[i]));
+ gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &(geometries_array[i]));
*monitors_ret = num_monitors;
- *geometries_ret = geometries;
+ *geometries_ret = geometries_array;
}
static void
@@ -275,11 +275,11 @@ panel_multimonitor_compress_overlapping_monitors (int *num_monitors_in
GdkRectangle **geometries_inout)
{
int num_monitors;
- GdkRectangle *geometries;
+ GdkRectangle *geometries_array;
int i;
num_monitors = *num_monitors_inout;
- geometries = *geometries_inout;
+ geometries_array = *geometries_inout;
/* http://bugzilla.gnome.org/show_bug.cgi?id=530969
* https://bugzilla.novell.com/show_bug.cgi?id=310208
@@ -330,27 +330,27 @@ panel_multimonitor_compress_overlapping_monitors (int *num_monitors_in
long max_pixels;
int j;
- max_pixels = pixels_in_rectangle (&geometries[i]);
+ max_pixels = pixels_in_rectangle (&geometries_array[i]);
j = i + 1;
while (j < num_monitors) {
- if (rectangle_overlaps (&geometries[i],
- &geometries[j])) {
+ if (rectangle_overlaps (&geometries_array[i],
+ &geometries_array[j])) {
long pixels;
- pixels = pixels_in_rectangle (&geometries[j]);
+ pixels = pixels_in_rectangle (&geometries_array[j]);
if (pixels > max_pixels) {
max_pixels = pixels;
/* keep the maximum */
- geometries[i] = geometries[j];
+ geometries_array[i] = geometries_array[j];
}
/* Shift the remaining monitors to the left */
if (num_monitors - j - 1 > 0)
- memmove (&geometries[j],
- &geometries[j + 1],
- sizeof (geometries[0]) * (num_monitors - j - 1));
+ memmove (&geometries_array[j],
+ &geometries_array[j + 1],
+ sizeof (geometries_array[0]) * (num_monitors - j - 1));
num_monitors--;
g_assert (num_monitors > 0);
@@ -360,7 +360,7 @@ panel_multimonitor_compress_overlapping_monitors (int *num_monitors_in
}
*num_monitors_inout = num_monitors;
- *geometries_inout = geometries;
+ *geometries_inout = geometries_array;
}
static gboolean