mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-06-30 23:29:33 +00:00
Add action to fetch all remotes
This commit is contained in:
parent
79165de42a
commit
080132c903
66
gitg/gitg-remote-fetch-all-action.vala
Normal file
66
gitg/gitg-remote-fetch-all-action.vala
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* This file is part of gitg
|
||||
*
|
||||
* Copyright (C) 2022 - Adwait Rawat
|
||||
*
|
||||
* 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 Gitg
|
||||
{
|
||||
|
||||
class FetchAllRemotesAction : GitgExt.UIElement, GitgExt.Action, Object
|
||||
{
|
||||
// Do this to pull in config.h before glib.h (for gettext...)
|
||||
private const string version = Gitg.Config.VERSION;
|
||||
|
||||
public GitgExt.Application? application { owned get; construct set; }
|
||||
public GitgHistory.RefsList refs_list;
|
||||
|
||||
public FetchAllRemotesAction(GitgExt.Application application, GitgHistory.RefsList refs_list)
|
||||
{
|
||||
Object(application: application);
|
||||
this.refs_list = refs_list;
|
||||
}
|
||||
|
||||
public string id
|
||||
{
|
||||
owned get { return "/org/gnome/gitg/ref-actions/fetch-all-remotes"; }
|
||||
}
|
||||
|
||||
public string display_name
|
||||
{
|
||||
owned get { return _("Fetch all remotes"); }
|
||||
}
|
||||
|
||||
public string description
|
||||
{
|
||||
owned get { return _("Fetch objects from all remotes"); }
|
||||
}
|
||||
|
||||
public void activate()
|
||||
{
|
||||
refs_list.references.foreach((r) => {
|
||||
var remote_name = r.parsed_name.remote_name;
|
||||
print(remote_name+"\n");
|
||||
var remote = application.remote_lookup.lookup(remote_name);
|
||||
remote.fetch(null, null);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ex:set ts=4 noet
|
|
@ -634,6 +634,7 @@ namespace GitgHistory
|
|||
|
||||
var actions = new Gee.LinkedList<GitgExt.Action>();
|
||||
actions.add(new Gitg.AddRemoteAction(application));
|
||||
actions.add(new Gitg.FetchAllRemotesAction(application, d_main.refs_list));
|
||||
d_main.refs_list.remotes_actions = actions;
|
||||
|
||||
application.bind_property("repository", d_main.refs_list,
|
||||
|
|
|
@ -52,6 +52,7 @@ sources = gitg_sources + files(
|
|||
'gitg-ref-action-push.vala',
|
||||
'gitg-ref-action-tag-info.vala',
|
||||
'gitg-ref-action-rename.vala',
|
||||
'gitg-remote-fetch-all-action.vala',
|
||||
'gitg-remove-remote-action.vala',
|
||||
'gitg-add-remote-action-dialog.vala',
|
||||
'gitg-add-remote-action.vala',
|
||||
|
|
Loading…
Reference in New Issue
Block a user