1------------------------------------------------------------------------------ 2-- -- 3-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 4-- Copyright (C) 2000-2015, AdaCore -- 5-- -- 6-- This library is free software; you can redistribute it and/or modify it -- 7-- under terms of the GNU General Public License as published by the Free -- 8-- Software Foundation; either version 3, or (at your option) any later -- 9-- version. This library is distributed in the hope that it will be useful, -- 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- 11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- 12-- -- 13-- As a special exception under Section 7 of GPL version 3, you are granted -- 14-- additional permissions described in the GCC Runtime Library Exception, -- 15-- version 3.1, as published by the Free Software Foundation. -- 16-- -- 17-- You should have received a copy of the GNU General Public License and -- 18-- a copy of the GCC Runtime Library Exception along with this program; -- 19-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 20-- <http://www.gnu.org/licenses/>. -- 21-- -- 22------------------------------------------------------------------------------ 23 24pragma Style_Checks (Off); 25pragma Warnings (Off, "*is already use-visible*"); 26with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks; 27with Gtkada.Bindings; use Gtkada.Bindings; 28pragma Warnings(Off); -- might be unused 29with Interfaces.C.Strings; use Interfaces.C.Strings; 30pragma Warnings(On); 31 32package body Gtk.File_Chooser_Dialog is 33 34 package Type_Conversion_Gtk_File_Chooser_Dialog is new Glib.Type_Conversion_Hooks.Hook_Registrator 35 (Get_Type'Access, Gtk_File_Chooser_Dialog_Record); 36 pragma Unreferenced (Type_Conversion_Gtk_File_Chooser_Dialog); 37 38 --------------------------------- 39 -- Gtk_File_Chooser_Dialog_New -- 40 --------------------------------- 41 42 function Gtk_File_Chooser_Dialog_New 43 (Title : UTF8_String := ""; 44 Parent : access Gtk.Window.Gtk_Window_Record'Class; 45 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 46 return Gtk_File_Chooser_Dialog 47 is 48 Dialog : constant Gtk_File_Chooser_Dialog := new Gtk_File_Chooser_Dialog_Record; 49 begin 50 Gtk.File_Chooser_Dialog.Initialize (Dialog, Title, Parent, Action); 51 return Dialog; 52 end Gtk_File_Chooser_Dialog_New; 53 54 ------------- 55 -- Gtk_New -- 56 ------------- 57 58 procedure Gtk_New 59 (Dialog : out Gtk_File_Chooser_Dialog; 60 Title : UTF8_String := ""; 61 Parent : access Gtk.Window.Gtk_Window_Record'Class; 62 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 63 is 64 begin 65 Dialog := new Gtk_File_Chooser_Dialog_Record; 66 Gtk.File_Chooser_Dialog.Initialize (Dialog, Title, Parent, Action); 67 end Gtk_New; 68 69 ---------------- 70 -- Initialize -- 71 ---------------- 72 73 procedure Initialize 74 (Dialog : not null access Gtk_File_Chooser_Dialog_Record'Class; 75 Title : UTF8_String := ""; 76 Parent : access Gtk.Window.Gtk_Window_Record'Class; 77 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 78 is 79 function Internal 80 (Title : Interfaces.C.Strings.chars_ptr; 81 Parent : System.Address; 82 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 83 return System.Address; 84 pragma Import (C, Internal, "ada_gtk_file_chooser_dialog_new"); 85 Tmp_Title : Interfaces.C.Strings.chars_ptr; 86 Tmp_Return : System.Address; 87 begin 88 if not Dialog.Is_Created then 89 if Title = "" then 90 Tmp_Title := Interfaces.C.Strings.Null_Ptr; 91 else 92 Tmp_Title := New_String (Title); 93 end if; 94 Tmp_Return := Internal (Tmp_Title, Get_Object_Or_Null (GObject (Parent)), Action); 95 Free (Tmp_Title); 96 Set_Object (Dialog, Tmp_Return); 97 end if; 98 end Initialize; 99 100 ---------------- 101 -- Add_Filter -- 102 ---------------- 103 104 procedure Add_Filter 105 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 106 Filter : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class) 107 is 108 procedure Internal (Chooser : System.Address; Filter : System.Address); 109 pragma Import (C, Internal, "gtk_file_chooser_add_filter"); 110 begin 111 Internal (Get_Object (Chooser), Get_Object (Filter)); 112 end Add_Filter; 113 114 ------------------------- 115 -- Add_Shortcut_Folder -- 116 ------------------------- 117 118 function Add_Shortcut_Folder 119 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 120 Folder : UTF8_String) return Boolean 121 is 122 function Internal 123 (Chooser : System.Address; 124 Folder : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 125 pragma Import (C, Internal, "gtk_file_chooser_add_shortcut_folder"); 126 Tmp_Folder : Interfaces.C.Strings.chars_ptr := New_String (Folder); 127 Tmp_Return : Glib.Gboolean; 128 begin 129 Tmp_Return := Internal (Get_Object (Chooser), Tmp_Folder); 130 Free (Tmp_Folder); 131 return Tmp_Return /= 0; 132 end Add_Shortcut_Folder; 133 134 ----------------------------- 135 -- Add_Shortcut_Folder_Uri -- 136 ----------------------------- 137 138 function Add_Shortcut_Folder_Uri 139 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 140 URI : UTF8_String) return Boolean 141 is 142 function Internal 143 (Chooser : System.Address; 144 URI : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 145 pragma Import (C, Internal, "gtk_file_chooser_add_shortcut_folder_uri"); 146 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 147 Tmp_Return : Glib.Gboolean; 148 begin 149 Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI); 150 Free (Tmp_URI); 151 return Tmp_Return /= 0; 152 end Add_Shortcut_Folder_Uri; 153 154 ---------------- 155 -- Get_Action -- 156 ---------------- 157 158 function Get_Action 159 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 160 return Gtk.File_Chooser.Gtk_File_Chooser_Action 161 is 162 function Internal 163 (Chooser : System.Address) 164 return Gtk.File_Chooser.Gtk_File_Chooser_Action; 165 pragma Import (C, Internal, "gtk_file_chooser_get_action"); 166 begin 167 return Internal (Get_Object (Chooser)); 168 end Get_Action; 169 170 ------------------------ 171 -- Get_Create_Folders -- 172 ------------------------ 173 174 function Get_Create_Folders 175 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 176 return Boolean 177 is 178 function Internal (Chooser : System.Address) return Glib.Gboolean; 179 pragma Import (C, Internal, "gtk_file_chooser_get_create_folders"); 180 begin 181 return Internal (Get_Object (Chooser)) /= 0; 182 end Get_Create_Folders; 183 184 ------------------------ 185 -- Get_Current_Folder -- 186 ------------------------ 187 188 function Get_Current_Folder 189 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 190 return UTF8_String 191 is 192 function Internal 193 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 194 pragma Import (C, Internal, "gtk_file_chooser_get_current_folder"); 195 begin 196 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 197 end Get_Current_Folder; 198 199 ---------------------------- 200 -- Get_Current_Folder_Uri -- 201 ---------------------------- 202 203 function Get_Current_Folder_Uri 204 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 205 return UTF8_String 206 is 207 function Internal 208 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 209 pragma Import (C, Internal, "gtk_file_chooser_get_current_folder_uri"); 210 begin 211 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 212 end Get_Current_Folder_Uri; 213 214 ---------------------- 215 -- Get_Current_Name -- 216 ---------------------- 217 218 function Get_Current_Name 219 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 220 return UTF8_String 221 is 222 function Internal 223 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 224 pragma Import (C, Internal, "gtk_file_chooser_get_current_name"); 225 begin 226 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 227 end Get_Current_Name; 228 229 ----------------------------------- 230 -- Get_Do_Overwrite_Confirmation -- 231 ----------------------------------- 232 233 function Get_Do_Overwrite_Confirmation 234 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 235 return Boolean 236 is 237 function Internal (Chooser : System.Address) return Glib.Gboolean; 238 pragma Import (C, Internal, "gtk_file_chooser_get_do_overwrite_confirmation"); 239 begin 240 return Internal (Get_Object (Chooser)) /= 0; 241 end Get_Do_Overwrite_Confirmation; 242 243 ---------------------- 244 -- Get_Extra_Widget -- 245 ---------------------- 246 247 function Get_Extra_Widget 248 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 249 return Gtk.Widget.Gtk_Widget 250 is 251 function Internal (Chooser : System.Address) return System.Address; 252 pragma Import (C, Internal, "gtk_file_chooser_get_extra_widget"); 253 Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record; 254 begin 255 return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Chooser)), Stub_Gtk_Widget)); 256 end Get_Extra_Widget; 257 258 ------------------ 259 -- Get_Filename -- 260 ------------------ 261 262 function Get_Filename 263 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 264 return UTF8_String 265 is 266 function Internal 267 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 268 pragma Import (C, Internal, "gtk_file_chooser_get_filename"); 269 begin 270 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 271 end Get_Filename; 272 273 ------------------- 274 -- Get_Filenames -- 275 ------------------- 276 277 function Get_Filenames 278 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 279 return Gtk.Enums.String_SList.GSlist 280 is 281 function Internal (Chooser : System.Address) return System.Address; 282 pragma Import (C, Internal, "gtk_file_chooser_get_filenames"); 283 Tmp_Return : Gtk.Enums.String_SList.GSlist; 284 begin 285 Gtk.Enums.String_SList.Set_Object (Tmp_Return, Internal (Get_Object (Chooser))); 286 return Tmp_Return; 287 end Get_Filenames; 288 289 ---------------- 290 -- Get_Filter -- 291 ---------------- 292 293 function Get_Filter 294 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 295 return Gtk.File_Filter.Gtk_File_Filter 296 is 297 function Internal (Chooser : System.Address) return System.Address; 298 pragma Import (C, Internal, "gtk_file_chooser_get_filter"); 299 Stub_Gtk_File_Filter : Gtk.File_Filter.Gtk_File_Filter_Record; 300 begin 301 return Gtk.File_Filter.Gtk_File_Filter (Get_User_Data (Internal (Get_Object (Chooser)), Stub_Gtk_File_Filter)); 302 end Get_Filter; 303 304 -------------------- 305 -- Get_Local_Only -- 306 -------------------- 307 308 function Get_Local_Only 309 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 310 return Boolean 311 is 312 function Internal (Chooser : System.Address) return Glib.Gboolean; 313 pragma Import (C, Internal, "gtk_file_chooser_get_local_only"); 314 begin 315 return Internal (Get_Object (Chooser)) /= 0; 316 end Get_Local_Only; 317 318 -------------------------- 319 -- Get_Preview_Filename -- 320 -------------------------- 321 322 function Get_Preview_Filename 323 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 324 return UTF8_String 325 is 326 function Internal 327 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 328 pragma Import (C, Internal, "gtk_file_chooser_get_preview_filename"); 329 begin 330 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 331 end Get_Preview_Filename; 332 333 --------------------- 334 -- Get_Preview_Uri -- 335 --------------------- 336 337 function Get_Preview_Uri 338 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 339 return UTF8_String 340 is 341 function Internal 342 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 343 pragma Import (C, Internal, "gtk_file_chooser_get_preview_uri"); 344 begin 345 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 346 end Get_Preview_Uri; 347 348 ------------------------ 349 -- Get_Preview_Widget -- 350 ------------------------ 351 352 function Get_Preview_Widget 353 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 354 return Gtk.Widget.Gtk_Widget 355 is 356 function Internal (Chooser : System.Address) return System.Address; 357 pragma Import (C, Internal, "gtk_file_chooser_get_preview_widget"); 358 Stub_Gtk_Widget : Gtk.Widget.Gtk_Widget_Record; 359 begin 360 return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Chooser)), Stub_Gtk_Widget)); 361 end Get_Preview_Widget; 362 363 ------------------------------- 364 -- Get_Preview_Widget_Active -- 365 ------------------------------- 366 367 function Get_Preview_Widget_Active 368 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 369 return Boolean 370 is 371 function Internal (Chooser : System.Address) return Glib.Gboolean; 372 pragma Import (C, Internal, "gtk_file_chooser_get_preview_widget_active"); 373 begin 374 return Internal (Get_Object (Chooser)) /= 0; 375 end Get_Preview_Widget_Active; 376 377 ------------------------- 378 -- Get_Select_Multiple -- 379 ------------------------- 380 381 function Get_Select_Multiple 382 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 383 return Boolean 384 is 385 function Internal (Chooser : System.Address) return Glib.Gboolean; 386 pragma Import (C, Internal, "gtk_file_chooser_get_select_multiple"); 387 begin 388 return Internal (Get_Object (Chooser)) /= 0; 389 end Get_Select_Multiple; 390 391 --------------------- 392 -- Get_Show_Hidden -- 393 --------------------- 394 395 function Get_Show_Hidden 396 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 397 return Boolean 398 is 399 function Internal (Chooser : System.Address) return Glib.Gboolean; 400 pragma Import (C, Internal, "gtk_file_chooser_get_show_hidden"); 401 begin 402 return Internal (Get_Object (Chooser)) /= 0; 403 end Get_Show_Hidden; 404 405 ------------- 406 -- Get_Uri -- 407 ------------- 408 409 function Get_Uri 410 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 411 return UTF8_String 412 is 413 function Internal 414 (Chooser : System.Address) return Interfaces.C.Strings.chars_ptr; 415 pragma Import (C, Internal, "gtk_file_chooser_get_uri"); 416 begin 417 return Gtkada.Bindings.Value_And_Free (Internal (Get_Object (Chooser))); 418 end Get_Uri; 419 420 -------------- 421 -- Get_Uris -- 422 -------------- 423 424 function Get_Uris 425 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 426 return Gtk.Enums.String_SList.GSlist 427 is 428 function Internal (Chooser : System.Address) return System.Address; 429 pragma Import (C, Internal, "gtk_file_chooser_get_uris"); 430 Tmp_Return : Gtk.Enums.String_SList.GSlist; 431 begin 432 Gtk.Enums.String_SList.Set_Object (Tmp_Return, Internal (Get_Object (Chooser))); 433 return Tmp_Return; 434 end Get_Uris; 435 436 --------------------------- 437 -- Get_Use_Preview_Label -- 438 --------------------------- 439 440 function Get_Use_Preview_Label 441 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 442 return Boolean 443 is 444 function Internal (Chooser : System.Address) return Glib.Gboolean; 445 pragma Import (C, Internal, "gtk_file_chooser_get_use_preview_label"); 446 begin 447 return Internal (Get_Object (Chooser)) /= 0; 448 end Get_Use_Preview_Label; 449 450 ------------------ 451 -- List_Filters -- 452 ------------------ 453 454 function List_Filters 455 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 456 return Glib.Object.Object_List.GSlist 457 is 458 function Internal (Chooser : System.Address) return System.Address; 459 pragma Import (C, Internal, "gtk_file_chooser_list_filters"); 460 Tmp_Return : Glib.Object.Object_List.GSlist; 461 begin 462 Glib.Object.Object_List.Set_Object (Tmp_Return, Internal (Get_Object (Chooser))); 463 return Tmp_Return; 464 end List_Filters; 465 466 ------------------------------- 467 -- List_Shortcut_Folder_Uris -- 468 ------------------------------- 469 470 function List_Shortcut_Folder_Uris 471 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 472 return Gtk.Enums.String_SList.GSlist 473 is 474 function Internal (Chooser : System.Address) return System.Address; 475 pragma Import (C, Internal, "gtk_file_chooser_list_shortcut_folder_uris"); 476 Tmp_Return : Gtk.Enums.String_SList.GSlist; 477 begin 478 Gtk.Enums.String_SList.Set_Object (Tmp_Return, Internal (Get_Object (Chooser))); 479 return Tmp_Return; 480 end List_Shortcut_Folder_Uris; 481 482 --------------------------- 483 -- List_Shortcut_Folders -- 484 --------------------------- 485 486 function List_Shortcut_Folders 487 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 488 return Gtk.Enums.String_SList.GSlist 489 is 490 function Internal (Chooser : System.Address) return System.Address; 491 pragma Import (C, Internal, "gtk_file_chooser_list_shortcut_folders"); 492 Tmp_Return : Gtk.Enums.String_SList.GSlist; 493 begin 494 Gtk.Enums.String_SList.Set_Object (Tmp_Return, Internal (Get_Object (Chooser))); 495 return Tmp_Return; 496 end List_Shortcut_Folders; 497 498 ------------------- 499 -- Remove_Filter -- 500 ------------------- 501 502 procedure Remove_Filter 503 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 504 Filter : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class) 505 is 506 procedure Internal (Chooser : System.Address; Filter : System.Address); 507 pragma Import (C, Internal, "gtk_file_chooser_remove_filter"); 508 begin 509 Internal (Get_Object (Chooser), Get_Object (Filter)); 510 end Remove_Filter; 511 512 ---------------------------- 513 -- Remove_Shortcut_Folder -- 514 ---------------------------- 515 516 function Remove_Shortcut_Folder 517 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 518 Folder : UTF8_String) return Boolean 519 is 520 function Internal 521 (Chooser : System.Address; 522 Folder : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 523 pragma Import (C, Internal, "gtk_file_chooser_remove_shortcut_folder"); 524 Tmp_Folder : Interfaces.C.Strings.chars_ptr := New_String (Folder); 525 Tmp_Return : Glib.Gboolean; 526 begin 527 Tmp_Return := Internal (Get_Object (Chooser), Tmp_Folder); 528 Free (Tmp_Folder); 529 return Tmp_Return /= 0; 530 end Remove_Shortcut_Folder; 531 532 -------------------------------- 533 -- Remove_Shortcut_Folder_Uri -- 534 -------------------------------- 535 536 function Remove_Shortcut_Folder_Uri 537 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 538 URI : UTF8_String) return Boolean 539 is 540 function Internal 541 (Chooser : System.Address; 542 URI : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 543 pragma Import (C, Internal, "gtk_file_chooser_remove_shortcut_folder_uri"); 544 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 545 Tmp_Return : Glib.Gboolean; 546 begin 547 Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI); 548 Free (Tmp_URI); 549 return Tmp_Return /= 0; 550 end Remove_Shortcut_Folder_Uri; 551 552 ---------------- 553 -- Select_All -- 554 ---------------- 555 556 procedure Select_All 557 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 558 is 559 procedure Internal (Chooser : System.Address); 560 pragma Import (C, Internal, "gtk_file_chooser_select_all"); 561 begin 562 Internal (Get_Object (Chooser)); 563 end Select_All; 564 565 --------------------- 566 -- Select_Filename -- 567 --------------------- 568 569 function Select_Filename 570 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 571 Filename : UTF8_String) return Boolean 572 is 573 function Internal 574 (Chooser : System.Address; 575 Filename : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 576 pragma Import (C, Internal, "gtk_file_chooser_select_filename"); 577 Tmp_Filename : Interfaces.C.Strings.chars_ptr := New_String (Filename); 578 Tmp_Return : Glib.Gboolean; 579 begin 580 Tmp_Return := Internal (Get_Object (Chooser), Tmp_Filename); 581 Free (Tmp_Filename); 582 return Tmp_Return /= 0; 583 end Select_Filename; 584 585 ---------------- 586 -- Select_Uri -- 587 ---------------- 588 589 function Select_Uri 590 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 591 URI : UTF8_String) return Boolean 592 is 593 function Internal 594 (Chooser : System.Address; 595 URI : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 596 pragma Import (C, Internal, "gtk_file_chooser_select_uri"); 597 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 598 Tmp_Return : Glib.Gboolean; 599 begin 600 Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI); 601 Free (Tmp_URI); 602 return Tmp_Return /= 0; 603 end Select_Uri; 604 605 ---------------- 606 -- Set_Action -- 607 ---------------- 608 609 procedure Set_Action 610 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 611 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 612 is 613 procedure Internal 614 (Chooser : System.Address; 615 Action : Gtk.File_Chooser.Gtk_File_Chooser_Action); 616 pragma Import (C, Internal, "gtk_file_chooser_set_action"); 617 begin 618 Internal (Get_Object (Chooser), Action); 619 end Set_Action; 620 621 ------------------------ 622 -- Set_Create_Folders -- 623 ------------------------ 624 625 procedure Set_Create_Folders 626 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 627 Create_Folders : Boolean) 628 is 629 procedure Internal 630 (Chooser : System.Address; 631 Create_Folders : Glib.Gboolean); 632 pragma Import (C, Internal, "gtk_file_chooser_set_create_folders"); 633 begin 634 Internal (Get_Object (Chooser), Boolean'Pos (Create_Folders)); 635 end Set_Create_Folders; 636 637 ------------------------ 638 -- Set_Current_Folder -- 639 ------------------------ 640 641 function Set_Current_Folder 642 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 643 Filename : UTF8_String) return Boolean 644 is 645 function Internal 646 (Chooser : System.Address; 647 Filename : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 648 pragma Import (C, Internal, "gtk_file_chooser_set_current_folder"); 649 Tmp_Filename : Interfaces.C.Strings.chars_ptr := New_String (Filename); 650 Tmp_Return : Glib.Gboolean; 651 begin 652 Tmp_Return := Internal (Get_Object (Chooser), Tmp_Filename); 653 Free (Tmp_Filename); 654 return Tmp_Return /= 0; 655 end Set_Current_Folder; 656 657 ---------------------------- 658 -- Set_Current_Folder_Uri -- 659 ---------------------------- 660 661 function Set_Current_Folder_Uri 662 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 663 URI : UTF8_String) return Boolean 664 is 665 function Internal 666 (Chooser : System.Address; 667 URI : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 668 pragma Import (C, Internal, "gtk_file_chooser_set_current_folder_uri"); 669 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 670 Tmp_Return : Glib.Gboolean; 671 begin 672 Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI); 673 Free (Tmp_URI); 674 return Tmp_Return /= 0; 675 end Set_Current_Folder_Uri; 676 677 ---------------------- 678 -- Set_Current_Name -- 679 ---------------------- 680 681 procedure Set_Current_Name 682 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 683 Name : UTF8_String) 684 is 685 procedure Internal 686 (Chooser : System.Address; 687 Name : Interfaces.C.Strings.chars_ptr); 688 pragma Import (C, Internal, "gtk_file_chooser_set_current_name"); 689 Tmp_Name : Interfaces.C.Strings.chars_ptr := New_String (Name); 690 begin 691 Internal (Get_Object (Chooser), Tmp_Name); 692 Free (Tmp_Name); 693 end Set_Current_Name; 694 695 ----------------------------------- 696 -- Set_Do_Overwrite_Confirmation -- 697 ----------------------------------- 698 699 procedure Set_Do_Overwrite_Confirmation 700 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 701 Do_Overwrite_Confirmation : Boolean) 702 is 703 procedure Internal 704 (Chooser : System.Address; 705 Do_Overwrite_Confirmation : Glib.Gboolean); 706 pragma Import (C, Internal, "gtk_file_chooser_set_do_overwrite_confirmation"); 707 begin 708 Internal (Get_Object (Chooser), Boolean'Pos (Do_Overwrite_Confirmation)); 709 end Set_Do_Overwrite_Confirmation; 710 711 ---------------------- 712 -- Set_Extra_Widget -- 713 ---------------------- 714 715 procedure Set_Extra_Widget 716 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 717 Extra_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class) 718 is 719 procedure Internal 720 (Chooser : System.Address; 721 Extra_Widget : System.Address); 722 pragma Import (C, Internal, "gtk_file_chooser_set_extra_widget"); 723 begin 724 Internal (Get_Object (Chooser), Get_Object (Extra_Widget)); 725 end Set_Extra_Widget; 726 727 ------------------ 728 -- Set_Filename -- 729 ------------------ 730 731 function Set_Filename 732 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 733 Filename : UTF8_String) return Boolean 734 is 735 function Internal 736 (Chooser : System.Address; 737 Filename : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 738 pragma Import (C, Internal, "gtk_file_chooser_set_filename"); 739 Tmp_Filename : Interfaces.C.Strings.chars_ptr := New_String (Filename); 740 Tmp_Return : Glib.Gboolean; 741 begin 742 Tmp_Return := Internal (Get_Object (Chooser), Tmp_Filename); 743 Free (Tmp_Filename); 744 return Tmp_Return /= 0; 745 end Set_Filename; 746 747 ---------------- 748 -- Set_Filter -- 749 ---------------- 750 751 procedure Set_Filter 752 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 753 Filter : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class) 754 is 755 procedure Internal (Chooser : System.Address; Filter : System.Address); 756 pragma Import (C, Internal, "gtk_file_chooser_set_filter"); 757 begin 758 Internal (Get_Object (Chooser), Get_Object (Filter)); 759 end Set_Filter; 760 761 -------------------- 762 -- Set_Local_Only -- 763 -------------------- 764 765 procedure Set_Local_Only 766 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 767 Local_Only : Boolean) 768 is 769 procedure Internal 770 (Chooser : System.Address; 771 Local_Only : Glib.Gboolean); 772 pragma Import (C, Internal, "gtk_file_chooser_set_local_only"); 773 begin 774 Internal (Get_Object (Chooser), Boolean'Pos (Local_Only)); 775 end Set_Local_Only; 776 777 ------------------------ 778 -- Set_Preview_Widget -- 779 ------------------------ 780 781 procedure Set_Preview_Widget 782 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 783 Preview_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class) 784 is 785 procedure Internal 786 (Chooser : System.Address; 787 Preview_Widget : System.Address); 788 pragma Import (C, Internal, "gtk_file_chooser_set_preview_widget"); 789 begin 790 Internal (Get_Object (Chooser), Get_Object (Preview_Widget)); 791 end Set_Preview_Widget; 792 793 ------------------------------- 794 -- Set_Preview_Widget_Active -- 795 ------------------------------- 796 797 procedure Set_Preview_Widget_Active 798 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 799 Active : Boolean) 800 is 801 procedure Internal (Chooser : System.Address; Active : Glib.Gboolean); 802 pragma Import (C, Internal, "gtk_file_chooser_set_preview_widget_active"); 803 begin 804 Internal (Get_Object (Chooser), Boolean'Pos (Active)); 805 end Set_Preview_Widget_Active; 806 807 ------------------------- 808 -- Set_Select_Multiple -- 809 ------------------------- 810 811 procedure Set_Select_Multiple 812 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 813 Select_Multiple : Boolean) 814 is 815 procedure Internal 816 (Chooser : System.Address; 817 Select_Multiple : Glib.Gboolean); 818 pragma Import (C, Internal, "gtk_file_chooser_set_select_multiple"); 819 begin 820 Internal (Get_Object (Chooser), Boolean'Pos (Select_Multiple)); 821 end Set_Select_Multiple; 822 823 --------------------- 824 -- Set_Show_Hidden -- 825 --------------------- 826 827 procedure Set_Show_Hidden 828 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 829 Show_Hidden : Boolean) 830 is 831 procedure Internal 832 (Chooser : System.Address; 833 Show_Hidden : Glib.Gboolean); 834 pragma Import (C, Internal, "gtk_file_chooser_set_show_hidden"); 835 begin 836 Internal (Get_Object (Chooser), Boolean'Pos (Show_Hidden)); 837 end Set_Show_Hidden; 838 839 ------------- 840 -- Set_Uri -- 841 ------------- 842 843 function Set_Uri 844 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 845 URI : UTF8_String) return Boolean 846 is 847 function Internal 848 (Chooser : System.Address; 849 URI : Interfaces.C.Strings.chars_ptr) return Glib.Gboolean; 850 pragma Import (C, Internal, "gtk_file_chooser_set_uri"); 851 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 852 Tmp_Return : Glib.Gboolean; 853 begin 854 Tmp_Return := Internal (Get_Object (Chooser), Tmp_URI); 855 Free (Tmp_URI); 856 return Tmp_Return /= 0; 857 end Set_Uri; 858 859 --------------------------- 860 -- Set_Use_Preview_Label -- 861 --------------------------- 862 863 procedure Set_Use_Preview_Label 864 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 865 Use_Label : Boolean) 866 is 867 procedure Internal 868 (Chooser : System.Address; 869 Use_Label : Glib.Gboolean); 870 pragma Import (C, Internal, "gtk_file_chooser_set_use_preview_label"); 871 begin 872 Internal (Get_Object (Chooser), Boolean'Pos (Use_Label)); 873 end Set_Use_Preview_Label; 874 875 ------------------ 876 -- Unselect_All -- 877 ------------------ 878 879 procedure Unselect_All 880 (Chooser : not null access Gtk_File_Chooser_Dialog_Record) 881 is 882 procedure Internal (Chooser : System.Address); 883 pragma Import (C, Internal, "gtk_file_chooser_unselect_all"); 884 begin 885 Internal (Get_Object (Chooser)); 886 end Unselect_All; 887 888 ----------------------- 889 -- Unselect_Filename -- 890 ----------------------- 891 892 procedure Unselect_Filename 893 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 894 Filename : UTF8_String) 895 is 896 procedure Internal 897 (Chooser : System.Address; 898 Filename : Interfaces.C.Strings.chars_ptr); 899 pragma Import (C, Internal, "gtk_file_chooser_unselect_filename"); 900 Tmp_Filename : Interfaces.C.Strings.chars_ptr := New_String (Filename); 901 begin 902 Internal (Get_Object (Chooser), Tmp_Filename); 903 Free (Tmp_Filename); 904 end Unselect_Filename; 905 906 ------------------ 907 -- Unselect_Uri -- 908 ------------------ 909 910 procedure Unselect_Uri 911 (Chooser : not null access Gtk_File_Chooser_Dialog_Record; 912 URI : UTF8_String) 913 is 914 procedure Internal 915 (Chooser : System.Address; 916 URI : Interfaces.C.Strings.chars_ptr); 917 pragma Import (C, Internal, "gtk_file_chooser_unselect_uri"); 918 Tmp_URI : Interfaces.C.Strings.chars_ptr := New_String (URI); 919 begin 920 Internal (Get_Object (Chooser), Tmp_URI); 921 Free (Tmp_URI); 922 end Unselect_Uri; 923 924end Gtk.File_Chooser_Dialog; 925