int philips_configure_test ( long id ) { GtkWidget *Camera_Configuration; int error; if ( p_cfg_info != NULL ) { printf ( "Someone has read the configuration, Opps!\n" ); free ( p_cfg_info ) ; } /* initialize camera and grab configuration information */ if ( philips_open_camera() == 0 ) { error_dialog ( "Could not open camera." ); return ( 0 ); } if ( (p_cfg_info = philips_getcfginfo ( &error )) == NULL ) { printf ( "Error reading camera configuration\n" ); } Camera_Configuration = create_Camera_Configuration (); philips_set_config_options ( id, Camera_Configuration, p_cfg_info ); gtk_widget_show (Camera_Configuration); while (GTK_WIDGET_VISIBLE(Camera_Configuration)) gtk_main_iteration(); gtk_widget_destroy ( Camera_Configuration ); return (1); }
void on_apply_button_clicked (GtkButton *button, GtkWidget *user_data) { int error; if ( p_cfg_info != NULL ) { philips_get_config_options ( user_data, p_cfg_info ); if ( (error = philips_setcfginfo ( p_cfg_info )) ) { printf ( "Error occured setting camera configuration. %d\n", error ); } p_cfg_info = philips_getcfginfo ( &error ); } }
char *philips_summary () { PhilipsCfgInfo *pcfginfo; int error; char tmp[128]; /* initialize camera and grab configuration information */ if (philips_open_camera() == 0) { error_dialog ( "Could not open camera." ); return ( NULL ); } if ( (pcfginfo = philips_getcfginfo ( &error )) == NULL ) { error_dialog ( "Can't get camera configuration." ); philips_close_camera(); return ( NULL ); } philips_close_camera(); sprintf ( philips_summary_string, "%s\n\n", philips_model(cameraid) ); sprintf ( tmp, "Number of pictures: %ld\n", pcfginfo->picts ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Memory : %d/%d bytes\n", pcfginfo->a_memory, pcfginfo->memory ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Copyright String : %s\n", pcfginfo->copyright ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Resolution : %d\n", pcfginfo->resolution ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Compression: %d\n", pcfginfo->compression ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera White level: %d\n", pcfginfo->white ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Exposure : %d\n", pcfginfo->exposure ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Record Mode: %d\n", pcfginfo->mode ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Flash Mode : %d\n", pcfginfo->flash ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Macro : %d\n", pcfginfo->macro ); strcat ( philips_summary_string, tmp ); sprintf ( tmp, "Camera Zoom Level : %d\n", pcfginfo->zoom ); strcat ( philips_summary_string, tmp ); free ( pcfginfo ); return ( philips_summary_string ); }
int philips_configure () { struct P_CONFIG_CONTROLS controls; PhilipsCfgInfo *pcfginfo; int error; GtkWidget *dialog; GtkWidget *notebook; GtkWidget *button; char *info, title[128]; /* initialize camera and grab configuration information */ if (philips_open_camera() == 0) { error_dialog ( "Could not open camera." ); return 0; } if ( (pcfginfo = philips_getcfginfo ( &error )) == NULL ) { error_dialog ( "Can't get camera configuration." ); philips_close_camera(); return ( 0 ); } philips_close_camera(); update_progress(12); sprintf ( title, "Configure Camera %s", philips_model(cameraid) ); info = (char *)malloc(2048); /* create a new dialog box */ dialog = gtk_dialog_new(); gtk_window_set_title (GTK_WINDOW(dialog), title); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 10); /* create a new notebook, place the position of the tabs */ notebook = gtk_notebook_new (); gtk_notebook_set_tab_pos ( GTK_NOTEBOOK(notebook), GTK_POS_TOP ); gtk_widget_show ( notebook ); gtk_container_add ( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), notebook ); /* add a page to the notebook */ philips_cfg_page1 ( notebook, &controls, pcfginfo ); update_progress(25); philips_cfg_page2 ( notebook, &controls, pcfginfo ); update_progress(50); philips_cfg_page3 ( notebook, &controls, pcfginfo ); update_progress(75); philips_cfg_page4 ( notebook, &controls, pcfginfo ); /* create an OK button */ button = gtk_button_new_with_label ( " OK " ); gtk_signal_connect_object ( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog) ); gtk_box_pack_end ( GTK_BOX(GTK_DIALOG(dialog)->action_area), button, TRUE, FALSE, 0 ); gtk_widget_show ( button ); /* create a Cancel button */ button = gtk_button_new_with_label ( " Cancel " ); gtk_signal_connect_object ( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog) ); gtk_box_pack_end ( GTK_BOX(GTK_DIALOG(dialog)->action_area), button, TRUE, FALSE, 0 ); gtk_widget_show ( button ); update_progress(100); gtk_widget_show ( dialog ); update_status ( "Done." ); update_progress ( 0 ); while (GTK_WIDGET_VISIBLE(dialog)) gtk_main_iteration(); /* if (strcmp("Cancel", (char*)gtk_object_get_data(GTK_OBJECT(dialog), "button"))==0) { printf ( "Cancel button pressed, return 1\n" ); return 1; } */ printf ( "Done with config, return 1\n" ); return 1; }