summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-05-03 15:41:41 -0700
committerAntónio Fernandes <antoniof@gnome.org>2022-09-04 00:15:40 +0100
commit05d97aec624d0673e86b439cf892f27c505ac0dd (patch)
treebdcaa8a69e68f7667779ba3d7766310e10a88f3d
parent7c7c5fc4268c0b5bccbba57e344a045fb99166eb (diff)
downloadnautilus-05d97aec624d0673e86b439cf892f27c505ac0dd.tar.gz
sidebar: Reformat should_show_format_command() syntax
Reformat should_show_format_command() to allow for additional checks.
-rw-r--r--src/gtk/nautilusgtkplacessidebar.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c
index 8fe5bbb50..e3e4966e3 100644
--- a/src/gtk/nautilusgtkplacessidebar.c
+++ b/src/gtk/nautilusgtkplacessidebar.c
@@ -3162,17 +3162,17 @@ static GActionEntry entries[] = {
static gboolean
should_show_format_command (GVolume *volume)
{
- gchar *unix_device_id;
- gboolean show_format;
+ g_autofree gchar *unix_device_id = NULL;
gboolean disks_available;
+ if (volume == NULL || !G_IS_VOLUME (volume))
+ return FALSE;
+
unix_device_id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
disks_available = nautilus_dbus_launcher_is_available (nautilus_dbus_launcher_get(),
NAUTILUS_DBUS_LAUNCHER_DISKS);
- show_format = (unix_device_id != NULL);
- g_free (unix_device_id);
- return show_format && disks_available;
+ return unix_device_id != NULL && disks_available;
}
static void
@@ -3437,7 +3437,7 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
g_object_unref (item);
}
- if (volume != NULL && G_IS_VOLUME (volume) && should_show_format_command (volume))
+ if (should_show_format_command (volume))
{
item = g_menu_item_new (_("Format…"), "row.format");
g_menu_append_item (section, item);