comparison src/layout.c @ 1356:681e79dd0820

Slightly modify access_file() and use it to test profile files existence and read access.
author zas_
date Sun, 01 Mar 2009 15:41:51 +0000
parents 06ec1279e33e
children b3156b2ec4c5
comparison
equal deleted inserted replaced
1355:5a61fb9adc05 1356:681e79dd0820
480 item = menu_item_add_radio(menu, item, 480 item = menu_item_add_radio(menu, item,
481 buf, (i + COLOR_PROFILE_FILE == input), 481 buf, (i + COLOR_PROFILE_FILE == input),
482 G_CALLBACK(layout_color_menu_input_cb), lw); 482 G_CALLBACK(layout_color_menu_input_cb), lw);
483 g_free(buf); 483 g_free(buf);
484 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE)); 484 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + COLOR_PROFILE_FILE));
485 gtk_widget_set_sensitive(item, active && !from_image && file && file[0] && access_file(file, R_OK)); 485 gtk_widget_set_sensitive(item, active && !from_image && access_file(file, R_OK));
486 } 486 }
487 487
488 menu_item_add_divider(menu); 488 menu_item_add_divider(menu);
489 489
490 item = menu_item_add_radio(menu, NULL, 490 item = menu_item_add_radio(menu, NULL,
496 496
497 item = menu_item_add_radio(menu, item, 497 item = menu_item_add_radio(menu, item,
498 _("_Screen profile"), (screen == 1), 498 _("_Screen profile"), (screen == 1),
499 G_CALLBACK(layout_color_menu_screen_cb), lw); 499 G_CALLBACK(layout_color_menu_screen_cb), lw);
500 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1)); 500 g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
501 gtk_widget_set_sensitive(item, active && options->color_profile.screen_file && options->color_profile.screen_file[0]); 501 gtk_widget_set_sensitive(item, active && access_file(options->color_profile.screen_file, R_OK));
502 502
503 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); 503 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
504 #endif /* HAVE_LCMS */ 504 #endif /* HAVE_LCMS */
505 } 505 }
506 506