mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-31 03:48:10 +00:00
59 lines
1.3 KiB
Vala
59 lines
1.3 KiB
Vala
/*
|
|
* This file is part of gitg
|
|
*
|
|
* Copyright (C) 2012 - Jesse van den Kieboom
|
|
*
|
|
* gitg 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.
|
|
*
|
|
* gitg 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 gitg. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace GitgExt
|
|
{
|
|
public class UI
|
|
{
|
|
public static Gee.HashMap<string, Object>? from_builder(string path, ...)
|
|
{
|
|
var builder = new Gtk.Builder();
|
|
|
|
try
|
|
{
|
|
builder.add_from_resource("/org/gnome/gitg/" + path);
|
|
}
|
|
catch (Error e)
|
|
{
|
|
warning("Failed to load ui: %s", e.message);
|
|
return null;
|
|
}
|
|
|
|
Gee.HashMap<string, Object> ret = new Gee.HashMap<string, Object>();
|
|
|
|
var l = va_list();
|
|
|
|
while (true)
|
|
{
|
|
string? id = l.arg();
|
|
|
|
if (id == null)
|
|
{
|
|
break;
|
|
}
|
|
|
|
ret[id] = builder.get_object(id);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
}
|
|
|
|
// vi:ts=4
|