use safer and more clear eina_streq() instead of strcmp()
This commit is contained in:
parent
765c10c183
commit
0293a50c05
|
@ -25,13 +25,13 @@ _places_mount_exe_del_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve
|
|||
Ecore_Exe_Event_Del *e = (Ecore_Exe_Event_Del *)event;
|
||||
const char *tag = ecore_exe_tag_get(e->exe);
|
||||
|
||||
if (!tag || (strcmp(tag, MOUNT_TAG) && strcmp(tag, UMOUNT_TAG)))
|
||||
if (!tag || (!eina_streq(tag, MOUNT_TAG) && !eina_streq(tag, UMOUNT_TAG)))
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
Volume *vol = ecore_exe_data_get(e->exe);
|
||||
if (vol && (e->exit_code == 0))
|
||||
{
|
||||
vol->mounted = strcmp(tag, MOUNT_TAG) ? EINA_FALSE : EINA_TRUE;
|
||||
vol->mounted = eina_streq(tag, MOUNT_TAG);
|
||||
places_volume_update(vol);
|
||||
}
|
||||
return ECORE_CALLBACK_DONE;
|
||||
|
@ -43,7 +43,7 @@ _places_mount_exe_error_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *e
|
|||
Ecore_Exe_Event_Data *e = (Ecore_Exe_Event_Data *)event;
|
||||
const char *tag = ecore_exe_tag_get(e->exe);
|
||||
|
||||
if (!tag || (strcmp(tag, MOUNT_TAG) && strcmp(tag, UMOUNT_TAG)))
|
||||
if (!tag || (!eina_streq(tag, MOUNT_TAG) && !eina_streq(tag, UMOUNT_TAG)))
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
Ecore_Exe_Event_Data_Line line = e->lines[0];
|
||||
|
@ -156,7 +156,7 @@ _places_mount_mtab_parse(void)
|
|||
|
||||
EINA_LIST_FOREACH_SAFE(to_search, l, l2, vol)
|
||||
{
|
||||
if (strcmp(vol->mount_point, mpoint))
|
||||
if (!eina_streq(vol->mount_point, mpoint))
|
||||
continue;
|
||||
|
||||
// printf("PLACES: Mounted: %s\n", mpoint);
|
||||
|
@ -214,8 +214,8 @@ _places_mount_fstab_parse(void)
|
|||
if (num_splits != 2)
|
||||
continue;
|
||||
|
||||
if (!strcmp(fstype, "nfs") ||
|
||||
!strcmp(fstype, "cifs"))
|
||||
if (eina_streq(fstype, "nfs") ||
|
||||
eina_streq(fstype, "cifs"))
|
||||
{
|
||||
_places_mount_volume_add(mpoint, fstype);
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ places_volume_by_id_get(const char *id)
|
|||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(volumes, l, v)
|
||||
if (!strcmp(v->id, id))
|
||||
if (eina_streq(v->id, id))
|
||||
return v;
|
||||
|
||||
return NULL;
|
||||
|
@ -363,35 +363,35 @@ places_fill_box(Evas_Object *main, Eina_Bool horiz)
|
|||
f1 = f2 = f3 = NULL;
|
||||
/* optical discs */
|
||||
// TODO more icons: dvd, blueray....
|
||||
if (!strcmp(vol->drive_type, "cdrom") ||
|
||||
!strcmp(vol->drive_type, "optical_cd"))
|
||||
if (eina_streq(vol->drive_type, "cdrom") ||
|
||||
eina_streq(vol->drive_type, "optical_cd"))
|
||||
{
|
||||
f1 = "media"; f2 = "optical"; // OR media-optical ??
|
||||
}
|
||||
/* flash cards */
|
||||
else if (!strcmp(vol->drive_type, "sd_mmc") ||
|
||||
!strcmp(vol->model, "SD/MMC"))
|
||||
else if (eina_streq(vol->drive_type, "sd_mmc") ||
|
||||
eina_streq(vol->model, "SD/MMC"))
|
||||
{
|
||||
f1 = "media"; f2 = "flash"; f3 = "sdmmc"; // NOTE sd-mmc in Oxigen :(
|
||||
}
|
||||
else if (!strcmp(vol->drive_type, "memory_stick") ||
|
||||
!strcmp(vol->model, "MS/MS-Pro"))
|
||||
else if (eina_streq(vol->drive_type, "memory_stick") ||
|
||||
eina_streq(vol->model, "MS/MS-Pro"))
|
||||
{
|
||||
f1 = "media"; f2 = "flash"; f3 = "ms"; // NOTE memory-stick in Oxigen :(
|
||||
}
|
||||
/* iPods */
|
||||
else if (!strcmp(vol->model, "iPod"))
|
||||
else if (eina_streq(vol->model, "iPod"))
|
||||
{
|
||||
f1 = "multimedia-player"; f2 = "apple"; f3 = "ipod";
|
||||
}
|
||||
/* generic usb drives */
|
||||
else if (!strcmp(vol->bus, "usb"))
|
||||
else if (eina_streq(vol->bus, "usb"))
|
||||
{
|
||||
f1 = "drive"; f2 = "removable-media"; f3 = "usb";
|
||||
}
|
||||
/* network filesystem */
|
||||
else if (!strcmp(vol->fstype, "nfs") ||
|
||||
!strcmp(vol->fstype, "cifs"))
|
||||
else if (eina_streq(vol->fstype, "nfs") ||
|
||||
eina_streq(vol->fstype, "cifs"))
|
||||
{
|
||||
f1 = "folder"; f2 = "remote";
|
||||
}
|
||||
|
@ -421,24 +421,24 @@ places_fill_box(Evas_Object *main, Eina_Bool horiz)
|
|||
else evas_object_del(icon);
|
||||
|
||||
//set partition type tag
|
||||
if (!strcmp(vol->fstype, "ext2") ||
|
||||
!strcmp(vol->fstype, "ext3") ||
|
||||
!strcmp(vol->fstype, "ext4") ||
|
||||
!strcmp(vol->fstype, "reiserfs") ||
|
||||
!strcmp(vol->fstype, "nfs"))
|
||||
if (eina_streq(vol->fstype, "ext2") ||
|
||||
eina_streq(vol->fstype, "ext3") ||
|
||||
eina_streq(vol->fstype, "ext4") ||
|
||||
eina_streq(vol->fstype, "reiserfs") ||
|
||||
eina_streq(vol->fstype, "nfs"))
|
||||
edje_object_signal_emit(o, "icon,tag,ext3", "places");
|
||||
else if (!strcmp(vol->fstype, "ufs") ||
|
||||
!strcmp(vol->fstype, "zfs"))
|
||||
else if (eina_streq(vol->fstype, "ufs") ||
|
||||
eina_streq(vol->fstype, "zfs"))
|
||||
edje_object_signal_emit(o, "icon,tag,ufs", "places");
|
||||
else if (!strcmp(vol->fstype, "vfat") ||
|
||||
!strcmp(vol->fstype, "ntfs") ||
|
||||
!strcmp(vol->fstype, "ntfs-3g") ||
|
||||
!strcmp(vol->fstype, "cifs"))
|
||||
else if (eina_streq(vol->fstype, "vfat") ||
|
||||
eina_streq(vol->fstype, "ntfs") ||
|
||||
eina_streq(vol->fstype, "ntfs-3g") ||
|
||||
eina_streq(vol->fstype, "cifs"))
|
||||
edje_object_signal_emit(o, "icon,tag,fat", "places");
|
||||
else if (!strcmp(vol->fstype, "hfs") ||
|
||||
!strcmp(vol->fstype, "hfsplus"))
|
||||
else if (eina_streq(vol->fstype, "hfs") ||
|
||||
eina_streq(vol->fstype, "hfsplus"))
|
||||
edje_object_signal_emit(o, "icon,tag,hfs", "places");
|
||||
else if (!strcmp(vol->fstype, "udf"))
|
||||
else if (eina_streq(vol->fstype, "udf"))
|
||||
edje_object_signal_emit(o, "icon,tag,dvd", "places");
|
||||
|
||||
// update labels, gauge and button
|
||||
|
@ -507,7 +507,7 @@ places_volume_mount(Volume *vol)
|
|||
if (!vol || !vol->mount_func || vol->mounted)
|
||||
return;
|
||||
|
||||
if ((!strcmp(vol->fstype, "vfat")) || (!strcmp(vol->fstype, "ntfs")))
|
||||
if ((eina_streq(vol->fstype, "vfat")) || (eina_streq(vol->fstype, "ntfs")))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "uid=%i", (int)getuid());
|
||||
opts = eina_list_append(opts, buf);
|
||||
|
@ -772,7 +772,7 @@ _places_volume_object_update(Volume *vol, Evas_Object *obj)
|
|||
// printf("PLACES: Object update for vol %s\n", vol->id);
|
||||
|
||||
// the volume label
|
||||
if (vol->mount_point && !strcmp(vol->mount_point, "/"))
|
||||
if (eina_streq(vol->mount_point, "/"))
|
||||
edje_object_part_text_set(obj, "volume_label", D_("Filesystem"));
|
||||
else if (vol->label && vol->label[0])
|
||||
edje_object_part_text_set(obj, "volume_label", vol->label);
|
||||
|
@ -815,7 +815,7 @@ _places_volume_object_update(Volume *vol, Evas_Object *obj)
|
|||
|
||||
// the mount/eject icon
|
||||
if (vol->mounted && vol->mount_point && vol->unmount_func &&
|
||||
strcmp(vol->mount_point, "/"))
|
||||
!eina_streq(vol->mount_point, "/"))
|
||||
{
|
||||
edje_object_signal_emit(obj, "icon,eject,show", "places");
|
||||
edje_object_part_text_set(obj, "eject_label", D_("unmount"));
|
||||
|
@ -998,7 +998,7 @@ places_generate_menu(void *data, E_Menu *em)
|
|||
EINA_LIST_FOREACH(volumes, l, vol)
|
||||
{
|
||||
if (!vol->valid) continue;
|
||||
if (vol->mount_point && !strcmp(vol->mount_point, "/")) continue;
|
||||
if (eina_streq(vol->mount_point, "/")) continue;
|
||||
|
||||
mi = e_menu_item_new(em);
|
||||
if ((vol->label) && (vol->label[0] != '\0'))
|
||||
|
|
Loading…
Reference in New Issue