/usr/include/d/gtkd-3/gtk/PlacesSidebar.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.PlacesSidebar;
private import gdk.DragContext;
private import gio.FileIF;
private import gio.MountOperation;
private import gio.VolumeIF;
private import glib.ConstructionException;
private import glib.ListG;
private import glib.ListSG;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.ScrolledWindow;
private import gtk.Widget;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* #GtkPlacesSidebar is a widget that displays a list of frequently-used places in the
* file system: the user’s home directory, the user’s bookmarks, and volumes and drives.
* This widget is used as a sidebar in #GtkFileChooser and may be used by file managers
* and similar programs.
*
* The places sidebar displays drives and volumes, and will automatically mount
* or unmount them when the user selects them.
*
* Applications can hook to various signals in the places sidebar to customize
* its behavior. For example, they can add extra commands to the context menu
* of the sidebar.
*
* While bookmarks are completely in control of the user, the places sidebar also
* allows individual applications to provide extra shortcut folders that are unique
* to each application. For example, a Paint program may want to add a shortcut
* for a Clipart folder. You can do this with gtk_places_sidebar_add_shortcut().
*
* To make use of the places sidebar, an application at least needs to connect
* to the #GtkPlacesSidebar::open-location signal. This is emitted when the
* user selects in the sidebar a location to open. The application should also
* call gtk_places_sidebar_set_location() when it changes the currently-viewed
* location.
*
* # CSS nodes
*
* GtkPlacesSidebar uses a single CSS node with name placessidebar and style
* class .sidebar.
*
* Among the children of the places sidebar, the following style classes can
* be used:
* - .sidebar-new-bookmark-row for the 'Add new bookmark' row
* - .sidebar-placeholder-row for a row that is a placeholder
* - .has-open-popup when a popup is open for a row
*/
public class PlacesSidebar : ScrolledWindow
{
/** the main Gtk struct */
protected GtkPlacesSidebar* gtkPlacesSidebar;
/** Get the main Gtk struct */
public GtkPlacesSidebar* getPlacesSidebarStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkPlacesSidebar;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkPlacesSidebar;
}
protected override void setStruct(GObject* obj)
{
gtkPlacesSidebar = cast(GtkPlacesSidebar*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkPlacesSidebar* gtkPlacesSidebar, bool ownedRef = false)
{
this.gtkPlacesSidebar = gtkPlacesSidebar;
super(cast(GtkScrolledWindow*)gtkPlacesSidebar, ownedRef);
}
/** */
public static GType getType()
{
return gtk_places_sidebar_get_type();
}
/**
* Creates a new #GtkPlacesSidebar widget.
*
* The application should connect to at least the
* #GtkPlacesSidebar::open-location signal to be notified
* when the user makes a selection in the sidebar.
*
* Returns: a newly created #GtkPlacesSidebar
*
* Since: 3.10
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = gtk_places_sidebar_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkPlacesSidebar*) p);
}
/**
* Applications may want to present some folders in the places sidebar if
* they could be immediately useful to users. For example, a drawing
* program could add a “/usr/share/clipart” location when the sidebar is
* being used in an “Insert Clipart” dialog box.
*
* This function adds the specified @location to a special place for immutable
* shortcuts. The shortcuts are application-specific; they are not shared
* across applications, and they are not persistent. If this function
* is called multiple times with different locations, then they are added
* to the sidebar’s list in the same order as the function is called.
*
* Params:
* location = location to add as an application-specific shortcut
*
* Since: 3.10
*/
public void addShortcut(FileIF location)
{
gtk_places_sidebar_add_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
}
/**
* Returns the value previously set with gtk_places_sidebar_set_local_only().
*
* Returns: %TRUE if the sidebar will only show local files.
*
* Since: 3.12
*/
public bool getLocalOnly()
{
return gtk_places_sidebar_get_local_only(gtkPlacesSidebar) != 0;
}
/**
* Gets the currently-selected location in the @sidebar. This can be #NULL when
* nothing is selected, for example, when gtk_places_sidebar_set_location() has
* been called with a location that is not among the sidebar’s list of places to
* show.
*
* You can use this function to get the selection in the @sidebar. Also, if you
* connect to the #GtkPlacesSidebar::populate-popup signal, you can use this
* function to get the location that is being referred to during the callbacks
* for your menu items.
*
* Returns: a GFile with the selected location, or
* %NULL if nothing is visually selected.
*
* Since: 3.10
*/
public FileIF getLocation()
{
auto p = gtk_places_sidebar_get_location(gtkPlacesSidebar);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(FileIF)(cast(GFile*) p, true);
}
/**
* This function queries the bookmarks added by the user to the places sidebar,
* and returns one of them. This function is used by #GtkFileChooser to implement
* the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
*
* Params:
* n = index of the bookmark to query
*
* Returns: The bookmark specified by the index @n, or
* %NULL if no such index exist. Note that the indices start at 0, even though
* the file chooser starts them with the keyboard shortcut "Alt-1".
*
* Since: 3.10
*/
public FileIF getNthBookmark(int n)
{
auto p = gtk_places_sidebar_get_nth_bookmark(gtkPlacesSidebar, n);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(FileIF)(cast(GFile*) p, true);
}
/**
* Gets the open flags.
*
* Returns: the #GtkPlacesOpenFlags of @sidebar
*
* Since: 3.10
*/
public GtkPlacesOpenFlags getOpenFlags()
{
return gtk_places_sidebar_get_open_flags(gtkPlacesSidebar);
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_connect_to_server()
*
* Deprecated: It is recommended to group this functionality with the drives
* and network location under the new 'Other Location' item
*
* Returns: %TRUE if the sidebar will display a “Connect to Server” item.
*/
public bool getShowConnectToServer()
{
return gtk_places_sidebar_get_show_connect_to_server(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_desktop()
*
* Returns: %TRUE if the sidebar will display a builtin shortcut to the desktop folder.
*
* Since: 3.10
*/
public bool getShowDesktop()
{
return gtk_places_sidebar_get_show_desktop(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_enter_location()
*
* Returns: %TRUE if the sidebar will display an “Enter Location” item.
*
* Since: 3.14
*/
public bool getShowEnterLocation()
{
return gtk_places_sidebar_get_show_enter_location(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_other_locations()
*
* Returns: %TRUE if the sidebar will display an “Other Locations” item.
*
* Since: 3.18
*/
public bool getShowOtherLocations()
{
return gtk_places_sidebar_get_show_other_locations(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_recent()
*
* Returns: %TRUE if the sidebar will display a builtin shortcut for recent files
*
* Since: 3.18
*/
public bool getShowRecent()
{
return gtk_places_sidebar_get_show_recent(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_starred_location()
*
* Returns: %TRUE if the sidebar will display a Starred item.
*
* Since: 3.22.26
*/
public bool getShowStarredLocation()
{
return gtk_places_sidebar_get_show_starred_location(gtkPlacesSidebar) != 0;
}
/**
* Returns the value previously set with gtk_places_sidebar_set_show_trash()
*
* Returns: %TRUE if the sidebar will display a “Trash” item.
*
* Since: 3.18
*/
public bool getShowTrash()
{
return gtk_places_sidebar_get_show_trash(gtkPlacesSidebar) != 0;
}
/**
* Gets the list of shortcuts.
*
* Returns: A #GSList of #GFile of the locations that have been added as
* application-specific shortcuts with gtk_places_sidebar_add_shortcut().
* To free this list, you can use
* |[<!-- language="C" -->
* g_slist_free_full (list, (GDestroyNotify) g_object_unref);
* ]|
*
* Since: 3.10
*/
public ListSG listShortcuts()
{
auto p = gtk_places_sidebar_list_shortcuts(gtkPlacesSidebar);
if(p is null)
{
return null;
}
return new ListSG(cast(GSList*) p, true);
}
/**
* Removes an application-specific shortcut that has been previously been
* inserted with gtk_places_sidebar_add_shortcut(). If the @location is not a
* shortcut in the sidebar, then nothing is done.
*
* Params:
* location = location to remove
*
* Since: 3.10
*/
public void removeShortcut(FileIF location)
{
gtk_places_sidebar_remove_shortcut(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
}
/**
* Make the GtkPlacesSidebar show drop targets, so it can show the available
* drop targets and a "new bookmark" row. This improves the Drag-and-Drop
* experience of the user and allows applications to show all available
* drop targets at once.
*
* This needs to be called when the application is aware of an ongoing drag
* that might target the sidebar. The drop-targets-visible state will be unset
* automatically if the drag finishes in the GtkPlacesSidebar. You only need
* to unset the state when the drag ends on some other widget on your application.
*
* Params:
* visible = whether to show the valid targets or not.
* context = drag context used to ask the source about the action that wants to
* perform, so hints are more accurate.
*
* Since: 3.18
*/
public void setDropTargetsVisible(bool visible, DragContext context)
{
gtk_places_sidebar_set_drop_targets_visible(gtkPlacesSidebar, visible, (context is null) ? null : context.getDragContextStruct());
}
/**
* Sets whether the @sidebar should only show local files.
*
* Params:
* localOnly = whether to show only local files
*
* Since: 3.12
*/
public void setLocalOnly(bool localOnly)
{
gtk_places_sidebar_set_local_only(gtkPlacesSidebar, localOnly);
}
/**
* Sets the location that is being shown in the widgets surrounding the
* @sidebar, for example, in a folder view in a file manager. In turn, the
* @sidebar will highlight that location if it is being shown in the list of
* places, or it will unhighlight everything if the @location is not among the
* places in the list.
*
* Params:
* location = location to select, or #NULL for no current path
*
* Since: 3.10
*/
public void setLocation(FileIF location)
{
gtk_places_sidebar_set_location(gtkPlacesSidebar, (location is null) ? null : location.getFileStruct());
}
/**
* Sets the way in which the calling application can open new locations from
* the places sidebar. For example, some applications only open locations
* “directly” into their main view, while others may support opening locations
* in a new notebook tab or a new window.
*
* This function is used to tell the places @sidebar about the ways in which the
* application can open new locations, so that the sidebar can display (or not)
* the “Open in new tab” and “Open in new window” menu items as appropriate.
*
* When the #GtkPlacesSidebar::open-location signal is emitted, its flags
* argument will be set to one of the @flags that was passed in
* gtk_places_sidebar_set_open_flags().
*
* Passing 0 for @flags will cause #GTK_PLACES_OPEN_NORMAL to always be sent
* to callbacks for the “open-location” signal.
*
* Params:
* flags = Bitmask of modes in which the calling application can open locations
*
* Since: 3.10
*/
public void setOpenFlags(GtkPlacesOpenFlags flags)
{
gtk_places_sidebar_set_open_flags(gtkPlacesSidebar, flags);
}
/**
* Sets whether the @sidebar should show an item for connecting to a network server;
* this is off by default. An application may want to turn this on if it implements
* a way for the user to connect to network servers directly.
*
* If you enable this, you should connect to the
* #GtkPlacesSidebar::show-connect-to-server signal.
*
* Deprecated: It is recommended to group this functionality with the drives
* and network location under the new 'Other Location' item
*
* Params:
* showConnectToServer = whether to show an item for the Connect to Server command
*
* Since: 3.10
*/
public void setShowConnectToServer(bool showConnectToServer)
{
gtk_places_sidebar_set_show_connect_to_server(gtkPlacesSidebar, showConnectToServer);
}
/**
* Sets whether the @sidebar should show an item for the Desktop folder.
* The default value for this option is determined by the desktop
* environment and the user’s configuration, but this function can be
* used to override it on a per-application basis.
*
* Params:
* showDesktop = whether to show an item for the Desktop folder
*
* Since: 3.10
*/
public void setShowDesktop(bool showDesktop)
{
gtk_places_sidebar_set_show_desktop(gtkPlacesSidebar, showDesktop);
}
/**
* Sets whether the @sidebar should show an item for entering a location;
* this is off by default. An application may want to turn this on if manually
* entering URLs is an expected user action.
*
* If you enable this, you should connect to the
* #GtkPlacesSidebar::show-enter-location signal.
*
* Params:
* showEnterLocation = whether to show an item to enter a location
*
* Since: 3.14
*/
public void setShowEnterLocation(bool showEnterLocation)
{
gtk_places_sidebar_set_show_enter_location(gtkPlacesSidebar, showEnterLocation);
}
/**
* Sets whether the @sidebar should show an item for the application to show
* an Other Locations view; this is off by default. When set to %TRUE, persistent
* devices such as hard drives are hidden, otherwise they are shown in the sidebar.
* An application may want to turn this on if it implements a way for the user to
* see and interact with drives and network servers directly.
*
* If you enable this, you should connect to the
* #GtkPlacesSidebar::show-other-locations signal.
*
* Params:
* showOtherLocations = whether to show an item for the Other Locations view
*
* Since: 3.18
*/
public void setShowOtherLocations(bool showOtherLocations)
{
gtk_places_sidebar_set_show_other_locations(gtkPlacesSidebar, showOtherLocations);
}
/**
* Sets whether the @sidebar should show an item for recent files.
* The default value for this option is determined by the desktop
* environment, but this function can be used to override it on a
* per-application basis.
*
* Params:
* showRecent = whether to show an item for recent files
*
* Since: 3.18
*/
public void setShowRecent(bool showRecent)
{
gtk_places_sidebar_set_show_recent(gtkPlacesSidebar, showRecent);
}
/**
* If you enable this, you should connect to the
* #GtkPlacesSidebar::show-starred-location signal.
*
* Params:
* showStarredLocation = whether to show an item for Starred files
*
* Since: 3.22.26
*/
public void setShowStarredLocation(bool showStarredLocation)
{
gtk_places_sidebar_set_show_starred_location(gtkPlacesSidebar, showStarredLocation);
}
/**
* Sets whether the @sidebar should show an item for the Trash location.
*
* Params:
* showTrash = whether to show an item for the Trash location
*
* Since: 3.18
*/
public void setShowTrash(bool showTrash)
{
gtk_places_sidebar_set_show_trash(gtkPlacesSidebar, showTrash);
}
protected class OnDragActionAskDelegateWrapper
{
int delegate(int, PlacesSidebar) dlg;
gulong handlerId;
this(int delegate(int, PlacesSidebar) dlg)
{
this.dlg = dlg;
onDragActionAskListeners ~= this;
}
void remove(OnDragActionAskDelegateWrapper source)
{
foreach(index, wrapper; onDragActionAskListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onDragActionAskListeners[index] = null;
onDragActionAskListeners = std.algorithm.remove(onDragActionAskListeners, index);
break;
}
}
}
}
OnDragActionAskDelegateWrapper[] onDragActionAskListeners;
/**
* The places sidebar emits this signal when it needs to ask the application
* to pop up a menu to ask the user for which drag action to perform.
*
* Params:
* actions = Possible drag actions that need to be asked for.
*
* Returns: the final drag action that the sidebar should pass to the drag side
* of the drag-and-drop operation.
*
* Since: 3.10
*/
gulong addOnDragActionAsk(int delegate(int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnDragActionAskDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"drag-action-ask",
cast(GCallback)&callBackDragActionAsk,
cast(void*)wrapper,
cast(GClosureNotify)&callBackDragActionAskDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackDragActionAsk(GtkPlacesSidebar* placessidebarStruct, int actions, OnDragActionAskDelegateWrapper wrapper)
{
return wrapper.dlg(actions, wrapper.outer);
}
extern(C) static void callBackDragActionAskDestroy(OnDragActionAskDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnDragActionRequestedDelegateWrapper
{
int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg;
gulong handlerId;
this(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg)
{
this.dlg = dlg;
onDragActionRequestedListeners ~= this;
}
void remove(OnDragActionRequestedDelegateWrapper source)
{
foreach(index, wrapper; onDragActionRequestedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onDragActionRequestedListeners[index] = null;
onDragActionRequestedListeners = std.algorithm.remove(onDragActionRequestedListeners, index);
break;
}
}
}
}
OnDragActionRequestedDelegateWrapper[] onDragActionRequestedListeners;
/**
* When the user starts a drag-and-drop operation and the sidebar needs
* to ask the application for which drag action to perform, then the
* sidebar will emit this signal.
*
* The application can evaluate the @context for customary actions, or
* it can check the type of the files indicated by @source_file_list against the
* possible actions for the destination @dest_file.
*
* The drag action to use must be the return value of the signal handler.
*
* Params:
* context = #GdkDragContext with information about the drag operation
* destFile = #GFile with the tentative location that is being hovered for a drop
* sourceFileList = List of #GFile that are being dragged
*
* Returns: The drag action to use, for example, #GDK_ACTION_COPY
* or #GDK_ACTION_MOVE, or 0 if no action is allowed here (i.e. drops
* are not allowed in the specified @dest_file).
*
* Since: 3.10
*/
gulong addOnDragActionRequested(int delegate(DragContext, FileIF, ListG, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnDragActionRequestedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"drag-action-requested",
cast(GCallback)&callBackDragActionRequested,
cast(void*)wrapper,
cast(GClosureNotify)&callBackDragActionRequestedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackDragActionRequested(GtkPlacesSidebar* placessidebarStruct, GdkDragContext* context, GFile* destFile, GList* sourceFileList, OnDragActionRequestedDelegateWrapper wrapper)
{
return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(FileIF)(destFile), new ListG(sourceFileList), wrapper.outer);
}
extern(C) static void callBackDragActionRequestedDestroy(OnDragActionRequestedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnDragPerformDropDelegateWrapper
{
void delegate(FileIF, ListG, int, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(FileIF, ListG, int, PlacesSidebar) dlg)
{
this.dlg = dlg;
onDragPerformDropListeners ~= this;
}
void remove(OnDragPerformDropDelegateWrapper source)
{
foreach(index, wrapper; onDragPerformDropListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onDragPerformDropListeners[index] = null;
onDragPerformDropListeners = std.algorithm.remove(onDragPerformDropListeners, index);
break;
}
}
}
}
OnDragPerformDropDelegateWrapper[] onDragPerformDropListeners;
/**
* The places sidebar emits this signal when the user completes a
* drag-and-drop operation and one of the sidebar's items is the
* destination. This item is in the @dest_file, and the
* @source_file_list has the list of files that are dropped into it and
* which should be copied/moved/etc. based on the specified @action.
*
* Params:
* destFile = Destination #GFile.
* sourceFileList = #GList of #GFile that got dropped.
* action = Drop action to perform.
*
* Since: 3.10
*/
gulong addOnDragPerformDrop(void delegate(FileIF, ListG, int, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnDragPerformDropDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"drag-perform-drop",
cast(GCallback)&callBackDragPerformDrop,
cast(void*)wrapper,
cast(GClosureNotify)&callBackDragPerformDropDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackDragPerformDrop(GtkPlacesSidebar* placessidebarStruct, GFile* destFile, GList* sourceFileList, int action, OnDragPerformDropDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(FileIF)(destFile), new ListG(sourceFileList), action, wrapper.outer);
}
extern(C) static void callBackDragPerformDropDestroy(OnDragPerformDropDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnMountDelegateWrapper
{
void delegate(MountOperation, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(MountOperation, PlacesSidebar) dlg)
{
this.dlg = dlg;
onMountListeners ~= this;
}
void remove(OnMountDelegateWrapper source)
{
foreach(index, wrapper; onMountListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onMountListeners[index] = null;
onMountListeners = std.algorithm.remove(onMountListeners, index);
break;
}
}
}
}
OnMountDelegateWrapper[] onMountListeners;
/**
* The places sidebar emits this signal when it starts a new operation
* because the user clicked on some location that needs mounting.
* In this way the application using the #GtkPlacesSidebar can track the
* progress of the operation and, for example, show a notification.
*
* Params:
* mountOperation = the #GMountOperation that is going to start.
*
* Since: 3.20
*/
gulong addOnMount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnMountDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"mount",
cast(GCallback)&callBackMount,
cast(void*)wrapper,
cast(GClosureNotify)&callBackMountDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackMount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation, OnMountDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
}
extern(C) static void callBackMountDestroy(OnMountDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnOpenLocationDelegateWrapper
{
void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg)
{
this.dlg = dlg;
onOpenLocationListeners ~= this;
}
void remove(OnOpenLocationDelegateWrapper source)
{
foreach(index, wrapper; onOpenLocationListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onOpenLocationListeners[index] = null;
onOpenLocationListeners = std.algorithm.remove(onOpenLocationListeners, index);
break;
}
}
}
}
OnOpenLocationDelegateWrapper[] onOpenLocationListeners;
/**
* The places sidebar emits this signal when the user selects a location
* in it. The calling application should display the contents of that
* location; for example, a file manager should show a list of files in
* the specified location.
*
* Params:
* location = #GFile to which the caller should switch.
* openFlags = a single value from #GtkPlacesOpenFlags specifying how the @location should be opened.
*
* Since: 3.10
*/
gulong addOnOpenLocation(void delegate(FileIF, GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnOpenLocationDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"open-location",
cast(GCallback)&callBackOpenLocation,
cast(void*)wrapper,
cast(GClosureNotify)&callBackOpenLocationDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackOpenLocation(GtkPlacesSidebar* placessidebarStruct, GFile* location, GtkPlacesOpenFlags openFlags, OnOpenLocationDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(FileIF)(location), openFlags, wrapper.outer);
}
extern(C) static void callBackOpenLocationDestroy(OnOpenLocationDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnPopulatePopupDelegateWrapper
{
void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg)
{
this.dlg = dlg;
onPopulatePopupListeners ~= this;
}
void remove(OnPopulatePopupDelegateWrapper source)
{
foreach(index, wrapper; onPopulatePopupListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onPopulatePopupListeners[index] = null;
onPopulatePopupListeners = std.algorithm.remove(onPopulatePopupListeners, index);
break;
}
}
}
}
OnPopulatePopupDelegateWrapper[] onPopulatePopupListeners;
/**
* The places sidebar emits this signal when the user invokes a contextual
* popup on one of its items. In the signal handler, the application may
* add extra items to the menu as appropriate. For example, a file manager
* may want to add a "Properties" command to the menu.
*
* It is not necessary to store the @selected_item for each menu item;
* during their callbacks, the application can use gtk_places_sidebar_get_location()
* to get the file to which the item refers.
*
* The @selected_item argument may be %NULL in case the selection refers to
* a volume. In this case, @selected_volume will be non-%NULL. In this case,
* the calling application will have to g_object_ref() the @selected_volume and
* keep it around to use it in the callback.
*
* The @container and all its contents are destroyed after the user
* dismisses the popup. The popup is re-created (and thus, this signal is
* emitted) every time the user activates the contextual menu.
*
* Before 3.18, the @container always was a #GtkMenu, and you were expected
* to add your items as #GtkMenuItems. Since 3.18, the popup may be implemented
* as a #GtkPopover, in which case @container will be something else, e.g. a
* #GtkBox, to which you may add #GtkModelButtons or other widgets, such as
* #GtkEntries, #GtkSpinButtons, etc. If your application can deal with this
* situation, you can set #GtkPlacesSidebar::populate-all to %TRUE to request
* that this signal is emitted for populating popovers as well.
*
* Params:
* container = a #GtkMenu or another #GtkContainer
* selectedItem = #GFile with the item to which the popup should refer, or #NULL in the case of a @selected_volume.
* selectedVolume = #GVolume if the selected item is a volume, or #NULL if it is a file.
*
* Since: 3.10
*/
gulong addOnPopulatePopup(void delegate(Widget, FileIF, VolumeIF, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnPopulatePopupDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"populate-popup",
cast(GCallback)&callBackPopulatePopup,
cast(void*)wrapper,
cast(GClosureNotify)&callBackPopulatePopupDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackPopulatePopup(GtkPlacesSidebar* placessidebarStruct, GtkWidget* container, GFile* selectedItem, GVolume* selectedVolume, OnPopulatePopupDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Widget)(container), ObjectG.getDObject!(FileIF)(selectedItem), ObjectG.getDObject!(VolumeIF)(selectedVolume), wrapper.outer);
}
extern(C) static void callBackPopulatePopupDestroy(OnPopulatePopupDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowConnectToServerDelegateWrapper
{
void delegate(PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowConnectToServerListeners ~= this;
}
void remove(OnShowConnectToServerDelegateWrapper source)
{
foreach(index, wrapper; onShowConnectToServerListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowConnectToServerListeners[index] = null;
onShowConnectToServerListeners = std.algorithm.remove(onShowConnectToServerListeners, index);
break;
}
}
}
}
OnShowConnectToServerDelegateWrapper[] onShowConnectToServerListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present an way to connect directly to a network server.
* For example, the application may bring up a dialog box asking for
* a URL like "sftp://ftp.example.com". It is up to the application to create
* the corresponding mount by using, for example, g_file_mount_enclosing_volume().
*
* Deprecated: use the #GtkPlacesSidebar::show-other-locations signal
* to connect to network servers.
*/
gulong addOnShowConnectToServer(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowConnectToServerDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-connect-to-server",
cast(GCallback)&callBackShowConnectToServer,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowConnectToServerDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowConnectToServer(GtkPlacesSidebar* placessidebarStruct, OnShowConnectToServerDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackShowConnectToServerDestroy(OnShowConnectToServerDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowEnterLocationDelegateWrapper
{
void delegate(PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowEnterLocationListeners ~= this;
}
void remove(OnShowEnterLocationDelegateWrapper source)
{
foreach(index, wrapper; onShowEnterLocationListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowEnterLocationListeners[index] = null;
onShowEnterLocationListeners = std.algorithm.remove(onShowEnterLocationListeners, index);
break;
}
}
}
}
OnShowEnterLocationDelegateWrapper[] onShowEnterLocationListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present an way to directly enter a location.
* For example, the application may bring up a dialog box asking for
* a URL like "http://http.example.com".
*
* Since: 3.14
*/
gulong addOnShowEnterLocation(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowEnterLocationDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-enter-location",
cast(GCallback)&callBackShowEnterLocation,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowEnterLocationDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowEnterLocation(GtkPlacesSidebar* placessidebarStruct, OnShowEnterLocationDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackShowEnterLocationDestroy(OnShowEnterLocationDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowErrorMessageDelegateWrapper
{
void delegate(string, string, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(string, string, PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowErrorMessageListeners ~= this;
}
void remove(OnShowErrorMessageDelegateWrapper source)
{
foreach(index, wrapper; onShowErrorMessageListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowErrorMessageListeners[index] = null;
onShowErrorMessageListeners = std.algorithm.remove(onShowErrorMessageListeners, index);
break;
}
}
}
}
OnShowErrorMessageDelegateWrapper[] onShowErrorMessageListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present an error message. Most of these messages
* refer to mounting or unmounting media, for example, when a drive
* cannot be started for some reason.
*
* Params:
* primary = primary message with a summary of the error to show.
* secondary = secondary message with details of the error to show.
*
* Since: 3.10
*/
gulong addOnShowErrorMessage(void delegate(string, string, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowErrorMessageDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-error-message",
cast(GCallback)&callBackShowErrorMessage,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowErrorMessageDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowErrorMessage(GtkPlacesSidebar* placessidebarStruct, char* primary, char* secondary, OnShowErrorMessageDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(primary), Str.toString(secondary), wrapper.outer);
}
extern(C) static void callBackShowErrorMessageDestroy(OnShowErrorMessageDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowOtherLocationsDelegateWrapper
{
void delegate(PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowOtherLocationsListeners ~= this;
}
void remove(OnShowOtherLocationsDelegateWrapper source)
{
foreach(index, wrapper; onShowOtherLocationsListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowOtherLocationsListeners[index] = null;
onShowOtherLocationsListeners = std.algorithm.remove(onShowOtherLocationsListeners, index);
break;
}
}
}
}
OnShowOtherLocationsDelegateWrapper[] onShowOtherLocationsListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present a way to show other locations e.g. drives
* and network access points.
* For example, the application may bring up a page showing persistent
* volumes and discovered network addresses.
*
* Deprecated: use the #GtkPlacesSidebar::show-other-locations-with-flags
* which includes the open flags in order to allow the user to specify to open
* in a new tab or window, in a similar way than #GtkPlacesSidebar::open-location
*
* Since: 3.18
*/
gulong addOnShowOtherLocations(void delegate(PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowOtherLocationsDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-other-locations",
cast(GCallback)&callBackShowOtherLocations,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowOtherLocationsDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowOtherLocations(GtkPlacesSidebar* placessidebarStruct, OnShowOtherLocationsDelegateWrapper wrapper)
{
wrapper.dlg(wrapper.outer);
}
extern(C) static void callBackShowOtherLocationsDestroy(OnShowOtherLocationsDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowOtherLocationsWithFlagsDelegateWrapper
{
void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowOtherLocationsWithFlagsListeners ~= this;
}
void remove(OnShowOtherLocationsWithFlagsDelegateWrapper source)
{
foreach(index, wrapper; onShowOtherLocationsWithFlagsListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowOtherLocationsWithFlagsListeners[index] = null;
onShowOtherLocationsWithFlagsListeners = std.algorithm.remove(onShowOtherLocationsWithFlagsListeners, index);
break;
}
}
}
}
OnShowOtherLocationsWithFlagsDelegateWrapper[] onShowOtherLocationsWithFlagsListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present a way to show other locations e.g. drives
* and network access points.
* For example, the application may bring up a page showing persistent
* volumes and discovered network addresses.
*
* Params:
* openFlags = a single value from #GtkPlacesOpenFlags specifying how it should be opened.
*
* Since: 3.20
*/
gulong addOnShowOtherLocationsWithFlags(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowOtherLocationsWithFlagsDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-other-locations-with-flags",
cast(GCallback)&callBackShowOtherLocationsWithFlags,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowOtherLocationsWithFlagsDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowOtherLocationsWithFlags(GtkPlacesSidebar* placessidebarStruct, GtkPlacesOpenFlags openFlags, OnShowOtherLocationsWithFlagsDelegateWrapper wrapper)
{
wrapper.dlg(openFlags, wrapper.outer);
}
extern(C) static void callBackShowOtherLocationsWithFlagsDestroy(OnShowOtherLocationsWithFlagsDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnShowStarredLocationDelegateWrapper
{
void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg)
{
this.dlg = dlg;
onShowStarredLocationListeners ~= this;
}
void remove(OnShowStarredLocationDelegateWrapper source)
{
foreach(index, wrapper; onShowStarredLocationListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onShowStarredLocationListeners[index] = null;
onShowStarredLocationListeners = std.algorithm.remove(onShowStarredLocationListeners, index);
break;
}
}
}
}
OnShowStarredLocationDelegateWrapper[] onShowStarredLocationListeners;
/**
* The places sidebar emits this signal when it needs the calling
* application to present a way to show the starred files. In GNOME,
* starred files are implemented by setting the nao:predefined-tag-favorite
* tag in the tracker database.
*
* Since: 3.22.26
*/
gulong addOnShowStarredLocation(void delegate(GtkPlacesOpenFlags, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnShowStarredLocationDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"show-starred-location",
cast(GCallback)&callBackShowStarredLocation,
cast(void*)wrapper,
cast(GClosureNotify)&callBackShowStarredLocationDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackShowStarredLocation(GtkPlacesSidebar* placessidebarStruct, GtkPlacesOpenFlags object, OnShowStarredLocationDelegateWrapper wrapper)
{
wrapper.dlg(object, wrapper.outer);
}
extern(C) static void callBackShowStarredLocationDestroy(OnShowStarredLocationDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnUnmountDelegateWrapper
{
void delegate(MountOperation, PlacesSidebar) dlg;
gulong handlerId;
this(void delegate(MountOperation, PlacesSidebar) dlg)
{
this.dlg = dlg;
onUnmountListeners ~= this;
}
void remove(OnUnmountDelegateWrapper source)
{
foreach(index, wrapper; onUnmountListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onUnmountListeners[index] = null;
onUnmountListeners = std.algorithm.remove(onUnmountListeners, index);
break;
}
}
}
}
OnUnmountDelegateWrapper[] onUnmountListeners;
/**
* The places sidebar emits this signal when it starts a new operation
* because the user for example ejected some drive or unmounted a mount.
* In this way the application using the #GtkPlacesSidebar can track the
* progress of the operation and, for example, show a notification.
*
* Params:
* mountOperation = the #GMountOperation that is going to start.
*
* Since: 3.20
*/
gulong addOnUnmount(void delegate(MountOperation, PlacesSidebar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnUnmountDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"unmount",
cast(GCallback)&callBackUnmount,
cast(void*)wrapper,
cast(GClosureNotify)&callBackUnmountDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackUnmount(GtkPlacesSidebar* placessidebarStruct, GMountOperation* mountOperation, OnUnmountDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(MountOperation)(mountOperation), wrapper.outer);
}
extern(C) static void callBackUnmountDestroy(OnUnmountDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|