/usr/share/ada/adainclude/gtkada/gtk-clipboard.adb is in libgtkada2.24.1-dev 2.24.1-14.
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 | -----------------------------------------------------------------------
-- GtkAda - Ada95 binding for Gtk+/Gnome --
-- --
-- Copyright (C) 2002-2010, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library 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 --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-----------------------------------------------------------------------
with Gtkada.C; use Gtkada.C;
with Gdk.Types; use Gdk.Types;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Gtk.Selection; use Gtk.Selection;
with Gtkada.Types;
with System; use System;
package body Gtk.Clipboard is
package Atom_Arrays is new Gtkada.C.Unbounded_Arrays
(Gdk.Types.Gdk_Atom, Gdk.Types.Gdk_None,
Natural, Gdk.Types.Gdk_Atom_Array);
---------------
-- Set_Image --
---------------
procedure Set_Image
(Clipboard : Gtk_Clipboard;
Pixbuf : Gdk.Pixbuf.Gdk_Pixbuf)
is
procedure Internal (Clipboard : Gtk_Clipboard; Pixbuf : System.Address);
pragma Import (C, Internal, "gtk_clipboard_set_image");
begin
Internal (Clipboard, Get_Object (Pixbuf));
end Set_Image;
--------------
-- Set_Text --
--------------
procedure Set_Text
(Clipboard : Gtk_Clipboard;
Text : UTF8_String)
is
procedure Internal
(Clipboard : Gtk_Clipboard;
Str : UTF8_String;
Len : Integer);
pragma Import (C, Internal, "gtk_clipboard_set_text");
begin
Internal (Clipboard, Text, Text'Length);
end Set_Text;
--------------------
-- Wait_For_Image --
--------------------
function Wait_For_Image
(Clipboard : Gtk_Clipboard)
return Gdk.Pixbuf.Gdk_Pixbuf
is
function Internal (Clipboard : Gtk_Clipboard) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_wait_for_image");
begin
return Gdk.Pixbuf.Convert (Internal (Clipboard));
end Wait_For_Image;
-------------------
-- Wait_For_Text --
-------------------
function Wait_For_Text (Clipboard : Gtk_Clipboard) return UTF8_String is
function Internal (Clipboard : Gtk_Clipboard) return chars_ptr;
pragma Import (C, Internal, "gtk_clipboard_wait_for_text");
S : constant chars_ptr := Internal (Clipboard);
begin
if S /= Null_Ptr then
declare
Result : constant UTF8_String := Value (S);
begin
Gtkada.Types.g_free (S);
return Result;
end;
end if;
return "";
end Wait_For_Text;
----------------------------
-- Wait_Is_Text_Available --
----------------------------
function Wait_Is_Text_Available
(Clipboard : Gtk_Clipboard) return Boolean
is
function Internal (Clipboard : Gtk_Clipboard) return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_text_available");
begin
return Internal (Clipboard) /= 0;
end Wait_Is_Text_Available;
---------------
-- Get_Owner --
---------------
function Get_Owner
(Clipboard : Gtk_Clipboard) return Glib.Object.GObject
is
function Internal (Clipboard : Gtk_Clipboard) return System.Address;
pragma Import (C, Internal, "gtk_clipboard_get_owner");
Stub : GObject_Record;
begin
return Get_User_Data (Internal (Clipboard), Stub);
end Get_Owner;
-------------------
-- Set_Can_Store --
-------------------
procedure Set_Can_Store
(Clipboard : Gtk_Clipboard;
Targets : Gtk.Selection.Target_Entry_Array)
is
procedure Internal
(Clipboard : Gtk_Clipboard;
Targets : System.Address;
N_Targets : Gint);
pragma Import (C, Internal, "gtk_clipboard_set_can_store");
begin
if Targets'Length = 0 then
Internal (Clipboard, System.Null_Address, 0);
else
Internal (Clipboard, Targets (Targets'First)'Address, Targets'Length);
end if;
end Set_Can_Store;
-------------------
-- Set_With_Data --
-------------------
function Set_With_Data
(Clipboard : Gtk_Clipboard;
Targets : Target_Entry_Array;
Get_Func : Gtk_Clipboard_Get_Func;
Clear_Func : Gtk_Clipboard_Clear_Func;
User_Data : System.Address)
return Boolean
is
function Internal
(Clipboard : Gtk_Clipboard;
Targets : System.Address;
N_Targets : Guint;
Get_Func : Gtk_Clipboard_Get_Func;
Clear_Func : Gtk_Clipboard_Clear_Func;
User_Data : System.Address)
return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_set_with_data");
begin
return Boolean'Val
(Internal (Clipboard, Targets (Targets'First)'Address,
Targets'Length, Get_Func, Clear_Func, User_Data));
end Set_With_Data;
--------------------
-- Set_With_Owner --
--------------------
function Set_With_Owner
(Clipboard : Gtk_Clipboard;
Targets : Target_Entry_Array;
Get_Func : Gtk_Clipboard_Get_Func;
Clear_Func : Gtk_Clipboard_Clear_Func;
Owner : access Glib.Object.GObject_Record'Class)
return Boolean
is
function Internal
(Clipboard : Gtk_Clipboard;
Targets : System.Address;
N_Targets : Guint;
Get_Func : Gtk_Clipboard_Get_Func;
Clear_Func : Gtk_Clipboard_Clear_Func;
Owner : System.Address)
return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_set_with_owner");
begin
return Boolean'Val
(Internal (Clipboard, Targets (Targets'First)'Address,
Targets'Length, Get_Func, Clear_Func, Get_Object (Owner)));
end Set_With_Owner;
-------------------
-- Get_Clipboard --
-------------------
function Get_Clipboard
(Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
Selection : Gdk.Types.Gdk_Atom) return Gtk_Clipboard
is
function Internal
(Widget : System.Address; Selection : Gdk_Atom) return Gtk_Clipboard;
pragma Import (C, Internal, "gtk_widget_get_clipboard");
-- External binding: gtk_widget_get_clipboard
begin
return Internal (Get_Object (Widget), Selection);
end Get_Clipboard;
-----------------------------
-- Wait_Is_Image_Available --
-----------------------------
function Wait_Is_Image_Available
(Clipboard : Gtk_Clipboard) return Boolean
is
function Internal (Clipboard : Gtk_Clipboard) return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_image_available");
begin
return Boolean'Val (Internal (Clipboard));
end Wait_Is_Image_Available;
------------------------------
-- Wait_Is_Target_Available --
------------------------------
function Wait_Is_Target_Available
(Clipboard : Gtk_Clipboard;
Target : Gdk_Atom)
return Boolean
is
function Internal
(Clipboard : Gtk_Clipboard;
Target : Gdk_Atom)
return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_is_target_available");
begin
return Boolean'Val (Internal (Clipboard, Target));
end Wait_Is_Target_Available;
----------------------
-- Wait_For_Targets --
----------------------
function Wait_For_Targets
(Clipboard : Gtk_Clipboard) return Gdk.Types.Gdk_Atom_Array
is
use Atom_Arrays;
function Internal
(Clipboard : Gtk_Clipboard;
Targets : access Unbounded_Array_Access;
N_Targets : access Gint) return Gboolean;
pragma Import (C, Internal, "gtk_clipboard_wait_for_targets");
Output : aliased Unbounded_Array_Access;
N_Targets : aliased Gint;
begin
if Internal
(Clipboard, Output'Unchecked_Access, N_Targets'Unchecked_Access) = 0
then
G_Free (Output);
Output := null;
end if;
declare
Result : constant Gdk_Atom_Array :=
To_Array (Output, Integer (N_Targets));
begin
if Output /= null then
G_Free (Output);
end if;
return Result;
end;
end Wait_For_Targets;
----------------------
-- Request_Contents --
----------------------
procedure Request_Contents
(Clipboard : Gtk_Clipboard;
Target : Gdk_Atom;
Callback : Gtk_Clipboard_Received_Func;
User_Data : System.Address)
is
procedure Internal
(Clipboard : Gtk_Clipboard;
Target : Gdk_Atom;
Callback : Gtk_Clipboard_Received_Func;
User_Data : System.Address);
pragma Import (C, Internal, "gtk_clipboard_request_contents");
begin
Internal (Clipboard, Target, Callback, User_Data);
end Request_Contents;
---------------------
-- Request_Targets --
---------------------
procedure Request_Targets
(Clipboard : Gtk_Clipboard;
Callback : Gtk_Clipboard_Targets_Received_Func;
User_Data : System.Address)
is
procedure Internal
(Clipboard : Gtk_Clipboard;
Callback : Gtk_Clipboard_Targets_Received_Func;
User_Data : System.Address);
pragma Import (C, Internal, "gtk_clipboard_request_targets");
begin
Internal (Clipboard, Callback, User_Data);
end Request_Targets;
end Gtk.Clipboard;
|