mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-01 05:33:49 +00:00
Add missing gitg-ref-action-copy-name.vala
This commit is contained in:
parent
46d3d3f373
commit
4507c0e2e7
73
gitg/gitg-ref-action-copy-name.vala
Normal file
73
gitg/gitg-ref-action-copy-name.vala
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is part of gitg
|
||||
*
|
||||
* Copyright (C) 2014 - 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 Gitg
|
||||
{
|
||||
|
||||
class RefActionCopyName : GitgExt.UIElement, GitgExt.Action, GitgExt.RefAction, 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 GitgExt.RefActionInterface action_interface { get; construct set; }
|
||||
public Gitg.Ref reference { get; construct set; }
|
||||
|
||||
public RefActionCopyName(GitgExt.Application application,
|
||||
GitgExt.RefActionInterface action_interface,
|
||||
Gitg.Ref reference)
|
||||
{
|
||||
Object(application: application,
|
||||
action_interface: action_interface,
|
||||
reference: reference);
|
||||
}
|
||||
|
||||
public string id
|
||||
{
|
||||
owned get { return "/org/gnome/gitg/ref-actions/copy-name"; }
|
||||
}
|
||||
|
||||
public string display_name
|
||||
{
|
||||
owned get { return _("Copy Name"); }
|
||||
}
|
||||
|
||||
public string description
|
||||
{
|
||||
owned get { return _("Copy the name of the reference to the clipboard"); }
|
||||
}
|
||||
|
||||
public bool enabled
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void activate()
|
||||
{
|
||||
var clip = ((Gtk.Widget)application).get_clipboard(Gdk.SELECTION_CLIPBOARD);
|
||||
clip.set_text(reference.parsed_name.shortname, -1);
|
||||
|
||||
clip = ((Gtk.Widget)application).get_clipboard(Gdk.SELECTION_PRIMARY);
|
||||
clip.set_text(reference.parsed_name.shortname, -1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ex:set ts=4 noet
|
Loading…
Reference in a new issue