mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 20:09:23 +00:00
Use new helper function for building ui
This commit is contained in:
parent
7354780e04
commit
9b3ec06aea
|
@ -105,30 +105,6 @@ namespace GitgDash
|
|||
return application.repository == null;
|
||||
}
|
||||
|
||||
private Gee.HashMap<string, Object>? from_builder(string path, string[] ids)
|
||||
{
|
||||
var builder = new Gtk.Builder();
|
||||
|
||||
try
|
||||
{
|
||||
builder.add_from_resource("/org/gnome/gitg/dash/" + path);
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
warning("Failed to load ui: %s", e.message);
|
||||
return null;
|
||||
}
|
||||
|
||||
Gee.HashMap<string, Object> ret = new Gee.HashMap<string, Object>();
|
||||
|
||||
foreach (string id in ids)
|
||||
{
|
||||
ret[id] = builder.get_object(id);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void connect_chooser_folder(Gtk.FileChooser ch)
|
||||
{
|
||||
if (d_open_folder == null)
|
||||
|
@ -156,9 +132,10 @@ namespace GitgDash
|
|||
{
|
||||
if (d_open == null)
|
||||
{
|
||||
var ret = from_builder("view-open.ui", {"view",
|
||||
"file_chooser",
|
||||
"button_open"});
|
||||
var ret = GitgExt.UI.from_builder("dash/view-open.ui",
|
||||
"view",
|
||||
"file_chooser",
|
||||
"button_open");
|
||||
|
||||
d_open = ret["view"] as Gtk.Widget;
|
||||
|
||||
|
@ -179,9 +156,10 @@ namespace GitgDash
|
|||
{
|
||||
if (d_create == null)
|
||||
{
|
||||
var ret = from_builder("view-create.ui", {"view",
|
||||
"file_chooser",
|
||||
"button_create"});
|
||||
var ret = GitgExt.UI.from_builder("dash/view-create.ui",
|
||||
"view",
|
||||
"file_chooser",
|
||||
"button_create");
|
||||
|
||||
d_create = ret["view"] as Gtk.Widget;
|
||||
|
||||
|
@ -243,11 +221,12 @@ namespace GitgDash
|
|||
|
||||
if (d_recent == null)
|
||||
{
|
||||
var ret = from_builder("view-recent.ui", {"view",
|
||||
"label_path_i",
|
||||
"label_last_used_i",
|
||||
"label_current_branch_i",
|
||||
"button_open"});
|
||||
var ret = GitgExt.UI.from_builder("dash/view-recent.ui",
|
||||
"view",
|
||||
"label_path_i",
|
||||
"label_last_used_i",
|
||||
"label_current_branch_i",
|
||||
"button_open");
|
||||
|
||||
d_recent = ret["view"] as Gtk.Widget;
|
||||
d_recent_path = ret["label_path_i"] as Gtk.Label;
|
||||
|
|
|
@ -88,30 +88,6 @@ namespace GitgFiles
|
|||
});
|
||||
}
|
||||
|
||||
private Gee.HashMap<string, Object>? from_builder(string path, string[] ids)
|
||||
{
|
||||
var builder = new Gtk.Builder();
|
||||
|
||||
try
|
||||
{
|
||||
builder.add_from_resource("/org/gnome/gitg/files/" + path);
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
warning("Failed to load ui: %s", e.message);
|
||||
return null;
|
||||
}
|
||||
|
||||
Gee.HashMap<string, Object> ret = new Gee.HashMap<string, Object>();
|
||||
|
||||
foreach (string id in ids)
|
||||
{
|
||||
ret[id] = builder.get_object(id);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void update_font()
|
||||
{
|
||||
var fname = d_fontsettings.get_string("monospace-font-name");
|
||||
|
@ -133,7 +109,11 @@ namespace GitgFiles
|
|||
|
||||
private void build_ui()
|
||||
{
|
||||
var ret = from_builder("view-files.ui", {"paned_files", "tree_view_files", "source_view_file", "scrolled_window_file"});
|
||||
var ret = GitgExt.UI.from_builder("files/view-files.ui",
|
||||
"paned_files",
|
||||
"tree_view_files",
|
||||
"source_view_file",
|
||||
"scrolled_window_file");
|
||||
|
||||
var tv = ret["tree_view_files"] as Gtk.TreeView;
|
||||
tv.model = d_model;
|
||||
|
|
|
@ -156,7 +156,9 @@ namespace GitgHistory
|
|||
|
||||
private void build_ui()
|
||||
{
|
||||
var ret = from_builder("view-history.ui", {"scrolled_window_commit_list", "commit_list_view"});
|
||||
var ret = GitgExt.UI.from_builder("history/view-history.ui",
|
||||
"scrolled_window_commit_list",
|
||||
"commit_list_view");
|
||||
|
||||
d_view = ret["commit_list_view"] as Gtk.TreeView;
|
||||
d_view.model = d_model;
|
||||
|
@ -224,30 +226,6 @@ namespace GitgHistory
|
|||
d_model.reload();
|
||||
}
|
||||
|
||||
private Gee.HashMap<string, Object>? from_builder(string path, string[] ids)
|
||||
{
|
||||
var builder = new Gtk.Builder();
|
||||
|
||||
try
|
||||
{
|
||||
builder.add_from_resource("/org/gnome/gitg/history/" + path);
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
warning("Failed to load ui: %s", e.message);
|
||||
return null;
|
||||
}
|
||||
|
||||
Gee.HashMap<string, Object> ret = new Gee.HashMap<string, Object>();
|
||||
|
||||
foreach (string id in ids)
|
||||
{
|
||||
ret[id] = builder.get_object(id);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool enabled
|
||||
{
|
||||
get
|
||||
|
|
Loading…
Reference in a new issue