示例#1
0
int main(int argc, char **argv) {
  Complex a = {1, 2};
  Complex b = {3, 4};
  Complex c, *d;

  c = AddComplex(a, b);
  c = MultiplyComplex(a, c);
  d = AllocComplex(c.real, c.imag);
  if (d != NULL) {
    printf("%lf + %lfi\n", d->real, d->imag);
  }
  free(d);
  return 0;
}
void UIDaemonHandler::AddSearch(QString name, QString search)
{
    if(SubstitutionFileParser::IsSubstituted(((UIAppDesc*)appList[name])->getAppDesktopFile()))
    {
	AddComplex(name);
    }
    else
    {
	//QDBusPendingReply<bool> result = dbus->asyncCall("AddSearch",name,"session",search);
	//QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(result);
	//connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),this, SLOT(lockFinished(QDBusPendingCallWatcher*)));
    #ifndef DBUSSETTINGS
	    settings->AddSearch(name, 1, search);
    #endif
	    dbus->call("AddSearch",name,"session",search);
	    ((UIAppDesc*)appList[name])->OnLockChanged();
    }
}
void UIDaemonHandler::AddSearch(QString name, QString interface, QString method)
{
    if(SubstitutionFileParser::IsSubstituted(((UIAppDesc*)appList[name])->getAppDesktopFile()))
    {
	AddComplex(name);
    }
    else
    {
	QString search = "type='method_call',interface='" + interface + "',member='" + method + "'";
#ifndef DBUSSETTINGS
	settings->AddSearch(name,1, search);
#endif
	dbus->call("AddSearch",name,"session",search);
	((UIAppDesc*)appList[name])->OnLockChanged();
    //QDBusPendingCall result = dbus->asyncCall("AddSearch",name,"session","type='method_call',interface='" + interface + "',member='" + method + "'");

    //QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(result);
    //connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),this, SLOT(lockFinished(QDBusPendingCallWatcher*)));
    }
}