Esempio n. 1
0
int test1(int argc, char **argv) {
  GWEN_GUI *gui;
  int rv;
  GWEN_DIALOG *dlg;

  rv=GWEN_Init();
  if (rv) {
    DBG_ERROR_ERR(0, rv);
    return 2;
  }

  GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  /* create GUI */
  gui=Gtk2_Gui_new();
  GWEN_Gui_SetGui(gui);

  dlg=Dlg_Test1_new();
  if (dlg==NULL) {
    fprintf(stderr, "Could not create dialog.\n");
    return 2;
  }

  rv=GWEN_Gui_ExecDialog(dlg, 0);
  fprintf(stderr, "Result: %d\n", rv);

  return 0;
}
Esempio n. 2
0
int test2(int argc, char **argv) {
  int rv;
  uint32_t id1;
  uint32_t id2;
  uint64_t i1;
  uint64_t i2;
  GWEN_GUI *gui;

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  gui=Gtk2_Gui_new();
  GWEN_Gui_SetGui(gui);

  id1=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_SHOW_LOG |
                             GWEN_GUI_PROGRESS_SHOW_ABORT |
                             GWEN_GUI_PROGRESS_KEEP_OPEN,
                             "Progress-Title",
                             "<html>"
                             "<p><b>This</b> is an example <i>text</i>..</p>"
                             "<p>As you can see <font color=red>colors</font> can "
                             "be used.</p>"
                             "</html>",
                             10,
                             0);
  for (i1=1; i1<=10; i1++) {
    char numbuf[128];

    snprintf(numbuf, sizeof(numbuf)-1, "Step %d\n", (int)i1);
    GWEN_Gui_ProgressLog(id1, GWEN_LoggerLevel_Notice, numbuf);
    id2=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_SHOW_LOG |
                               GWEN_GUI_PROGRESS_DELAY |
                               GWEN_GUI_PROGRESS_SHOW_ABORT,
                               "2nd progress",
                               "Starting 2nd progress...",
                               10,
                               id1);
    for (i2=1; i2<=10; i2++) {
      sleep(1);
      fprintf(stderr, "Advancing %d/%d\n", (int)i1, (int)i2);
      rv=GWEN_Gui_ProgressAdvance(id2, i2);
      if (rv==GWEN_ERROR_USER_ABORTED) {
        fprintf(stderr, "Aborted by user (2)\n");
        break;
      }
    }
    GWEN_Gui_ProgressEnd(id2);

    rv=GWEN_Gui_ProgressAdvance(id1, i1);
    if (rv==GWEN_ERROR_USER_ABORTED) {
      fprintf(stderr, "Aborted by user (1)\n");
      break;
    }
  }

  GWEN_Gui_ProgressEnd(id1);

  return 0;
}
Esempio n. 3
0
void gnc_GWEN_Gui_log_init(void)
{
    if (!gwen_gui)
    {
        gwen_gui = Gtk2_Gui_new();
        GWEN_Gui_SetGui(gwen_gui);
    }
}
Esempio n. 4
0
void
gnc_GWEN_Gui_log_init(void)
{
    if (!log_gwen_gui)
    {
        log_gwen_gui =
#ifdef USING_GWENHYWFAR_GTK2_GUI
        Gtk2_Gui_new()
#else
        GWEN_Gui_new()
#endif
            ;

        /* Always use our own logging */
        GWEN_Gui_SetLogHookFn(log_gwen_gui, loghook_cb);

        /* Keep a reference so that the GWEN_GUI survives a GUI switch */
        GWEN_Gui_Attach(log_gwen_gui);
    }
    GWEN_Gui_SetGui(log_gwen_gui);
}
Esempio n. 5
0
static void
register_callbacks(GncGWENGui *gui)
{
    GWEN_GUI *gwen_gui;

    g_return_if_fail(gui && !gui->gwen_gui);

    ENTER("gui=%p", gui);

    gwen_gui =
#ifdef USING_GWENHYWFAR_GTK2_GUI
        Gtk2_Gui_new()
#else
        GWEN_Gui_new()
#endif
        ;
    gui->gwen_gui = gwen_gui;

    GWEN_Gui_SetMessageBoxFn(gwen_gui, messagebox_cb);
    GWEN_Gui_SetInputBoxFn(gwen_gui, inputbox_cb);
    GWEN_Gui_SetShowBoxFn(gwen_gui, showbox_cb);
    GWEN_Gui_SetHideBoxFn(gwen_gui, hidebox_cb);
    GWEN_Gui_SetProgressStartFn(gwen_gui, progress_start_cb);
    GWEN_Gui_SetProgressAdvanceFn(gwen_gui, progress_advance_cb);
    GWEN_Gui_SetProgressLogFn(gwen_gui, progress_log_cb);
    GWEN_Gui_SetProgressEndFn(gwen_gui, progress_end_cb);
    GWEN_Gui_SetGetPasswordFn(gwen_gui, getpassword_cb);
    GWEN_Gui_SetSetPasswordStatusFn(gwen_gui, setpasswordstatus_cb);
    GWEN_Gui_SetLogHookFn(gwen_gui, loghook_cb);
    gui->builtin_checkcert = GWEN_Gui_SetCheckCertFn(gwen_gui, checkcert_cb);

    GWEN_Gui_SetGui(gwen_gui);
    SETDATA_GUI(gwen_gui, gui);

    LEAVE(" ");
}
Esempio n. 6
0
int test3(int argc, char **argv) {
#ifdef USE_GWENGUI_GTK2
  GWEN_GUI *gui;
  GWEN_DIALOG *dlg;
  int rv;
  AB_BANKING *ab;

  rv=GWEN_Init();
  if (rv) {
    fprintf(stderr, "ERROR: Unable to init Gwen.\n");
    exit(2);
  }

  GWEN_Logger_SetLevel(AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Info);
  GWEN_Logger_SetLevel(AQOFXCONNECT_LOGDOMAIN, GWEN_LoggerLevel_Info);
  GWEN_Logger_SetLevel(GWEN_LOGDOMAIN, GWEN_LoggerLevel_Debug);

  gtk_init(&argc, &argv);

  gui=Gtk2_Gui_new();
  GWEN_Gui_SetGui(gui);

  ab=AB_Banking_new("test-ofxhome", NULL, 0);
  rv=AB_Banking_Init(ab);
  if (rv<0){
    fprintf(stderr, "Error on banking init: %d\n", rv);
    exit(2);
  }
  AB_Gui_Extend(gui, ab);

  dlg=OH_GetInstituteDialog_new("/tmp/ofx", NULL);
  if (dlg==NULL) {
    fprintf(stderr, "Could not create dialog\n");
    exit(2);
  }
  rv=GWEN_Gui_ExecDialog(dlg, 0);
  if (rv<=0){
    fprintf(stderr, "Dialog was aborted/rejected\n");
  }
  else {
    const OH_INSTITUTE_DATA *od;

    fprintf(stderr, "Dialog accepted, all fine\n");
    od=OH_GetInstituteDialog_GetSelectedInstitute(dlg);
    if (od) {
      fprintf(stderr, "- Id  : %d\n", OH_InstituteData_GetId(od));
      fprintf(stderr, "- Name: %s\n", OH_InstituteData_GetName(od));
      fprintf(stderr, "- FID : %s\n", OH_InstituteData_GetFid(od));
      fprintf(stderr, "- ORG : %s\n", OH_InstituteData_GetOrg(od));
      fprintf(stderr, "- URL : %s\n", OH_InstituteData_GetUrl(od));
    }

  }
  GWEN_Dialog_free(dlg);

  AB_Gui_Unextend(gui);

  rv=AB_Banking_Fini(ab);
  if (rv<0){
    fprintf(stderr, "Error on banking fini: %d\n", rv);
    exit(2);
  }
  AB_Banking_free(ab);
  GWEN_Gui_free(gui);
#endif
  return 0;
}