aboutsummaryrefslogtreecommitdiff
path: root/src/file.c
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2018-10-20 18:47:23 +0530
committerDandelion <nirav@teisuu.com>2018-10-20 18:47:23 +0530
commitf8f3159f9b98b024043bd8de2c5e15dd2adf03ca (patch)
tree0ccaa16120845ef816199dc02f2866c4be1fbba3 /src/file.c
parenta7488f38fef1960086af860063f1958fb75d58f3 (diff)
downloadim-f8f3159f9b98b024043bd8de2c5e15dd2adf03ca.tar.gz
im-f8f3159f9b98b024043bd8de2c5e15dd2adf03ca.zip
Switched to gtk_init and gtk_main from gtk_application
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/file.c b/src/file.c
index 3a6b005..423725c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,6 +1,5 @@
#define _DEFAULT_SOURCE
-#include "file.h"
-#include "image.h"
+
#include <dirent.h>
#include <gtk-3.0/gtk/gtk.h>
#include <libgen.h>
@@ -9,6 +8,9 @@
#include <string.h>
#include <sys/types.h>
+#include "file.h"
+#include "image.h"
+
static int curr_file_index, file_list_count;
static char **file_list;
static char **extensions = NULL;
@@ -69,14 +71,15 @@ int image_filter(const struct dirent *dir)
return 0;
}
-int scan(const char *file_name)
+void scan(const char *file_name)
{
scan_supported_formats();
struct dirent **name_list;
char *dir_name = dirname(strdup(file_name));
file_list_count = scandir(dir_name, &name_list, image_filter, alphasort);
if (file_list_count < 0) {
- return -1;
+ g_printerr("failed to read direcory %s for image files", dir_name);
+ return;
}
file_list = malloc(file_list_count * sizeof(char *));
@@ -90,8 +93,6 @@ int scan(const char *file_name)
i++;
}
free(name_list);
-
- return 0;
}
void next_file()