how can I use bonobo in xpcom?



how can I use bonobo in xpcom?
I want to use bonobo in xpcom.
I have write a bonobo service, and want to create bonobo-object in
xpcom.
This is my code in xpcom(nsService.cpp):

    if (!bonobo_init (NULL, NULL))
        g_error (_("I could not initialize Bonobo"));
    else
        printf("Initialize Bonobo!\n");

    bonobo_activate ();
    printf("bonobo_activate\n"); 

    service_server = bonobo_get_object
("OAFIID:Bonobo_Pterogaim_Service",
                     "Bonobo/Pterogaim/Service", NULL);

    
    if (service_server == CORBA_OBJECT_NIL) {
        g_warning (_("Could not create an instance of the gaim service
component"));
        bonobo_debug_shutdown ();
    }
    else {
        printf("Bonobo_Pterogaim_Service is available!\n");
    }
    
    CORBA_exception_init (&ev);

And this is part of my XUL file:

<script>
function addButton() 
{
  var aBox = document.getElementById("aBox");

  var button = document.createElement("button");
  button.setAttribute("label","A Button");
  aBox.appendChild(button);
 

    var myservice =
Components.classes["@mozilla.org/cpp_service;1"].createInstance();
    if (myservice)
        myservice.QueryInterface(Components.interfaces.nsIService);
    var buddyaccount = myservice.getForwardingBuddyCount();
    var buddyaccount = "a";

    var mylabel = document.createElement("label");
    mylabel.setAttribute("value", buddyaccount);
    aBox.appendChild(mylabel);

}
</script>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]