10 bool haveUnity =
false;
11 bool haveSound =
false;
13 std::string PROCESS_INDICATOR_SOUND =
"indicator-sound-service";
22 pdir = opendir(
"/proc");
23 if (pdir == NULL) exit(EXIT_FAILURE);
25 for (de = readdir(pdir); de != NULL && (!haveUnity || !haveSound); de = readdir(pdir)) {
27 if (de->d_type == DT_DIR) {
29 if (dName.find_first_not_of(
"0123456789") == std::string::npos) {
30 clPath.assign(
"/proc/");
31 clPath.append(de->d_name);
32 clPath.append(
"/cmdline");
35 clFile = fopen(clPath.c_str(),
"r");
37 fscanf(clFile,
"%s", tmp);
41 procName = clStr.substr(clStr.find_last_of(
"/") + 1);
43 haveSound = (procName == PROCESS_INDICATOR_SOUND) ?
true :
false;
45 haveUnity = (procName == PROCESS_UNITY) ?
true :
false;
53 return (haveUnity && haveSound);
NS_DECL_ISUPPORTS NS_DECL_IUNITYPROXY bool isUnityRunning()