Improve file checks using is_readable_file().
authorLaurent Monin <geeqie@norz.org>
Sun, 1 Mar 2009 17:13:14 +0000 (17:13 +0000)
committerLaurent Monin <geeqie@norz.org>
Sun, 1 Mar 2009 17:13:14 +0000 (17:13 +0000)
src/image.c
src/layout.c

index debea74..27e2f96 100644 (file)
@@ -206,7 +206,7 @@ static gint image_post_process_color(ImageWindow *imd, gint start_row, gint run_
                {
                const gchar *file = options->color_profile.input_file[imd->color_profile_input - COLOR_PROFILE_FILE];
        
-               if (!access_file(file, R_OK)) return FALSE;
+               if (!is_readable_file(file)) return FALSE;
 
                input_type = COLOR_PROFILE_FILE;
                input_file = file;
@@ -223,7 +223,7 @@ static gint image_post_process_color(ImageWindow *imd, gint start_row, gint run_
                }
 
        if (imd->color_profile_screen == 1 &&
-           access_file(options->color_profile.screen_file, R_OK))
+           is_readable_file(options->color_profile.screen_file))
                {
                screen_type = COLOR_PROFILE_FILE;
                screen_file = options->color_profile.screen_file;
@@ -752,7 +752,7 @@ static void image_change_complete(ImageWindow *imd, gdouble zoom, gint new)
        else
                {
 
-               if (isfile(imd->image_fd->path))
+               if (is_readable_file(imd->image_fd->path))
                        {
                        PixbufRenderer *pr;
        
index 7c8cbde..969890b 100644 (file)
@@ -482,7 +482,7 @@ static void layout_color_button_press_cb(GtkWidget *widget, gpointer data)
                                           G_CALLBACK(layout_color_menu_input_cb), lw);
                g_free(buf);
                g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE));
-               gtk_widget_set_sensitive(item, active && !from_image && access_file(file, R_OK));
+               gtk_widget_set_sensitive(item, active && !from_image && is_readable_file(file));
                }
 
        menu_item_add_divider(menu);
@@ -498,7 +498,7 @@ static void layout_color_button_press_cb(GtkWidget *widget, gpointer data)
                                   _("_Screen profile"), (screen == 1),
                                   G_CALLBACK(layout_color_menu_screen_cb), lw);
        g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
-       gtk_widget_set_sensitive(item, active && access_file(options->color_profile.screen_file, R_OK));
+       gtk_widget_set_sensitive(item, active && is_readable_file(options->color_profile.screen_file));
 
        gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
 #endif /* HAVE_LCMS */