summaryrefslogtreecommitdiff
path: root/mate-panel
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2024-01-28 02:53:56 +0100
committerraveit65 <[email protected]>2024-02-04 18:37:58 +0100
commite663fbaeba760003b4088e567af0883534891e59 (patch)
treefd7b6805cc5d0e022f526e6343bb2539aa12f54e /mate-panel
parent6a9848eb8388807d13c38cdaceabfc143f6640aa (diff)
downloadmate-panel-e663fbaeba760003b4088e567af0883534891e59.tar.bz2
mate-panel-e663fbaeba760003b4088e567af0883534891e59.tar.xz
Revert "Reduce scope of variables"
This reverts commit 96c7ebc6dc9e8b8327db04a9570054ee78743353.
Diffstat (limited to 'mate-panel')
-rw-r--r--mate-panel/button-widget.c6
-rw-r--r--mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c13
-rw-r--r--mate-panel/libpanel-util/panel-color.c8
-rw-r--r--mate-panel/libpanel-util/panel-gtk.c3
-rw-r--r--mate-panel/libpanel-util/panel-keyfile.c5
-rw-r--r--mate-panel/mate-desktop-item-edit.c3
-rw-r--r--mate-panel/panel-lockdown.c8
-rw-r--r--mate-panel/panel-menu-items.c24
-rw-r--r--mate-panel/panel-multimonitor.c3
-rw-r--r--mate-panel/panel-profile.c4
-rw-r--r--mate-panel/panel-test-applets.c5
-rw-r--r--mate-panel/panel-widget.c9
12 files changed, 51 insertions, 40 deletions
diff --git a/mate-panel/button-widget.c b/mate-panel/button-widget.c
index 00753b99..43d432a9 100644
--- a/mate-panel/button-widget.c
+++ b/mate-panel/button-widget.c
@@ -161,6 +161,8 @@ button_widget_unset_surfaces (ButtonWidget *button)
static void
button_widget_reload_surface (ButtonWidget *button)
{
+ GdkDisplay *display;
+ gint scale;
button_widget_unset_surfaces (button);
button->priv->needs_move = FALSE;
@@ -168,9 +170,7 @@ button_widget_reload_surface (ButtonWidget *button)
return;
if (button->priv->filename != NULL && button->priv->filename [0] != '\0') {
- GdkDisplay *display;
- gint scale;
- char *error = NULL;
+ char *error = NULL;
/* icons findable in the icon theme can be handled by gtk directly*/
display = gdk_display_get_default ();
scale = gtk_widget_get_scale_factor (GTK_WIDGET (button));
diff --git a/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c b/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
index b65fe4a7..115919b0 100644
--- a/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
+++ b/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
@@ -159,6 +159,7 @@ mate_panel_applets_manager_get_applet_factory_info_from_file (const gchar *filen
{
MatePanelAppletFactoryInfo *info;
GKeyFile *applet_file;
+ const char *lib_prefix;
gchar **groups;
gsize n_groups;
gsize i;
@@ -188,8 +189,6 @@ mate_panel_applets_manager_get_applet_factory_info_from_file (const gchar *filen
info->in_process = g_key_file_get_boolean (applet_file, MATE_PANEL_APPLET_FACTORY_GROUP,
"InProcess", NULL);
if (info->in_process) {
- const char *lib_prefix;
-
info->location = g_key_file_get_string (applet_file, MATE_PANEL_APPLET_FACTORY_GROUP,
"Location", NULL);
if (!info->location) {
@@ -336,15 +335,15 @@ applets_directory_changed (GFileMonitor *monitor,
static void
mate_panel_applets_manager_dbus_load_applet_infos (MatePanelAppletsManagerDBus *manager)
{
- GSList *dirs;
+ GSList *dirs, *d;
+ GDir *dir;
+ const gchar *dirent;
+ GError *error = NULL;
dirs = mate_panel_applets_manager_get_applets_dirs ();
- for (GSList *d = dirs; d; d = g_slist_next (d)) {
- GDir *dir;
- const gchar *dirent;
+ for (d = dirs; d; d = g_slist_next (d)) {
GFileMonitor *monitor;
GFile *dir_file;
- GError *error = NULL;
gchar *path = (gchar *) d->data;
dir = g_dir_open (path, 0, &error);
diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c
index 661e6fb5..f6148aaa 100644
--- a/mate-panel/libpanel-util/panel-color.c
+++ b/mate-panel/libpanel-util/panel-color.c
@@ -17,6 +17,7 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b)
gdouble green;
gdouble blue;
gdouble h, l, s;
+ gdouble delta;
red = *r;
green = *g;
@@ -49,8 +50,6 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b)
h = 0;
if (max != min) {
- gdouble delta;
-
if (l <= 0.5)
s = (max - min) / (max + min);
else
@@ -85,9 +84,11 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b)
static void
hls_to_rgb (gdouble *h, gdouble *l, gdouble *s)
{
+ gdouble hue;
gdouble lightness;
gdouble saturation;
gdouble m1, m2;
+ gdouble r, g, b;
lightness = *l;
saturation = *s;
@@ -103,9 +104,6 @@ hls_to_rgb (gdouble *h, gdouble *l, gdouble *s)
*l = lightness;
*s = lightness;
} else {
- gdouble hue;
- gdouble r, g, b;
-
hue = *h + 120;
while (hue > 360)
hue -= 360;
diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c
index 3672fca8..d638d75d 100644
--- a/mate-panel/libpanel-util/panel-gtk.c
+++ b/mate-panel/libpanel-util/panel-gtk.c
@@ -119,6 +119,7 @@ panel_file_chooser_dialog_new_valist (const gchar *title,
{
GtkWidget *result;
const char *button_text = first_button_text;
+ gint response_id;
result = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
"title", title,
@@ -130,7 +131,7 @@ panel_file_chooser_dialog_new_valist (const gchar *title,
while (button_text)
{
- gint response_id = va_arg (varargs, gint);
+ response_id = va_arg (varargs, gint);
if (g_strcmp0 (button_text, "process-stop") == 0)
panel_dialog_add_button (GTK_DIALOG (result), _("_Cancel"), button_text, response_id);
diff --git a/mate-panel/libpanel-util/panel-keyfile.c b/mate-panel/libpanel-util/panel-keyfile.c
index b98058c3..0b0104ef 100644
--- a/mate-panel/libpanel-util/panel-keyfile.c
+++ b/mate-panel/libpanel-util/panel-keyfile.c
@@ -53,6 +53,8 @@ _panel_key_file_make_executable (const gchar *path)
{
GFile *file;
GFileInfo *info;
+ guint32 current_perms;
+ guint32 new_perms;
file = g_file_new_for_path (path);
@@ -70,9 +72,6 @@ _panel_key_file_make_executable (const gchar *path)
}
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) {
- guint32 current_perms;
- guint32 new_perms;
-
current_perms = g_file_info_get_attribute_uint32 (info,
G_FILE_ATTRIBUTE_UNIX_MODE);
new_perms = current_perms | S_IXGRP | S_IXUSR | S_IXOTH;
diff --git a/mate-panel/mate-desktop-item-edit.c b/mate-panel/mate-desktop-item-edit.c
index b37f43ed..b0912405 100644
--- a/mate-panel/mate-desktop-item-edit.c
+++ b/mate-panel/mate-desktop-item-edit.c
@@ -123,6 +123,7 @@ main (int argc, char * argv[])
for (i = 0; desktops[i] != NULL; i++) {
GFile *file;
GFileInfo *info;
+ GFileType type;
char *uri;
char *path;
GtkWidget *dlg = NULL;
@@ -135,7 +136,7 @@ main (int argc, char * argv[])
g_object_unref (file);
if (info) {
- GFileType type = g_file_info_get_file_type (info);
+ type = g_file_info_get_file_type (info);
if (type == G_FILE_TYPE_DIRECTORY && create_new) {
diff --git a/mate-panel/panel-lockdown.c b/mate-panel/panel-lockdown.c
index 8750be81..16648ee3 100644
--- a/mate-panel/panel-lockdown.c
+++ b/mate-panel/panel-lockdown.c
@@ -269,10 +269,12 @@ panel_lockdown_get_disable_force_quit (void)
gboolean
panel_lockdown_is_applet_disabled (const char *iid)
{
+ gint i;
+
g_assert (panel_lockdown.initialized != FALSE);
if (panel_lockdown.disabled_applets)
- for (gint i = 0; panel_lockdown.disabled_applets[i]; i++)
+ for (i = 0; panel_lockdown.disabled_applets[i]; i++)
if (!strcmp (panel_lockdown.disabled_applets[i], iid))
return TRUE;
@@ -284,7 +286,9 @@ panel_lockdown_notify_find (GSList *closures,
GCallback callback_func,
gpointer user_data)
{
- for (GSList *l = closures; l; l = l->next) {
+ GSList *l;
+
+ for (l = closures; l; l = l->next) {
GCClosure *cclosure = l->data;
GClosure *closure = l->data;
diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c
index 14b58701..05af4969 100644
--- a/mate-panel/panel-menu-items.c
+++ b/mate-panel/panel-menu-items.c
@@ -143,6 +143,7 @@ panel_menu_items_append_from_desktop (GtkWidget *menu,
char *uri;
char *type;
gboolean is_application;
+ char *tryexec;
char *icon;
char *name;
char *comment;
@@ -197,7 +198,7 @@ panel_menu_items_append_from_desktop (GtkWidget *menu,
g_free (type);
if (is_application) {
- char *tryexec = panel_key_file_get_string (key_file, "TryExec");
+ tryexec = panel_key_file_get_string (key_file, "TryExec");
if (tryexec) {
char *prog;
@@ -408,6 +409,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu, guint max_items_or_
char *line = (char*) l->data;
if (line[0] && !g_hash_table_lookup (table, line)) {
+ GFile *file;
char *space;
char *label;
gboolean keep;
@@ -428,7 +430,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu, guint max_items_or_
keep = TRUE;
if (!keep) {
- GFile *file = g_file_new_for_uri (line);
+ file = g_file_new_for_uri (line);
keep = !g_file_is_native (file) ||
g_file_query_exists (file, NULL);
g_object_unref (file);
@@ -542,16 +544,15 @@ drive_poll_for_media_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- GError *error;
+ GdkScreen *screen;
+ GError *error;
+ char *primary;
+ char *name;
error = NULL;
if (!g_drive_poll_for_media_finish (G_DRIVE (source_object),
res, &error)) {
if (error->code != G_IO_ERROR_FAILED_HANDLED) {
- GdkScreen *screen;
- char *primary;
- char *name;
-
screen = GDK_SCREEN (user_data);
name = g_drive_get_name (G_DRIVE (source_object));
@@ -632,10 +633,10 @@ volume_mount_cb (GObject *source_object,
error = NULL;
if (!g_volume_mount_finish (G_VOLUME (source_object), res, &error)) {
- if (error->code != G_IO_ERROR_FAILED_HANDLED) {
- char *primary;
- char *name;
+ char *primary;
+ char *name;
+ if (error->code != G_IO_ERROR_FAILED_HANDLED) {
name = g_volume_get_name (G_VOLUME (source_object));
primary = g_strdup_printf (_("Unable to mount %s"),
name);
@@ -1018,6 +1019,7 @@ static GtkWidget *
panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
{
GtkWidget *places_menu;
+ GtkWidget *item;
char *gsettings_name = NULL;
char *name;
char *uri;
@@ -1099,7 +1101,7 @@ panel_place_menu_item_create_menu (PanelPlaceMenuItem *place_item)
if (panel_is_program_in_path ("caja-connect-server") ||
panel_is_program_in_path ("nautilus-connect-server") ||
panel_is_program_in_path ("nemo-connect-server")) {
- GtkWidget *item = panel_menu_items_create_action_item (PANEL_ACTION_CONNECT_SERVER);
+ item = panel_menu_items_create_action_item (PANEL_ACTION_CONNECT_SERVER);
if (item != NULL)
gtk_menu_shell_append (GTK_MENU_SHELL (places_menu),
item);
diff --git a/mate-panel/panel-multimonitor.c b/mate-panel/panel-multimonitor.c
index c7ac14cc..b2723f12 100644
--- a/mate-panel/panel-multimonitor.c
+++ b/mate-panel/panel-multimonitor.c
@@ -71,6 +71,7 @@ _panel_multimonitor_output_should_be_first (Display *xdisplay,
unsigned long nitems;
unsigned long bytes_after;
unsigned char *prop;
+ gboolean retval;
connector_type_atom = XInternAtom (xdisplay, "ConnectorType", False);
@@ -80,7 +81,7 @@ _panel_multimonitor_output_should_be_first (Display *xdisplay,
&nitems, &bytes_after, &prop) == Success) {
if (actual_type == XA_ATOM && nitems == 1 && actual_format == 32) {
char *connector_type = XGetAtomName (xdisplay, prop[0]);
- gboolean retval = g_strcmp0 (connector_type, "Panel") == 0;
+ retval = g_strcmp0 (connector_type, "Panel") == 0;
XFree (connector_type);
return retval;
}
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index e2b6841d..47d6d95b 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -1618,9 +1618,11 @@ panel_profile_load_list (GSettings *settings,
PanelProfileLoadFunc load_handler,
GCallback notify_handler)
{
+
const gchar *key = key_from_type (type);
gchar *changed_signal;
gchar **list;
+ gint i;
changed_signal = g_strdup_printf ("changed::%s", key);
g_signal_connect (settings, changed_signal, G_CALLBACK (notify_handler), NULL);
@@ -1628,7 +1630,7 @@ panel_profile_load_list (GSettings *settings,
list = g_settings_get_strv (settings, key);
- for (gint i = 0; list[i]; i++) {
+ for (i = 0; list[i]; i++) {
load_handler (list[i]);
}
diff --git a/mate-panel/panel-test-applets.c b/mate-panel/panel-test-applets.c
index 79b48d36..f14c3888 100644
--- a/mate-panel/panel-test-applets.c
+++ b/mate-panel/panel-test-applets.c
@@ -178,12 +178,13 @@ static void
load_applet_from_command_line (void)
{
guint size = 24, orient = PANEL_ORIENTATION_TOP;
+ gsize i;
g_assert (cli_iid != NULL);
if (cli_size || cli_orient) {
if (cli_size) {
- for (gsize i = 0; i < G_N_ELEMENTS (size_items); i++) {
+ for (i = 0; i < G_N_ELEMENTS (size_items); i++) {
if (strcmp (g_dpgettext2 (NULL, "Size", size_items[i].name), cli_size) == 0) {
size = size_items[i].value;
break;
@@ -192,7 +193,7 @@ load_applet_from_command_line (void)
}
if (cli_orient) {
- for (gsize i = 0; i < G_N_ELEMENTS (orient_items); i++) {
+ for (i = 0; i < G_N_ELEMENTS (orient_items); i++) {
if (strcmp (g_dpgettext2 (NULL, "Orientation", orient_items[i].name), cli_orient) == 0) {
orient = orient_items[i].value;
break;
diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c
index 9a9ce829..dd8f6d11 100644
--- a/mate-panel/panel-widget.c
+++ b/mate-panel/panel-widget.c
@@ -1504,6 +1504,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
AppletData *ad = list->data;
GtkRequisition chreq;
const char *id;
+ AppletInfo *info;
int position = ad->pos;
PanelObjectEdgeRelativity edge_relativity = PANEL_EDGE_START;
gboolean right_stuck = FALSE;
@@ -1525,7 +1526,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
id = mate_panel_applet_get_id_by_widget (ad->applet);
if (id)
{
- AppletInfo *info = mate_panel_applet_get_by_id (id);
+ info = mate_panel_applet_get_by_id (id);
position = g_settings_get_int (info->settings,
PANEL_OBJECT_POSITION_KEY);
edge_relativity = g_settings_get_enum (info->settings,
@@ -1671,8 +1672,10 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
if (ad->expand_major) {
const char *id;
+ AppletInfo *info;
PanelObjectEdgeRelativity edge_relativity = PANEL_EDGE_START;
gboolean right_stuck;
+ AppletData *pad;
int prior_space;
int following_space;
int additional_space;
@@ -1680,7 +1683,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
id = mate_panel_applet_get_id_by_widget (ad->applet);
if (id)
{
- AppletInfo *info = mate_panel_applet_get_by_id (id);
+ info = mate_panel_applet_get_by_id (id);
edge_relativity = g_settings_get_enum (info->settings,
PANEL_OBJECT_RELATIVE_TO_EDGE_KEY);
right_stuck = g_settings_get_boolean (info->settings,
@@ -1690,7 +1693,7 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
prior_space = ad->constrained;
if (list->prev)
{
- AppletData *pad = list->prev->data;
+ pad = list->prev->data;
prior_space -= pad->constrained + pad->min_cells;
}