summaryrefslogtreecommitdiff
path: root/applets/wncklet/workspace-switcher.c
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/wncklet/workspace-switcher.c
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/wncklet/workspace-switcher.c')
-rw-r--r--applets/wncklet/workspace-switcher.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 4d74856b..9d5a210e 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -673,14 +673,13 @@ static void num_rows_value_changed(GtkSpinButton* button, PagerData* pager)
static void update_workspaces_model(PagerData* pager)
{
- int nr_ws, i;
- WnckWorkspace* workspace;
- GtkTreeIter iter;
-
- nr_ws = wnck_screen_get_workspace_count(pager->screen);
+ int nr_ws = wnck_screen_get_workspace_count (pager->screen);
if (pager->properties_dialog)
{
+ int i;
+ GtkTreeIter iter;
+
if (nr_ws != gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin)))
gtk_spin_button_set_value(GTK_SPIN_BUTTON(pager->num_workspaces_spin), nr_ws);
@@ -688,7 +687,7 @@ static void update_workspaces_model(PagerData* pager)
for (i = 0; i < nr_ws; i++)
{
- workspace = wnck_screen_get_workspace(pager->screen, i);
+ WnckWorkspace *workspace = wnck_screen_get_workspace(pager->screen, i);
gtk_list_store_append(pager->workspaces_store, &iter);
gtk_list_store_set(pager->workspaces_store, &iter, 0, wnck_workspace_get_name(workspace), -1);
}
@@ -697,12 +696,9 @@ static void update_workspaces_model(PagerData* pager)
static void workspace_renamed(WnckWorkspace* space, PagerData* pager)
{
- int i;
GtkTreeIter iter;
- i = wnck_workspace_get_number(space);
-
- if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(pager->workspaces_store), &iter, NULL, i))
+ if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (pager->workspaces_store), &iter, NULL, wnck_workspace_get_number (space)))
gtk_list_store_set(pager->workspaces_store, &iter, 0, wnck_workspace_get_name(space), -1);
}