All pastes #446100 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-18 09:01 UTC
rendered paste body
  PyObject* WindowXML_AddItem(WindowXML *self, PyObject *args, int mylistposs)
  {
	mylistposs = 0;
    PyObject *pObject;
    string strText;
    ListItem* pListItem = NULL;
    bool bRefresh = true;
    if (!PyArg_ParseTuple(args, "O|i", &pObject,&mylistposs))  return NULL;
    if (ListItem_CheckExact(pObject))
    {
      // object is a listitem
      pListItem = (ListItem*)pObject;
      Py_INCREF(pListItem);
    }
    else
    {
      // object is probably a text item
      if (!PyGetUnicodeString(strText, pObject, 1)) return NULL;
      // object is a unicode string now, create a new ListItem

      pListItem = ListItem_FromString(strText);
    }
    CGUIPythonWindowXML * pwx = (CGUIPythonWindowXML*)self->pWindow;
    // Tells the window to add the item to FileItem vector
    pwx->AddItem((CFileItem *)pListItem->item,mylistposs);

    // create message
    //CGUIMessage msg(GUI_MSG_LABEL_ADD, self->iWindowId, self->iWindowId);
    //msg.SetLPVOID(pListItem->item);

    // send message
    PyGUILock();
    //if (self->pWindow) self->pWindow->OnMessage(msg);
    PyGUIUnlock();

    Py_INCREF(Py_None);
    return Py_None;
  }