Exemple #1
0
void DtPrinterIcon::ReloadNotifyCB(XtPointer data)
{
   DtPrinterIcon *printer = (DtPrinterIcon *)data;
   DtDbLoad();
   int i, n_siblings = printer->NumSiblings();
   BaseUI **siblings = printer->Siblings();

   for (i = 0; i < n_siblings; i++)
    {
      printer = (DtPrinterIcon *)siblings[i];
      char *iconName = GetPrinterLabel(printer->queue->Name(),
				       printer->app_mode);
      char *iconFile = GetPrinterIcon(printer->queue->Name(),
				      printer->app_mode);

      if (strcmp(iconName, printer->Name()))
       {
	 printer->Name(iconName);
         if (printer->PrinterAppMode() == SINGLE_PRINTER)
	    printer->mainw->IconName(iconName);
         if (printer->PrinterAppMode() == PRINT_MANAGER)
	  {
	    if (printer->mainw->findD && printer->mainw->findD->Visible())
	       printer->mainw->findD->UpdatePrinter(printer);
	  }
       }
      if (strcmp(iconFile, printer->IconFile()))
       {
	 printer->IconFile(iconFile);
         if (printer->PrinterAppMode() == SINGLE_PRINTER &&
	     iconFile && *iconFile)
	  {
	    char *s = new char [strlen(iconFile) + 6];
	    if (depth == 1)
	       sprintf(s, "%s.l.bm", iconFile);
	    else
	       sprintf(s, "%s.l.pm", iconFile);
	    printer->mainw->IconFile(s);
	    delete [] s;
	  }
       }
      if (printer->props && printer->props->Visible())
         printer->props->Reset();
    }
   if (printer->mainw->setModList && printer->mainw->setModList->Visible())
      printer->mainw->setModList->Reset();
}
Exemple #2
0
void
main (int argc,
      char         **argv)


{
    XtAppContext    appContext;
    Widget		widget;

   /* This call is required to have values to pass to DtAppInitialize */
    widget = XtAppInitialize( &appContext, "Dtfplist",
                              NULL, 0, &argc, argv, NULL, NULL, 0);

   /* This is required initialization so that FrontPanelReadDatabases()
    * procedure complete successfully.
    */
    DtAppInitialize( appContext, XtDisplay(widget), widget,
		     argv[0], (char *)szWM_TOOL_CLASS);

    
   /* Load the database for use in printing. If it is able to load print
    * contents of front panel.
    */
    DtDbLoad();

    panel.app_name = strdup(argv[0]);
    if (FrontPanelReadDatabases ())
    {
      /* Print out the contents of the .fp database */
       PrintFrontPanelContents ();
    }
    else
    {
      /* NEEDS TO BE LOCALIZED */
       printf ("PANEL not found. Error in reading database.\n");
    }

}
Exemple #3
0
int
main( 
     int argc,
     char **argv ) 
{
    Display *display;
    Arg args[20];
    int n=0;
    char *actionName;
    int numArgs = 0;
    DtActionArg *ap = NULL;
  
    XtSetLanguageProc(NULL, NULL, NULL);
    _DtEnvControl(DT_ENV_SET);
    (void) signal(SIGCHLD, (void (*)())SIG_IGN);

    /*  Initialize the toolkit and open the display  */
    XtToolkitInitialize() ;
    appContext = XtCreateApplicationContext() ;
    if ( !(display = XtOpenDisplay( appContext, NULL, argv[0], "Dtaction", 
                             option_list, 
			     sizeof(option_list)/sizeof(XrmOptionDescRec),
			     &argc, argv)) )
    {
	setlocale(LC_ALL, "");
        fprintf(stderr, "%s", GETMESSAGE(1,11,"Can't open display.\n"));
	exit(-1);
    }
  
    XtSetArg(args[n], XmNallowShellResize, True); n++;
    XtSetArg(args[n], XmNmappedWhenManaged, False); n++;
    XtSetArg(args[n], XmNheight, 1); n++;
    XtSetArg(args[n], XmNwidth, 1); n++;
    toplevel = XtAppCreateShell( argv[0], "Dtaction", 
            topLevelShellWidgetClass, display, args, n) ;

    XtRealizeWidget(toplevel);

    display = XtDisplay (toplevel);
    XtGetApplicationResources(toplevel, &appArgs, 
	resources, XtNumber(resources), NULL, 0);

    password = XtMalloc(1);
    password[0] = '\0';
    stars = XtMalloc(1);
    stars[0] = '\0';

   /*  Get Dt initialized  */
   if (DtInitialize (display, toplevel, argv[0], "Dtaction") == False)
   {
      /* Fatal Error: could not connect to the messaging system. */
      /* DtInitialize() has already logged an appropriate error msg */
      exit(-1);
   }

   /*
    * If the request specified that it wanted to run as a different
    * user, then take care of prompting for a password, and doing any
    * necessary verification and logging.
    */
   CheckUserRequest();
   
   /* Load the filetype/action dbs; DtInvokeAction() requires this */
   DtDbLoad();

   /*
    * Get the requested action name
    */
    if ( (actionName = argv[1]) == NULL)
    {
	fprintf(stderr, "%s", GETMESSAGE(1,10,"No action name specified.\n"));
	exit(-1);
    }

    if ( argc > 2 ) 
    {
	/*
	 * create an action arg array for the file objects for
	 * this action.  This number of objects should be one
	 * less than the argument count. The returned vector will
	 * be terminated by a null pointer.
	 */
	numArgs= argc - 2;
	ap = (DtActionArg *) XtCalloc(numArgs,sizeof(DtActionArg)); 
    }

	/*
	 * This client is restricted to FILE arguments.
	 * for the time being.
	 */
    for ( n = 0; n < numArgs; n++) {
        ap[n].argClass    = DtACTION_FILE;
	ap[n].u.file.name = argv[n+2];
    }

    actionId = DtActionInvoke(toplevel, actionName, ap, numArgs,
        appArgs.termOpts,
        appArgs.execHost,
        appArgs.contextDir,
        True,			/* use indicator */
        (DtActionCallbackProc) actionStatusCallback,
        NULL);

    /*
     * Set up a timer if we didn't get a valid procId -- since there will
     * be no invocation update in that case.
     * We must invoke XtMainLoop() at least once, to force any prompt or
     * error dialogs to get posted.
     */
    if ( !actionId)
	    XtAppAddTimeOut(appContext,
		10, (XtTimerCallbackProc)CheckForDone,
			   NULL);

    XtAppMainLoop(appContext);

    return EXIT_SUCCESS;
}