diff src/util.c @ 12483:54448bd2ccc7

[gaim-migrate @ 14795] Allow the file transfer window open button to work in environments other than win32 and GNOME. In KDE, we do The Right Thing. Otherwise, we fall back the browser. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 14 Dec 2005 19:06:27 +0000
parents a60677ffcf8b
children 13599d978a31
line wrap: on
line diff
--- a/src/util.c	Wed Dec 14 18:24:11 2005 +0000
+++ b/src/util.c	Wed Dec 14 19:06:27 2005 +0000
@@ -2231,14 +2231,33 @@
 gaim_running_gnome(void)
 {
 	gchar *tmp = g_find_program_in_path("gnome-open");
-	if ((g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL) &&
-		(tmp != NULL))
-	{
-		g_free(tmp);
+
+	if (tmp == NULL)
+		return FALSE;
+	g_free(tmp);
+
+	return (g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL);
+}
+
+gboolean
+gaim_running_kde(void)
+{
+	gchar *tmp = g_find_program_in_path("kfmclient");
+	const char *session;
+
+	if (tmp == NULL)
+		return FALSE;
+	g_free(tmp);
+
+	session = g_getenv("KDE_FULL_SESSION");
+	if (session != NULL && !strcmp(session, "true"))
 		return TRUE;
-	}
-	g_free(tmp);
-	return FALSE;
+
+	/* If you run Gaim from Konsole under !KDE, this will provide a
+	 * a false positive.  Since we do the GNOME checks first, this is
+	 * only a problem if you're running something !(KDE || GNOME) and
+	 * you run Gaim from Konsole. This really shouldn't be a problem. */
+	return ((g_getenv("KDEDIR") != NULL) || g_getenv("KDEDIRS") != NULL);
 }
 
 char *