Revision: 1452
http://geeqie.svn.sourceforge.net/geeqie/?rev=1452&view=rev
Author: zas_
Date: 2009-03-01 15:41:51 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
Slightly modify access_file() and use it to test profile files existence and
read access.
Modified Paths:
--------------
trunk/src/image.c
trunk/src/layout.c
trunk/src/ui_fileops.c
Modified: trunk/src/image.c
===================================================================
--- trunk/src/image.c 2009-03-01 15:28:06 UTC (rev 1451)
+++ trunk/src/image.c 2009-03-01 15:41:51 UTC (rev 1452)
@@ -204,13 +204,12 @@
if (imd->color_profile_input >= COLOR_PROFILE_FILE &&
imd->color_profile_input < COLOR_PROFILE_FILE +
COLOR_PROFILE_INPUTS)
{
- gint n;
+ const gchar *file =
options->color_profile.input_file[imd->color_profile_input -
COLOR_PROFILE_FILE];
+
+ if (!access_file(file, R_OK)) return FALSE;
- n = imd->color_profile_input - COLOR_PROFILE_FILE;
- if (!options->color_profile.input_file[n] ||
!options->color_profile.input_file[n][0]) return FALSE;
-
input_type = COLOR_PROFILE_FILE;
- input_file = options->color_profile.input_file[n];
+ input_file = file;
}
else if (imd->color_profile_input >= COLOR_PROFILE_SRGB &&
imd->color_profile_input < COLOR_PROFILE_FILE)
@@ -224,8 +223,7 @@
}
if (imd->color_profile_screen == 1 &&
- options->color_profile.screen_file &&
- options->color_profile.screen_file[0])
+ access_file(options->color_profile.screen_file, R_OK))
{
screen_type = COLOR_PROFILE_FILE;
screen_file = options->color_profile.screen_file;
Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c 2009-03-01 15:28:06 UTC (rev 1451)
+++ trunk/src/layout.c 2009-03-01 15:41:51 UTC (rev 1452)
@@ -482,7 +482,7 @@
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 && file &&
file[0] && access_file(file, R_OK));
+ gtk_widget_set_sensitive(item, active && !from_image &&
access_file(file, R_OK));
}
menu_item_add_divider(menu);
@@ -498,7 +498,7 @@
_("_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 &&
options->color_profile.screen_file && options->color_profile.screen_file[0]);
+ gtk_widget_set_sensitive(item, active &&
access_file(options->color_profile.screen_file, R_OK));
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0,
GDK_CURRENT_TIME);
#endif /* HAVE_LCMS */
Modified: trunk/src/ui_fileops.c
===================================================================
--- trunk/src/ui_fileops.c 2009-03-01 15:28:06 UTC (rev 1451)
+++ trunk/src/ui_fileops.c 2009-03-01 15:41:51 UTC (rev 1452)
@@ -424,7 +424,7 @@
gchar *sl;
gint ret;
- if (!s) return FALSE;
+ if (!s || !s[0]) return FALSE;
sl = path_from_utf8(s);
ret = (access(sl, mode) == 0);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn