beagle r4879 - in trunk/beagle: Util beagled/KopeteQueryable
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4879 - in trunk/beagle: Util beagled/KopeteQueryable
- Date: Sat, 22 Nov 2008 19:09:33 +0000 (UTC)
Author: dbera
Date: Sat Nov 22 19:09:32 2008
New Revision: 4879
URL: http://svn.gnome.org/viewvc/beagle?rev=4879&view=rev
Log:
Adapt to KDE4. If the environment variable KDE_SESSION_VERSION=4 at startup, always assume KDE4 is running and look in ~/.kde4. Otherwise, if ~/.kde4 exists, return it; else return ~/.kde. ~/.kde4 is checked everytime if the evn variable is not set; this is to handle cases like KDE4 is not running but some kde4 application is started while beagle is running.
Make Kopete backend work with KDE4 also. Fixes #561429.
Modified:
trunk/beagle/Util/KdeUtils.cs
trunk/beagle/beagled/KopeteQueryable/KopeteQueryable.cs
Modified: trunk/beagle/Util/KdeUtils.cs
==============================================================================
--- trunk/beagle/Util/KdeUtils.cs (original)
+++ trunk/beagle/Util/KdeUtils.cs Sat Nov 22 19:09:32 2008
@@ -108,6 +108,46 @@
return null;
}
+ private static string kde3_user_dir = Path.Combine (PathFinder.HomeDir, ".kde");
+ public static string KDE3UserDir {
+ get { return kde3_user_dir; }
+ }
+
+ private static string kde4_user_dir = String.Empty; // default initial value
+ public static string KDE4UserDir {
+ get {
+ if (kde4_user_dir != String.Empty)
+ return kde4_user_dir;
+
+ // first check if the KDE_SESSION_VERSION is set and is equal to 4
+ string env = Environment.GetEnvironmentVariable ("KDE_SESSION_VERSION");
+ // if the environment variable is set, ~/.kde4 is the kde4 directory; always.
+ if (env == "4")
+ kde4_user_dir = Path.Combine (PathFinder.HomeDir, ".kde4");
+ else
+ kde4_user_dir = null;
+
+ return kde4_user_dir;
+ }
+ }
+
+ public static string KDEUserDir {
+ get {
+ if (KDE4UserDir != null)
+ return KDE4UserDir;
+
+ // If not sure running kde4, check if the .kde4 directory was created while beagle was running
+ string kde4_dir = Path.Combine (PathFinder.HomeDir, ".kde4");
+ if (Directory.Exists (kde4_dir)) {
+ kde4_user_dir = kde4_dir; // if the kde4 directory is found, cache is for future
+ return kde4_user_dir;
+ }
+
+ // else use the kde3 directory
+ return KDE3UserDir;
+ }
+ }
+
public static string ReadPasswordKDEWallet (string folder, string username)
{
if (String.IsNullOrEmpty (folder) || String.IsNullOrEmpty (username))
Modified: trunk/beagle/beagled/KopeteQueryable/KopeteQueryable.cs
==============================================================================
--- trunk/beagle/beagled/KopeteQueryable/KopeteQueryable.cs (original)
+++ trunk/beagle/beagled/KopeteQueryable/KopeteQueryable.cs Sat Nov 22 19:09:32 2008
@@ -49,7 +49,7 @@
public KopeteQueryable () : base ("KopeteIndex")
{
- config_dir = Path.Combine (PathFinder.HomeDir, ".kde/share/apps/kopete");
+ config_dir = Path.Combine (KdeUtils.KDEUserDir, "share/apps/kopete");
log_dir = Path.Combine (config_dir, "logs");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]