summaryrefslogtreecommitdiff
path: root/src/utilities/paths.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities/paths.vala')
-rw-r--r--src/utilities/paths.vala68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/utilities/paths.vala b/src/utilities/paths.vala
index 1c42176..589cc36 100644
--- a/src/utilities/paths.vala
+++ b/src/utilities/paths.vala
@@ -60,6 +60,13 @@ public class Paths : GLib.Object {
public static string locales { get; private set; default=""; }
/////////////////////////////////////////////////////////////////////
+ /// The directory containing UI declaration files
+ /// usually /usr/share/gnome-pie/ui/.
+ /////////////////////////////////////////////////////////////////////
+
+ public static string ui_files { get; private set; default=""; }
+
+ /////////////////////////////////////////////////////////////////////
/// The autostart file of gnome-pie_config
/// usually ~/.config/autostart/gnome-pie.desktop.
/////////////////////////////////////////////////////////////////////
@@ -74,43 +81,47 @@ public class Paths : GLib.Object {
public static string launchers { get; private set; default=""; }
/////////////////////////////////////////////////////////////////////
+ /// The path to the executable.
+ /////////////////////////////////////////////////////////////////////
+
+ public static string executable { get; private set; default=""; }
+
+ /////////////////////////////////////////////////////////////////////
/// Initializes all values above.
/////////////////////////////////////////////////////////////////////
public static void init() {
- // append resources to icon search path to icon theme, if neccasary
+ // get path of executable
try {
- var icon_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
- GLib.FileUtils.read_link("/proc/self/exe"))).get_child("resources");
-
- if (icon_dir.query_exists()) {
- string path = icon_dir.get_path();
- Gtk.IconTheme.get_default().append_search_path(path);
- }
-
- Gtk.IconTheme.get_default().append_search_path("/usr/share/pixmaps/");
-
+ executable = GLib.File.new_for_path(GLib.FileUtils.read_link("/proc/self/exe")).get_path();
} catch (GLib.FileError e) {
warning("Failed to get path of executable!");
}
+ // append resources to icon search path to icon theme, if neccasary
+ var icon_dir = GLib.File.new_for_path(GLib.Path.get_dirname(executable)).get_child("resources");
+
+ if (icon_dir.query_exists()) {
+ string path = icon_dir.get_path();
+ Gtk.IconTheme.get_default().append_search_path(path);
+ }
+
+ Gtk.IconTheme.get_default().append_search_path("/usr/share/pixmaps/");
+
// get global paths
var default_dir = GLib.File.new_for_path("/usr/share/gnome-pie/");
if(!default_dir.query_exists()) {
default_dir = GLib.File.new_for_path("/usr/local/share/gnome-pie/");
if(!default_dir.query_exists()) {
- try {
- default_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
- GLib.FileUtils.read_link("/proc/self/exe"))).get_child("resources");
- } catch (GLib.FileError e) {
- warning("Failed to get path of executable!");
- }
+ default_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
+ executable)).get_child("resources");
}
}
global_themes = default_dir.get_path() + "/themes";
+ ui_files = default_dir.get_path() + "/ui";
// get locales path
var locale_dir = GLib.File.new_for_path("/usr/share/locale/de/LC_MESSAGES/gnomepie.mo");
@@ -121,22 +132,12 @@ public class Paths : GLib.Object {
if(locale_dir.query_exists()) {
locale_dir = GLib.File.new_for_path("/usr/local/share/locale");
} else {
-
- try {
- locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
- GLib.FileUtils.read_link("/proc/self/exe"))).get_child(
- "resources/locale/de/LC_MESSAGES/gnomepie.mo");
- } catch (GLib.FileError e) {
- warning("Failed to get path of executable!");
- }
+ locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
+ executable)).get_child("resources/locale/de/LC_MESSAGES/gnomepie.mo");
if(locale_dir.query_exists()) {
- try {
- locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
- GLib.FileUtils.read_link("/proc/self/exe"))).get_child("resources/locale");
- } catch (GLib.FileError e) {
- warning("Failed to get path of executable!");
- }
+ locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
+ executable)).get_child("resources/locale");
}
}
}
@@ -204,7 +205,10 @@ public class Paths : GLib.Object {
warning("Failed to find launchers directory!");
if (!GLib.File.new_for_path(global_themes).query_exists())
- warning("Failed to find global themes directory!");
+ warning("Failed to find global themes directory!");
+
+ if (!GLib.File.new_for_path(ui_files).query_exists())
+ warning("Failed to find UI files directory!");
}
}