Commit 5461e017 authored by Abhijeetsingh Meena's avatar Abhijeetsingh Meena
Browse files

Renamed the method thunar_device_sort to thunar_device_compare_by_name, added...

Renamed the method thunar_device_sort to thunar_device_compare_by_name, added documentation to thunar_device_get_name and dropped comments
parent bbe808d0
Pipeline #12209 passed with stages
in 6 minutes and 3 seconds
......@@ -327,6 +327,20 @@ thunar_device_emit_pre_unmount (ThunarDevice *device,
}
/**
* thunar_device_get_name:
* @device : a #ThunarDevice instance.
*
* Returns the name of the @device if the @device
* is mounted. Otherwise %NULL will be
* returned.
*
* The caller is responsible to free the returned string
* using g_free() when no longer needed.
*
* Return value: the name of @device if @device is mounted
* , %NULL otherwise.
**/
gchar *
thunar_device_get_name (const ThunarDevice *device)
......@@ -664,7 +678,7 @@ thunar_device_get_root (const ThunarDevice *device)
gint
thunar_device_sort (const ThunarDevice *device1,
thunar_device_compare_by_name (const ThunarDevice *device1,
const ThunarDevice *device2)
{
gchar* name1;
......@@ -680,8 +694,11 @@ thunar_device_sort (const ThunarDevice *device1,
name1 = thunar_device_get_name (device1);
name2 = thunar_device_get_name (device2);
/* code which arranges devices in ASCII order */
/* code which compares device names */
return g_strcmp0 (name1, name2);
g_free (name1);
g_free (name2);
}
......
......@@ -72,7 +72,7 @@ gboolean thunar_device_is_mounted (const ThunarDevice *devic
GFile *thunar_device_get_root (const ThunarDevice *device);
gint thunar_device_sort (const ThunarDevice *device1,
gint thunar_device_compare_by_name (const ThunarDevice *device1,
const ThunarDevice *device2);
void thunar_device_mount (ThunarDevice *device,
......
......@@ -1229,7 +1229,7 @@ thunar_shortcuts_model_sort_func (gconstpointer shortcut_a,
/* properly sort devices by timestamp */
if (a->device != NULL && b->device != NULL)
return thunar_device_sort (a->device, b->device);
return thunar_device_compare_by_name (a->device, b->device);
return g_strcmp0 (a->name, b->name);
}
......
......@@ -1111,8 +1111,7 @@ thunar_tree_model_device_added (ThunarDeviceMonitor *device_monitor,
if (item->device == NULL)
break;
/* sort devices by ASCII order */
if (thunar_device_sort (item->device, device) > 0)
if (thunar_device_compare_by_name (item->device, device) > 0)
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment