Cleaned up some of the GearyApplication code as well. Found bug when detecting the .desktop file too.
This commit is contained in:
parent
01f8831f3b
commit
f950f1578e
2 changed files with 12 additions and 5 deletions
|
|
@ -383,20 +383,27 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
|
|||
public File? get_desktop_file() {
|
||||
File? install_dir = get_install_dir();
|
||||
File desktop_file = (install_dir != null)
|
||||
? install_dir.get_child("geary.desktop")
|
||||
? install_dir.get_child("share").get_child("applications").get_child("geary.desktop")
|
||||
: File.new_for_path(SOURCE_ROOT_DIR).get_child("build").get_child("desktop").get_child("geary.desktop");
|
||||
|
||||
return desktop_file.query_exists() ? desktop_file : null;
|
||||
}
|
||||
|
||||
public bool is_installed() {
|
||||
return exec_dir.has_prefix(File.new_for_path(INSTALL_PREFIX));
|
||||
return exec_dir.has_prefix(get_install_prefix_dir());
|
||||
}
|
||||
|
||||
|
||||
// Returns the configure installation prefix directory, which does not imply Geary is installed
|
||||
// or that it's running from this directory.
|
||||
public File get_install_prefix_dir() {
|
||||
return File.new_for_path(INSTALL_PREFIX);
|
||||
}
|
||||
|
||||
// Returns the installation directory, or null if we're running outside of the installation
|
||||
// directory.
|
||||
public File? get_install_dir() {
|
||||
File prefix_dir = File.new_for_path(INSTALL_PREFIX);
|
||||
File prefix_dir = get_install_prefix_dir();
|
||||
|
||||
return exec_dir.has_prefix(prefix_dir) ? prefix_dir : null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class Libmessagingmenu : NewMessagesIndicator {
|
|||
|
||||
File? desktop_file = GearyApplication.instance.get_desktop_file();
|
||||
if (desktop_file == null
|
||||
|| !desktop_file.get_parent().equal(GearyApplication.instance.system_desktop_file_directory)) {
|
||||
|| !desktop_file.has_prefix(GearyApplication.instance.get_install_prefix_dir())) {
|
||||
debug("Only an installed version of Geary with its .desktop file installed can use Messaging Menu");
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue