[nautilus] sidebar: Reformat should_show_format_command() syntax
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] sidebar: Reformat should_show_format_command() syntax
- Date: Sat, 3 Sep 2022 23:31:27 +0000 (UTC)
commit 05d97aec624d0673e86b439cf892f27c505ac0dd
Author: Corey Berla <corey berla me>
Date: Tue May 3 15:41:41 2022 -0700
sidebar: Reformat should_show_format_command() syntax
Reformat should_show_format_command() to allow for additional
checks.
src/gtk/nautilusgtkplacessidebar.c | 12 ++++++------
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]