/usr/share/ada/adainclude/gtkada/gtk-builder.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 | -----------------------------------------------------------------------
-- GtkAda - Ada95 binding for Gtk+/Gnome --
-- --
-- Copyright (C) 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 Interfaces.C.Strings; use Interfaces.C.Strings;
with System; use System;
package body Gtk.Builder is
-------------
-- Gtk_New --
-------------
procedure Gtk_New (Builder : out Gtk_Builder) is
begin
Builder := new Gtk_Builder_Record;
Gtk.Builder.Initialize (Builder);
end Gtk_New;
-------------------
-- Add_From_File --
-------------------
function Add_From_File
(Builder : access Gtk_Builder_Record;
Filename : String)
return Glib.Error.GError
is
function Internal
(Builder : System.Address;
Filename : String;
Error : access Glib.Error.GError)
return Guint;
pragma Import (C, Internal, "gtk_builder_add_from_file");
Err : aliased Glib.Error.GError;
begin
if Internal
(Get_Object (Builder), Filename & ASCII.NUL, Err'Access) = 0
then
return Err;
else
return null;
end if;
end Add_From_File;
---------------------
-- Add_From_String --
---------------------
function Add_From_String
(Builder : access Gtk_Builder_Record;
Buffer : String;
Length : Gsize)
return Glib.Error.GError
is
function Internal
(Builder : System.Address;
Buffer : String;
Length : Gsize;
Error : access Glib.Error.GError)
return Guint;
pragma Import (C, Internal, "gtk_builder_add_from_string");
Err : aliased Glib.Error.GError;
begin
if Internal
(Get_Object (Builder), Buffer & ASCII.NUL, Length, Err'Access) = 0
then
return Err;
else
return null;
end if;
end Add_From_String;
--------------------------
-- Connect_Signals_Full --
--------------------------
procedure Connect_Signals_Full
(Builder : access Gtk_Builder_Record;
Signal_Function : Gtk_Builder_Connect_Func;
User_Data : System.Address)
is
procedure Internal
(Builder : System.Address;
Handler_Function : Gtk_Builder_Connect_Func;
User_Data : System.Address);
pragma Import (C, Internal, "gtk_builder_connect_signals_full");
begin
Internal
(Glib.Object.Get_Object (Builder),
Signal_Function,
User_Data);
end Connect_Signals_Full;
----------------
-- Get_Object --
----------------
function Get_Object
(Builder : access Gtk_Builder_Record;
Object_Name : String)
return Glib.Object.GObject
is
function Internal
(Builder : System.Address;
Object_Name : String)
return System.Address;
pragma Import (C, Internal, "gtk_builder_get_object");
Addr : System.Address;
begin
Addr := Internal
(Glib.Object.Get_Object (Builder),
Object_Name & ASCII.NUL);
if Addr /= System.Null_Address then
return Glib.Object.Convert (Addr);
else
return null;
end if;
end Get_Object;
----------------
-- Initialize --
----------------
procedure Initialize (Builder : access Gtk_Builder_Record'Class) is
function Internal return System.Address;
pragma Import (C, Internal, "gtk_builder_new");
begin
Set_Object (Builder, Internal);
end Initialize;
----------------
-- Get_Widget --
----------------
function Get_Widget
(Builder : access Gtk_Builder_Record;
Name : String) return Gtk.Widget.Gtk_Widget
is
Object : constant GObject := Get_Object (Builder, Name);
begin
if Object = null then
return null;
else
return Gtk.Widget.Convert (Glib.Object.Convert (Object));
end if;
end Get_Widget;
end Gtk.Builder;
|