예제 #1
0
int OH_GetInstituteDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender)
{
  OH_GETINST_DIALOG *xdlg;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, OH_GETINST_DIALOG, dlg);
  assert(xdlg);

  DBG_ERROR(0, "Activated: %s", sender);
  if (strcasecmp(sender, "listBox")==0) {
    OH_INSTITUTE_SPEC *os;

    os=OH_GetInstituteDialog_DetermineSelectedBankInfo(dlg);
    GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, os?1:0, 0);

    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "nameEdit")==0) {
    OH_GetInstituteDialog_UpdateList(dlg);
    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "okButton")==0) {
    OH_INSTITUTE_SPEC *os;

    os=OH_GetInstituteDialog_DetermineSelectedBankInfo(dlg);
    if (os) {
      const OH_INSTITUTE_DATA *od;

      od=OfxHome_GetData(xdlg->ofxHome, OH_InstituteSpec_GetId(os));
      if (od) {
        OH_InstituteData_free(xdlg->selectedData);
        xdlg->selectedData=OH_InstituteData_dup(od);
        return GWEN_DialogEvent_ResultAccept;
      }
      else {
        DBG_ERROR(AQOFXCONNECT_LOGDOMAIN, "No institute data for id=%d",
                  OH_InstituteSpec_GetId(os));
      }
    }
    return GWEN_DialogEvent_ResultHandled;
  }
  else if (strcasecmp(sender, "abortButton")==0)
    return GWEN_DialogEvent_ResultReject;
  else if (strcasecmp(sender, "wiz_help_button")==0) {
    /* TODO: open a help dialog */
  }

  return GWEN_DialogEvent_ResultNotHandled;
}
예제 #2
0
static void createListBoxString(const OH_INSTITUTE_SPEC *os, GWEN_BUFFER *tbuf) {
  const char *s;
  char numbuf[32];

  s=OH_InstituteSpec_GetName(os);
  if (s && *s) {
    GWEN_Buffer_AppendString(tbuf, s);
    snprintf(numbuf, sizeof(numbuf)-1, " (%d)", OH_InstituteSpec_GetId(os));
    numbuf[sizeof(numbuf)-1]=0;
    GWEN_Buffer_AppendString(tbuf, numbuf);
  }
  else {
    snprintf(numbuf, sizeof(numbuf)-1, "%d", OH_InstituteSpec_GetId(os));
    numbuf[sizeof(numbuf)-1]=0;
    GWEN_Buffer_AppendString(tbuf, numbuf);
  }
}