diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:07:09 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-01-21 19:07:09 +0100 |
commit | 60560a030fda3c539ff9dc1563b9926414a193da (patch) | |
tree | 77590b395685a8d48d3615e45629a1610d08c071 /src/utilities/paths.vala | |
parent | d6b2677825cbb423e2099563c16321c3e23d7899 (diff) |
Imported Upstream version 0.4.0upstream/0.4.0
Diffstat (limited to 'src/utilities/paths.vala')
-rw-r--r-- | src/utilities/paths.vala | 68 |
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!"); } } |