415 gboolean result = FALSE; 416 417 lib = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL); 418 if (lib == NULL) { 419 return FALSE; 420 } 421 422 fp_gtk_check_version = dlsym(lib, "gtk_check_version"); 423 /* Check for GTK 2.2+ */ 424 if (!fp_gtk_check_version(2, 2, 0)) { 425 result = TRUE; 426 } 427 428 dlclose(lib); 429 430 return result; 431 } 432 } 433 434 /** 435 * Functions for sun_awt_X11_GtkFileDialogPeer.c 436 */ 437 void gtk2_file_chooser_load() 438 { 439 fp_gtk_file_chooser_get_filename = dl_symbol( 440 "gtk_file_chooser_get_filename"); 441 fp_gtk_file_chooser_dialog_new = dl_symbol("gtk_file_chooser_dialog_new"); 442 fp_gtk_file_chooser_set_current_folder = dl_symbol( 443 "gtk_file_chooser_set_current_folder"); 444 fp_gtk_file_chooser_set_filename = dl_symbol( 445 "gtk_file_chooser_set_filename"); 446 fp_gtk_file_chooser_set_current_name = dl_symbol( 447 "gtk_file_chooser_set_current_name"); 448 fp_gtk_file_filter_add_custom = dl_symbol("gtk_file_filter_add_custom"); 449 fp_gtk_file_chooser_set_filter = dl_symbol("gtk_file_chooser_set_filter"); 450 fp_gtk_file_chooser_get_type = dl_symbol("gtk_file_chooser_get_type"); 451 fp_gtk_file_filter_new = dl_symbol("gtk_file_filter_new"); 452 if (fp_gtk_check_version(2, 8, 0) == NULL) { 453 fp_gtk_file_chooser_set_do_overwrite_confirmation = dl_symbol( 454 "gtk_file_chooser_set_do_overwrite_confirmation"); | 415 gboolean result = FALSE; 416 417 lib = dlopen(GTK2_LIB, RTLD_LAZY | RTLD_LOCAL); 418 if (lib == NULL) { 419 return FALSE; 420 } 421 422 fp_gtk_check_version = dlsym(lib, "gtk_check_version"); 423 /* Check for GTK 2.2+ */ 424 if (!fp_gtk_check_version(2, 2, 0)) { 425 result = TRUE; 426 } 427 428 dlclose(lib); 429 430 return result; 431 } 432 } 433 434 /** 435 * Functions for awt_Desktop.c 436 */ 437 gboolean gtk2_show_uri_load() { 438 dlerror(); 439 fp_gtk_show_uri = dl_symbol("gtk_show_uri"); 440 const char *dlsym_error = dlerror(); 441 if (dlsym_error) { 442 fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error); 443 return 0; 444 } 445 return 1; 446 } 447 448 /** 449 * Functions for sun_awt_X11_GtkFileDialogPeer.c 450 */ 451 void gtk2_file_chooser_load() 452 { 453 fp_gtk_file_chooser_get_filename = dl_symbol( 454 "gtk_file_chooser_get_filename"); 455 fp_gtk_file_chooser_dialog_new = dl_symbol("gtk_file_chooser_dialog_new"); 456 fp_gtk_file_chooser_set_current_folder = dl_symbol( 457 "gtk_file_chooser_set_current_folder"); 458 fp_gtk_file_chooser_set_filename = dl_symbol( 459 "gtk_file_chooser_set_filename"); 460 fp_gtk_file_chooser_set_current_name = dl_symbol( 461 "gtk_file_chooser_set_current_name"); 462 fp_gtk_file_filter_add_custom = dl_symbol("gtk_file_filter_add_custom"); 463 fp_gtk_file_chooser_set_filter = dl_symbol("gtk_file_chooser_set_filter"); 464 fp_gtk_file_chooser_get_type = dl_symbol("gtk_file_chooser_get_type"); 465 fp_gtk_file_filter_new = dl_symbol("gtk_file_filter_new"); 466 if (fp_gtk_check_version(2, 8, 0) == NULL) { 467 fp_gtk_file_chooser_set_do_overwrite_confirmation = dl_symbol( 468 "gtk_file_chooser_set_do_overwrite_confirmation"); |