summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-18 15:42:59 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-18 15:42:59 +0200
commit84a27086bbd9f493128b354300f9c77ccb32a56b (patch)
tree977cb323f0ac6953f10bc20d84f45ebd5a6d4535 /src/actions
parentb683ce2789d95b2e9f221e75adc30efd91cfb901 (diff)
Imported Upstream version 0.6.0upstream/0.6.0
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/action.vala52
-rw-r--r--src/actions/actionRegistry.vala132
-rw-r--r--src/actions/appAction.vala46
-rw-r--r--src/actions/keyAction.vala52
-rw-r--r--src/actions/pieAction.vala54
-rw-r--r--src/actions/sigAction.vala44
-rw-r--r--src/actions/uriAction.vala56
7 files changed, 218 insertions, 218 deletions
diff --git a/src/actions/action.vala b/src/actions/action.vala
index ff0e9cd..91fc448 100644
--- a/src/actions/action.vala
+++ b/src/actions/action.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A base class for actions, which are executed when the user
/// activates a pie's slice.
/////////////////////////////////////////////////////////////////////////
@@ -30,33 +30,33 @@ public abstract class Action : GLib.Object {
/////////////////////////////////////////////////////////////////////
public abstract string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// The command displayed to the user. It should be a bit more
/// beautiful than the real_command.
/////////////////////////////////////////////////////////////////////
-
- public abstract string display_command { get; }
-
+
+ public abstract string display_command { get; }
+
/////////////////////////////////////////////////////////////////////
/// The name of the Action.
- /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
public virtual string name { get; set; }
-
+
/////////////////////////////////////////////////////////////////////
/// The name of the icon of this Action. It should be in the users
/// current icon theme.
/////////////////////////////////////////////////////////////////////
-
+
public virtual string icon { get; set; }
-
+
/////////////////////////////////////////////////////////////////////
/// True, if this Action is the quickAction of the associated Pie.
/// The quickAction of a Pie gets executed when the users clicks on
/// the center of a Pie.
/////////////////////////////////////////////////////////////////////
-
+
public virtual bool is_quickaction { get; set; }
/////////////////////////////////////////////////////////////////////
diff --git a/src/actions/actionRegistry.vala b/src/actions/actionRegistry.vala
index 24cc1fe..9a22cc7 100644
--- a/src/actions/actionRegistry.vala
+++ b/src/actions/actionRegistry.vala
@@ -1,46 +1,46 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A which has knowledge on all possible acion types.
/////////////////////////////////////////////////////////////////////////
public class ActionRegistry : GLib.Object {
-
+
/////////////////////////////////////////////////////////////////////
/// A list containing all available Action types.
/////////////////////////////////////////////////////////////////////
-
+
public static Gee.ArrayList<string> types { get; private set; }
-
+
/////////////////////////////////////////////////////////////////////
- /// A map associating a displayable name for each Action,
+ /// A map associating a displayable name for each Action,
/// whether it has a custom icon and a name for the pies.conf
/// file with it's type.
/////////////////////////////////////////////////////////////////////
-
+
public static Gee.HashMap<string, TypeDescription?> descriptions { get; private set; }
-
+
/////////////////////////////////////////////////////////////////////
/// A helper class storing information on a Action type.
/////////////////////////////////////////////////////////////////////
-
+
public class TypeDescription {
public string name { get; set; default=""; }
public string icon { get; set; default=""; }
@@ -48,38 +48,38 @@ public class ActionRegistry : GLib.Object {
public string id { get; set; default=""; }
public bool icon_name_editable { get; set; default=false; }
}
-
+
/////////////////////////////////////////////////////////////////////
/// Registers all Action types.
/////////////////////////////////////////////////////////////////////
-
+
public static void init() {
types = new Gee.ArrayList<string>();
descriptions = new Gee.HashMap<string, TypeDescription?>();
-
+
TypeDescription type_description;
-
+
types.add(typeof(AppAction).name());
type_description = AppAction.register();
descriptions.set(typeof(AppAction).name(), type_description);
-
+
types.add(typeof(KeyAction).name());
type_description = KeyAction.register();
descriptions.set(typeof(KeyAction).name(), type_description);
-
+
types.add(typeof(PieAction).name());
type_description = PieAction.register();
descriptions.set(typeof(PieAction).name(), type_description);
-
+
types.add(typeof(UriAction).name());
type_description = UriAction.register();
descriptions.set(typeof(UriAction).name(), type_description);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Creates a new Action from the given type name.
/////////////////////////////////////////////////////////////////////
-
+
public static Action? create_action(string type_id, string name, string icon, string command, bool quickaction) {
switch (type_id) {
case "app": return new AppAction(name, icon, command, quickaction);
@@ -87,131 +87,131 @@ public class ActionRegistry : GLib.Object {
case "uri": return new UriAction(name, icon, command, quickaction);
case "pie": return new PieAction(command, quickaction);
}
-
+
return null;
}
-
+
/////////////////////////////////////////////////////////////////////
- /// A helper method which creates an Action, appropriate for the
+ /// A helper method which creates an Action, appropriate for the
/// given URI. This can result in an UriAction or in an AppAction,
- /// depending on the Type of the URI.
+ /// depending on the Type of the URI.
/////////////////////////////////////////////////////////////////////
public static Action? new_for_uri(string uri, string? name = null) {
var file = GLib.File.new_for_uri(uri);
var scheme = file.get_uri_scheme();
-
+
string final_icon = "";
string final_name = file.get_basename();
switch (scheme) {
case "application":
var file_name = uri.split("//")[1];
-
+
var desktop_file = GLib.File.new_for_path("/usr/share/applications/" + file_name);
if (desktop_file.query_exists())
return new_for_desktop_file(desktop_file.get_path());
break;
-
+
case "trash":
final_icon = "user-trash";
final_name = _("Trash");
break;
-
+
case "http": case "https":
final_icon = "www";
final_name = get_domain_name(uri);
break;
-
+
case "ftp": case "sftp":
final_icon = "folder-remote";
final_name = get_domain_name(uri);
break;
-
+
default:
try {
var info = file.query_info("*", GLib.FileQueryInfoFlags.NONE);
-
+
if (info.get_content_type() == "application/x-desktop")
return new_for_desktop_file(file.get_parse_name());
-
+
// search for an appropriate icon
- var icon = info.get_icon();
+ var icon = info.get_icon();
final_icon = Icon.get_icon_name(icon);
-
+
} catch (GLib.Error e) {
warning(e.message);
}
break;
}
-
+
if (!Gtk.IconTheme.get_default().has_icon(final_icon))
final_icon = "stock_unknown";
-
+
if (name != null)
final_name = name;
-
+
return new UriAction(final_name, final_icon, uri);
}
-
+
/////////////////////////////////////////////////////////////////////
/// A helper method which creates an AppAction for given AppInfo.
/////////////////////////////////////////////////////////////////////
-
- public static Action? new_for_app_info(GLib.AppInfo info) {
+
+ public static Action? new_for_app_info(GLib.AppInfo info) {
// get icon
- var icon = info.get_icon();
-
+ var icon = info.get_icon();
+
return new AppAction(info.get_display_name(), Icon.get_icon_name(icon), info.get_commandline());
}
-
+
/////////////////////////////////////////////////////////////////////
/// A helper method which creates an AppAction for given *.desktop
/// file.
/////////////////////////////////////////////////////////////////////
-
+
public static Action? new_for_desktop_file(string file_name) {
// check whether its a desktop file to open one of Gnome-Pie's pies
if (file_name.has_prefix(Paths.launchers)) {
string id = file_name.substring((long)file_name.length - 11, 3);
return new PieAction(id);
}
-
+
var info = new DesktopAppInfo.from_filename(file_name);
return new_for_app_info(info);
}
-
+
/////////////////////////////////////////////////////////////////////
/// A helper method which creates an AppAction for given mime type.
/////////////////////////////////////////////////////////////////////
-
+
public static Action? default_for_mime_type(string type) {
var info = AppInfo.get_default_for_type(type, false);
return new_for_app_info(info);
}
-
+
/////////////////////////////////////////////////////////////////////
/// A helper method which creates an AppAction for given uri scheme.
/////////////////////////////////////////////////////////////////////
-
+
public static Action? default_for_uri(string uri) {
var info = AppInfo.get_default_for_uri_scheme(uri);
return new_for_app_info(info);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns for example www.google.com when http://www.google.de/?q=h
/// is given.
/////////////////////////////////////////////////////////////////////
-
+
private static string get_domain_name(string url) {
int domain_end = url.index_of_char('/', 7);
int domain_begin = url.index_of_char('/', 0) + 2;
-
+
if (domain_begin < domain_end) return url.substring(domain_begin, domain_end-domain_begin);
-
+
return url;
}
}
diff --git a/src/actions/appAction.vala b/src/actions/appAction.vala
index 2371f7c..859baf8 100644
--- a/src/actions/appAction.vala
+++ b/src/actions/appAction.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This type of Action launches an application or a custom command.
/////////////////////////////////////////////////////////////////////////
@@ -38,17 +38,17 @@ public class AppAction : Action {
description.id = "app";
return description;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Stores the command line.
/////////////////////////////////////////////////////////////////////
public override string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Simply returns the real_command. No beautification.
/////////////////////////////////////////////////////////////////////
-
+
public override string display_command { get {return real_command;} }
/////////////////////////////////////////////////////////////////////
@@ -67,10 +67,10 @@ public class AppAction : Action {
try{
var item = GLib.AppInfo.create_from_commandline(this.real_command, null, GLib.AppInfoCreateFlags.NONE);
item.launch(null, null);
- } catch (Error e) {
- warning(e.message);
+ } catch (Error e) {
+ warning(e.message);
}
- }
+ }
}
}
diff --git a/src/actions/keyAction.vala b/src/actions/keyAction.vala
index 3816686..68a2ec1 100644
--- a/src/actions/keyAction.vala
+++ b/src/actions/keyAction.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This type of Action "presses" a key stroke.
/////////////////////////////////////////////////////////////////////////
@@ -37,24 +37,24 @@ public class KeyAction : Action {
description.icon_name_editable = true;
description.id = "key";
return description;
- }
-
+ }
+
/////////////////////////////////////////////////////////////////////
/// Stores the accelerator of this action.
/////////////////////////////////////////////////////////////////////
-
+
public override string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Returns a human readable form of the accelerator.
/////////////////////////////////////////////////////////////////////
-
+
public override string display_command { get {return key.label;} }
-
+
/////////////////////////////////////////////////////////////////////
/// The simulated key which gets 'pressed' on execution.
/////////////////////////////////////////////////////////////////////
-
+
public Key key { get; set; }
/////////////////////////////////////////////////////////////////////
@@ -64,11 +64,11 @@ public class KeyAction : Action {
public KeyAction(string name, string icon, string command, bool is_quickaction = false) {
GLib.Object(name : name, icon : icon, real_command : command, is_quickaction : is_quickaction);
}
-
+
construct {
this.key = new Key.from_string(real_command);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Presses the desired key.
/////////////////////////////////////////////////////////////////////
diff --git a/src/actions/pieAction.vala b/src/actions/pieAction.vala
index c65c1d6..8069ff3 100644
--- a/src/actions/pieAction.vala
+++ b/src/actions/pieAction.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This Action opens another pie.
/////////////////////////////////////////////////////////////////////////
@@ -38,23 +38,23 @@ public class PieAction : Action {
description.id = "pie";
return description;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Stores the ID of the referenced Pie.
/////////////////////////////////////////////////////////////////////
public override string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Returns the name of the referenced Pie.
/////////////////////////////////////////////////////////////////////
-
+
public override string display_command { get {return name;} }
-
+
/////////////////////////////////////////////////////////////////////
/// Returns the name of the referenced Pie.
/////////////////////////////////////////////////////////////////////
-
+
public override string name {
get {
var referee = PieManager.all_pies[real_command];
@@ -66,13 +66,13 @@ public class PieAction : Action {
}
protected set {}
}
-
+
private string owned_name;
-
+
/////////////////////////////////////////////////////////////////////
/// Returns the icon of the referenced Pie.
/////////////////////////////////////////////////////////////////////
-
+
public override string icon {
get {
var referee = PieManager.all_pies[real_command];
@@ -90,14 +90,14 @@ public class PieAction : Action {
public PieAction(string id, bool is_quickaction = false) {
GLib.Object(name : "", icon : "", real_command : id, is_quickaction : is_quickaction);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Opens the desired Pie.
/////////////////////////////////////////////////////////////////////
public override void activate() {
PieManager.open_pie(real_command);
- }
+ }
}
}
diff --git a/src/actions/sigAction.vala b/src/actions/sigAction.vala
index 1edbc08..4eebbca 100644
--- a/src/actions/sigAction.vala
+++ b/src/actions/sigAction.vala
@@ -1,23 +1,23 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This type of Action can't be selected by the user, therefore there is
/// no register() method for this class. But it may be useful for
/// ActionGroups: It emits a signal on activation.
@@ -30,19 +30,19 @@ public class SigAction : Action {
/////////////////////////////////////////////////////////////////////
public signal void activated();
-
+
/////////////////////////////////////////////////////////////////////
/// This may store something useful.
/////////////////////////////////////////////////////////////////////
public override string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Only for inheritance... Greetings to Liskov.
/////////////////////////////////////////////////////////////////////
-
+
public override string display_command { get {return real_command;} }
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, initializes all members.
/////////////////////////////////////////////////////////////////////
@@ -57,7 +57,7 @@ public class SigAction : Action {
public override void activate() {
this.activated();
- }
+ }
}
}
diff --git a/src/actions/uriAction.vala b/src/actions/uriAction.vala
index f407f6c..dfc1029 100644
--- a/src/actions/uriAction.vala
+++ b/src/actions/uriAction.vala
@@ -1,34 +1,34 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program 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 3 of the License, or (at your option)
-any later version.
-
-This program 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 program. If not, see <http://www.gnu.org/licenses/>.
-*/
+/////////////////////////////////////////////////////////////////////////
+// Copyright (c) 2011-2015 by Simon Schneegans
+//
+// This program 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 3 of the License, or (at
+// your option) any later version.
+//
+// This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+/////////////////////////////////////////////////////////////////////////
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This type of Action opens the default application for an URI.
/////////////////////////////////////////////////////////////////////////
public class UriAction : Action {
-
+
/////////////////////////////////////////////////////////////////////
/// Used to register this type of Action. It sets the display name
/// for this Action, whether it has a custom Icon/Name and the string
/// used in the pies.conf file for this kind of Actions.
/////////////////////////////////////////////////////////////////////
-
+
public static ActionRegistry.TypeDescription register() {
var description = new ActionRegistry.TypeDescription();
description.name = _("Open URI");
@@ -38,17 +38,17 @@ public class UriAction : Action {
description.id = "uri";
return description;
}
-
+
/////////////////////////////////////////////////////////////////////
/// The URI of this Action.
/////////////////////////////////////////////////////////////////////
-
+
public override string real_command { get; construct set; }
-
+
/////////////////////////////////////////////////////////////////////
/// Returns only the real URI. An URI can't be beautified.
/////////////////////////////////////////////////////////////////////
-
+
public override string display_command { get {return real_command;} }
/////////////////////////////////////////////////////////////////////
@@ -56,8 +56,8 @@ public class UriAction : Action {
/////////////////////////////////////////////////////////////////////
public UriAction(string name, string icon, string command, bool is_quickaction = false) {
- GLib.Object(name : name, icon : icon,
- real_command : command.has_prefix("www") ? "http://" + command : command,
+ GLib.Object(name : name, icon : icon,
+ real_command : command.has_prefix("www") ? "http://" + command : command,
is_quickaction : is_quickaction);
}
@@ -68,10 +68,10 @@ public class UriAction : Action {
public override void activate() {
try{
GLib.AppInfo.launch_default_for_uri(real_command, null);
- } catch (Error e) {
- warning(e.message);
+ } catch (Error e) {
+ warning(e.message);
}
- }
+ }
}
}