~mank319/pantheon-files/navigation-buttons

« back to all changes in this revision

Viewing changes to libcore/gof-file.c

Display emblem on files and folders that are read-only or unreadable

Show diffs side-by-side

added added

removed removed

Lines of Context:
662
662
          gof_file_add_emblem(file, "emblem-favorite");*/
663
663
    }
664
664
 
 
665
    if (!gof_file_is_writable (file)) {
 
666
        if (gof_file_is_readable (file))
 
667
            gof_file_add_emblem (file, "emblem-readonly");
 
668
        else
 
669
            gof_file_add_emblem (file, "emblem-unreadable");
 
670
    }
 
671
 
665
672
    /* TODO update signal on real change */
666
673
    //g_warning ("update emblem %s", file.uri);
667
674
    if (file->emblems_list != NULL)
1212
1219
         * is the trash folder (since it is writable). */
1213
1220
        if (strncmp (file->uri, "trash:///", 10) == 0)
1214
1221
            return TRUE;
 
1222
 
1215
1223
        return FALSE;
1216
1224
    }
1217
1225
 
1219
1227
}
1220
1228
 
1221
1229
gboolean
 
1230
gof_file_is_readable (GOFFile *file)
 
1231
{
 
1232
    g_return_val_if_fail (GOF_IS_FILE (file), FALSE);
 
1233
 
 
1234
    if (file->target_gof)
 
1235
        return gof_file_is_writable (file->target_gof);
 
1236
    if (file->info == NULL)
 
1237
        return FALSE;
 
1238
    if (!g_file_info_has_attribute (file->info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
 
1239
        return FALSE;
 
1240
 
 
1241
    return g_file_info_get_attribute_boolean (file->info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
 
1242
}
 
1243
 
 
1244
gboolean
1222
1245
gof_file_is_trashed (GOFFile *file)
1223
1246
{
1224
1247
    g_return_val_if_fail (GOF_IS_FILE (file), FALSE);
2442
2465
    }
2443
2466
 
2444
2467
    return FALSE;
2445
 
}
 
 
b'\\ No newline at end of file'
 
2468
}