int transfer_widget_event (PzEvent *ev) { switch (ev->type) { case PZ_EVENT_BUTTON_DOWN: // if (ev->arg == PZ_BUTTON_ACTION) // pz_dialog("title", "no press", 2, 0, "but a", "but b"); // else if (ev->arg == PZ_BUTTON_MENU) { if (rip_status == STATUS_TRANSFERRING) { if (pz_dialog("Alert!", "Really abort transfer?", 2, 0, "No", "Yes") == 1) abort_transfer(); } else close_transfer(); //pz_close_window(ev->wid->win); } break; case PZ_EVENT_BUTTON_UP: //pz_close_window (ev->wid->win); break; case PZ_EVENT_DESTROY: // ttk_free_surface (image); // free (text); break; } return 0; }
static int pz_set_header(TWidget * wid, char * txt) { int reboot = pz_dialog(_("Reboot"), _("Header Name have been saved, Need to reboot to take effect"), 2, 0, _("ok"), _("Reboot")); pz_set_string_setting (pz_global_config, HEADERNAME, txt); pz_save_config(pz_global_config); if (reboot) pz_ipod_reboot(); pz_close_window(wid->win); return 0; }
int do_eject() { if (rip_status == STATUS_MOUNTED) do_unmount(); printf("Ejecting iPod at %s\n", RIP_MOUNTDEVICE); #ifdef IPOD /* This is a poor hack to deal with busybox's eject not working for SCSI devices */ if (vfork() == 0) { execl("/bin/rmmod", "/bin/rmmod", "sbp2", NULL); _exit(0); } pz_dialog("iPod Eject", "Please physically disconnect the iPods before pressing [OK]", 1, 0, "OK"); if (vfork() == 0) { execl("/bin/modprobe", "/bin/modprobe", "sbp2", NULL); _exit(0); } #else if (vfork() == 0) { execl("/usr/bin/eject", "/usr/bin/eject", RIP_MOUNTDEVICE, NULL); _exit(0); } #endif ipod_status_ejected(); return 1; }
static void poddraw_save( void ) { char buf[64]; int x; int choice; FILE * fp; time_t t; struct tm * current_time; choice = pz_dialog( _("Save?"), _("Save this image?"), 2, 0, _("Yes"), _("No")); if( choice == 1 ) return; if( !poddraw_buffer ) return; t = time( NULL ); current_time = localtime( &t ); strftime( buf, 64, "%Y-%m-%d_%H%M.ppm", current_time ); fp = fopen( buf, "w" ); if( !fp ) return; fprintf( fp, "P3\n" ); fprintf( fp, "#generated by poddraw/podzilla\n" ); fprintf( fp, "%d %d 255\n", screen_info.cols, screen_info.rows - HEADER_TOPLINE ); for( x=0 ; x< (screen_info.cols * (screen_info.rows - HEADER_TOPLINE)) ; x++ ) { fprintf( fp, "%d %d %d\n", (int)poddraw_buffer[x] & 0x000000ff, (int)(poddraw_buffer[x]>>8) & 0x000000ff, (int)(poddraw_buffer[x]>>16) & 0x000000ff ); } fclose( fp ); pz_message_title (_("Save"), _("Saved.")); }