rofi-file-browser: Fix build error & warnings (#372856)

This commit is contained in:
Arne Keller
2025-02-08 11:08:48 +01:00
committed by GitHub
4 changed files with 133 additions and 1 deletions
@@ -0,0 +1,13 @@
diff --git a/src/icons.c b/src/icons.c
index eee00a4..ae476de 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -48,7 +48,7 @@ void request_icons_for_file ( FBFile *fbfile, int icon_size, FileBrowserIconData
}
}
- unsigned long num_icon_names;
+ gsize num_icon_names;
char** icon_names_raw = g_array_steal ( icon_names, &num_icon_names );
/* Create icon fetcher requests. */
@@ -0,0 +1,27 @@
diff --git a/src/filebrowser.c b/src/filebrowser.c
index a5a19af..59f0140 100644
--- a/src/filebrowser.c
+++ b/src/filebrowser.c
@@ -256,21 +256,21 @@ static char *file_browser_get_display_value ( const Mode *sw, unsigned int selec
FBCmd *fbcmd = &pd->cmds[selected_line];
char* name = fbcmd->name != NULL ? fbcmd->name : fbcmd->cmd;
return rofi_force_utf8 ( name, strlen ( name ) );
} else {
int index = pd->open_custom ? pd->open_custom_index : selected_line;
FBFile *fbfile = &fd->files[index];
return rofi_force_utf8 ( fbfile->name, strlen ( fbfile->name ) );
}
}
-static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, int height )
+static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, unsigned int height )
{
FileBrowserModePrivateData *pd = ( FileBrowserModePrivateData * ) mode_get_private_data ( sw );
FileBrowserFileData *fd = &pd->file_data;
FileBrowserIconData *id = &pd->icon_data;
if ( ! id->show_icons ) {
return NULL;
}
if ( pd->open_custom && pd->show_cmds ) {
@@ -0,0 +1,83 @@
diff --git a/src/cmds.c b/src/cmds.c
index b2f61d7..16554d8 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -108,21 +108,21 @@ void search_path_for_cmds ( FileBrowserModePrivateData *pd )
fbcmd->cmd = cmdstr;
fbcmd->name = NULL;
fbcmd->icon_name = NULL;
num_cmds++;
}
g_hash_table_steal_all ( table );
g_hash_table_destroy ( table );
- g_qsort_with_data ( cmds, num_cmds, sizeof ( FBCmd ), compare_cmds, NULL );
+ g_sort_array ( cmds, num_cmds, sizeof ( FBCmd ), compare_cmds, NULL );
add_cmds(cmds, num_cmds, pd);
g_free ( cmds );
}
void destroy_cmds ( FileBrowserModePrivateData *pd )
{
for ( int i = 0; i < pd->num_cmds; i++ ) {
g_free( pd->cmds[i].cmd );
diff --git a/src/files.c b/src/files.c
index 29a5f9c..6a15b2e 100644
--- a/src/files.c
+++ b/src/files.c
@@ -135,46 +135,46 @@ void load_files ( FileBrowserFileData *fd )
FBFile *sort_files = fd->files;
int num_sort_files = fd->num_files;
if ( ! fd->hide_parent ) {
sort_files++;
num_sort_files--;
}
/* Sort all but the parent dir. */
if ( fd->sort_by_type ) {
if ( fd->sort_by_depth ) {
- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth_type, NULL );
+ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth_type, NULL );
} else {
- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_type, NULL );
+ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_type, NULL );
}
} else {
if ( fd->sort_by_depth ) {
- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth, NULL );
+ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files_depth, NULL );
} else {
- g_qsort_with_data ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files, NULL );
+ g_sort_array ( sort_files, num_sort_files, sizeof ( FBFile ), compare_files, NULL );
}
}
}
void change_dir ( char *path, FileBrowserFileData *pd )
{
char* new_dir = get_canonical_abs_path ( path, pd->current_dir );
g_free ( pd->current_dir );
pd->current_dir = new_dir;
g_chdir ( new_dir );
}
static bool match_glob_patterns ( const char *basename, FileBrowserFileData *fd )
{
int len = strlen ( basename );
for ( int i = 0; i < fd->num_exclude_patterns; i++ ) {
- if ( g_pattern_match ( fd->exclude_patterns[i], len, basename, NULL ) ) {
+ if ( g_pattern_spec_match ( fd->exclude_patterns[i], len, basename, NULL ) ) {
return false;
}
}
return true;
}
static int add_file ( const char *fpath, G_GNUC_UNUSED const struct stat *sb, int typeflag, struct FTW *ftwbuf )
{
FileBrowserFileData *fd = global_fd;
+10 -1
View File
@@ -20,6 +20,12 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};
patches = [
./fix_incompatible_pointer_type.patch
./fix_build_on_i686.patch
./fix_recent_glib_deprecation_warning.patch
];
prePatch = ''
substituteInPlace ./CMakeLists.txt \
--replace ' ''${ROFI_PLUGINS_DIR}' " $out/lib/rofi" \
@@ -43,6 +49,9 @@ stdenv.mkDerivation rec {
description = "Use rofi to quickly open files";
homepage = "https://github.com/marvinkreis/rofi-file-browser-extended";
license = licenses.mit;
maintainers = with maintainers; [ jluttine ];
maintainers = with maintainers; [
bew
jluttine
];
};
}