mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[FileBrowser] Prepend '@' before filename if link.
This commit is contained in:
parent
9a21040d0e
commit
10678e55d8
1 changed files with 31 additions and 25 deletions
|
@ -64,6 +64,7 @@ typedef struct {
|
|||
char *path;
|
||||
enum FBFileType type;
|
||||
uint32_t icon_fetch_uid;
|
||||
gboolean link;
|
||||
} FBFile;
|
||||
|
||||
typedef struct
|
||||
|
@ -118,6 +119,7 @@ static void get_file_browser ( Mode *sw )
|
|||
pd->array[pd->array_length].path = NULL;
|
||||
pd->array[pd->array_length].type = UP;
|
||||
pd->array[pd->array_length].icon_fetch_uid = 0;
|
||||
pd->array[pd->array_length].link = FALSE;
|
||||
pd->array_length++;
|
||||
continue;
|
||||
|
||||
|
@ -142,6 +144,7 @@ static void get_file_browser ( Mode *sw )
|
|||
pd->array[pd->array_length].path = g_build_filename ( cdir, rd->d_name, NULL );
|
||||
pd->array[pd->array_length].type = (rd->d_type == DT_DIR)? DIRECTORY: RFILE;
|
||||
pd->array[pd->array_length].icon_fetch_uid = 0;
|
||||
pd->array[pd->array_length].link = FALSE;
|
||||
pd->array_length++;
|
||||
break;
|
||||
case DT_LNK:
|
||||
|
@ -150,6 +153,7 @@ static void get_file_browser ( Mode *sw )
|
|||
pd->array[pd->array_length].name = g_filename_to_utf8 ( rd->d_name, -1, NULL, NULL, NULL);
|
||||
pd->array[pd->array_length].path = g_build_filename ( cdir, rd->d_name, NULL );
|
||||
pd->array[pd->array_length].icon_fetch_uid = 0;
|
||||
pd->array[pd->array_length].link = TRUE;
|
||||
// Default to file.
|
||||
pd->array[pd->array_length].type = RFILE;
|
||||
{
|
||||
|
@ -285,13 +289,15 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, G_
|
|||
|
||||
// Only return the string if requested, otherwise only set state.
|
||||
if ( !get_entry ) return NULL;
|
||||
if ( pd->array[selected_line].type == DIRECTORY ){
|
||||
return g_strdup ( pd->array[selected_line].name);
|
||||
} else if ( pd->array[selected_line].type == UP ){
|
||||
if ( pd->array[selected_line].type == UP ){
|
||||
return g_strdup( " ..");
|
||||
} else {
|
||||
if ( pd->array[selected_line].link ) {
|
||||
return g_strconcat ( "@", pd->array[selected_line].name, NULL);
|
||||
} else {
|
||||
return g_strdup ( pd->array[selected_line].name);
|
||||
}
|
||||
}
|
||||
return g_strdup("n/a");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue