int main (int argc, char **argv) { MonoDomain *domain; Deployment *deployment; MoonWindow *window; MoonWindowingSystem *winsys; Surface *surface; char *data_dir; // setenv ("MONO_PATH", "/opt/mono/lib/mono/2.0:/opt/moonlight-osx/lib/mono/moonlight/", 1); setenv ("MONO_PATH", "/Users/plasma/Work/darwoon/moon/class/lib/2.1", 1); //setenv ("MOONLIGHT_DEBUG", "mediaplayer", 1); setenv ("MOONLIGHT_OVERRIDES", "curlbridge=yes", 1); setenv ("MOONLIGHT_DISABLE_INCOMPLETE_MESSAGE", "1", 1); setenv ("XAP_URI", "file://Users/plasma/tmp/xap", 1); mono_config_parse_memory(mono_config); mono_debug_init (MONO_DEBUG_FORMAT_MONO); mono_set_signal_chaining (true); domain = mono_jit_init_version ("Moonlight for OSX Root Domain", "v2.0.50727"); mono_jit_set_trace_options ("E:all"); Runtime::InitDesktop (); winsys = Runtime::GetWindowingSystem (); winsys->SetPlatformWindowingSystemData (NULL); deployment = Deployment::GetCurrent (); window = winsys->CreateWindow (MoonWindowType_Desktop, 640, 480); surface = new Surface (window); deployment->SetSurface (surface); window->SetSurface (surface); surface->SetSourceLocation (Uri::Create ("file:///Users/toshok/tmp/xap")); deployment->SetXapFilename (argv[1]); deployment->SetXapLocation (Uri::Create ("file:///Users/toshok/src/moonlight-android/moonlight-activity/DemoApp.xap")); window->SetTitle (argv[1]); surface->AddXamlHandler (Surface::ErrorEvent, error_handler, NULL); surface->unref (); if (!deployment->InitializeManagedDeployment (NULL, NULL, NULL)) { surface->unref (); g_debug ("Could not initialize managed deployment"); return 0; } g_warning ("pid: %i\n", getpid ()); winsys->RunMainLoop (window); // Shutdown ungracefully for now return 1; }
void MoonWindowGtk::uninstall_application (MoonWindowGtk *window) { window->SetCurrentDeployment (); Deployment *deployment = Deployment::GetCurrent (); Application *application = deployment->GetCurrentApplication (); application->Uninstall (); }
bool Application::IsInstallable () { Deployment *deployment = Deployment::GetCurrent (); const Uri *location = deployment->GetXapLocation (); if (!location) return false; return location->IsScheme ("file") || location->IsScheme ("http") || location->IsScheme ("https"); }
void TeleopPeriodic(void) { myarm->prepareSignal(); // Call the drive routine to drive the robot. if(rightStick->GetRawButton(1)|| leftStick->GetRawButton(1)) drive->MecanumDrive_Cartesian(rightStick->GetX()/2,leftStick->GetY()/2,leftStick->GetX()/2,0.00); else drive->MecanumDrive_Cartesian(rightStick->GetX(),leftStick->GetY(),leftStick->GetX(),0.00); GetStateForArm(); //Wait(.1); if(modeArm==DDCArm::kManualOveride) { myarm->OperateArm(0,0,0,modeArm); //Shoulder movement if(leftStick->GetRawButton(3)) myarm->MoveShoulder(1); else if(leftStick->GetRawButton(2)) myarm->MoveShoulder(-1); else myarm->MoveShoulder(0); //Elbow Movement if(rightStick->GetRawButton(3)) myarm->MoveElbow(1); else if (rightStick->GetRawButton(2)) myarm->MoveElbow(-1); else myarm->MoveElbow(0); //Wrist Movement if(rightStick->GetRawButton(4)) myarm->MoveWrist(-1); else if(rightStick->GetRawButton(5)) myarm->MoveWrist(1); else myarm->MoveWrist(0); } else myarm->OperateArm(0.0,0.0,peg,modeArm); if(leftStick->GetRawButton(4)) myarm->MoveClaw(-1); else if(leftStick->GetRawButton(5)) myarm->MoveClaw(1); else myarm->MoveClaw(0); if(rightStick->GetRawButton(10)) { printf("S: %f \n E: %f \n W: %f \n \n",myarm->GetShoulderVoltage(),myarm->GetElbowVoltage(), myarm->GetWristVoltage()); } deploy->OperateDeployment(fire,pull); // Send Data to the Driver Station for Monitoring (w/in . //sendIOPortData(); //Wait(.1); }
LocalMessageSender::LocalMessageSender (const char *receiverName, const char *receiverDomain) : DependencyObject (Type::LOCALMESSAGESENDER) { this->receiverName = g_strdup (receiverName); this->senderDomain = NULL; Deployment *deployment = Deployment::GetCurrent(); if (deployment && deployment->GetXapLocation ()) { this->senderDomain = g_strdup (deployment->GetXapLocation ()->GetHost ()); } if (this->senderDomain == NULL) this->senderDomain = g_strdup (""); this->receiverDomain = g_strdup (receiverDomain && *receiverDomain ? receiverDomain : senderDomain); sender = NULL; }
void MoonWindowGtk::RightClickMenu () { Deployment *deployment = Deployment::GetCurrent (); OutOfBrowserSettings *settings; GtkWidget *menu_item; GtkWidget *menu; char *name; menu = gtk_menu_new(); menu_item = gtk_menu_item_new_with_label ("Moonlight Settings"); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); g_signal_connect_swapped (G_OBJECT(menu_item), "activate", G_CALLBACK (show_moonlight_dialog), this); if (deployment && (settings = deployment->GetOutOfBrowserSettings ())) { Application *application = deployment->GetCurrentApplication (); switch (application->GetInstallState ()) { case InstallStateNotInstalled: if (application->IsInstallable () && settings->GetShowInstallMenuItem ()) { name = g_strdup_printf ("Install %s onto this computer...", settings->GetShortName ()); menu_item = gtk_menu_item_new_with_label (name); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); g_signal_connect_swapped (G_OBJECT(menu_item), "activate", G_CALLBACK (install_application), this); g_free (name); } break; case InstallStateInstalled: menu_item = gtk_menu_item_new_with_label ("Remove this application..."); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); g_signal_connect_swapped (G_OBJECT(menu_item), "activate", G_CALLBACK (uninstall_application), this); break; default: break; } } gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); }
bool Application::InstallWithError (MoonError *error, bool user_initiated, bool unattended) { MoonInstallerService *installer = Runtime::GetInstallerService (); Deployment *deployment = Deployment::GetCurrent (); // application manifest must allow out-of-browser support OutOfBrowserSettings *settings = deployment->GetOutOfBrowserSettings (); if (!settings) { // FIXME - this fix a crasher but is not complete wrt MSDN return false; } if (!IsInstallable ()) { MoonError::FillIn (error, MoonError::INVALID_OPERATION, "Applications may only be installed from http, https or file URLs"); return false; } if (GetInstallState () == InstallStateInstalled || IsRunningOutOfBrowser ()) { MoonError::FillIn (error, MoonError::INVALID_OPERATION, "Application is already installed"); return false; } // the dialog is displayed only if the action leading to this call was initiated directly from the user if (!unattended && !user_initiated && !deployment->GetSurface ()->IsUserInitiatedEvent ()) return false; SetInstallState (InstallStateInstalling); if (installer->Install (deployment, unattended)) { SetInstallState (InstallStateInstalled); return true; } SetInstallState (InstallStateInstallFailed); return false; }
int main (int argc, char **argv) { fputs ("lunar-launcher " VERSION "\n", stdout); #if DEBUG /* stdout defaults to block buffering if it's not writing to a terminal, which happens with our test harness: * we redirect stdout to capture it. Force line buffering in all cases. */ setlinebuf (stdout); /* We also need to disable SIGHUP - we have another workaround for the above problem for chrome, where we create * a pseudo terminal to capture stdout/stderr. Problem is that when the browser closes after executing * lunar-launcher, a SIGHUP is sent to all its descendant processes (since the browser is the foreground process * of the controlling terminal), which ends up killing lunar-launcher. */ struct sigaction sa; sa.sa_sigaction = lunar_handle_native_sigsegv; sigemptyset (&sa.sa_mask); sa.sa_flags = SA_SIGINFO; g_assert (sigaction (SIGHUP, &sa, NULL) != -1); #endif Deployment *deployment; MoonWindow *window; char *plugin_dir; if (argc != 2) display_help (); /* expects to be run from the xpi plugin dir */ plugin_dir = g_path_get_dirname (argv[0]); add_mono_config (plugin_dir); runtime_init_browser (plugin_dir, true); g_free (plugin_dir); /* get the pal services we need */ winsys = runtime_get_windowing_system (); installer = runtime_get_installer_service (); LOG_OOB ("[%i lunar-launcher]: Starting\n", getpid ()); deployment = new Deployment (); deployment->Initialize (); Deployment::SetCurrent (deployment); if (!deployment->InitializeAppDomain ()) { g_warning ("Could not initialize the AppDomain."); return EXIT_FAILURE; } if (!(window = create_window (deployment, argv[1]))) return EXIT_FAILURE; winsys->RunMainLoop (window); deployment->Shutdown (); /* Our shutdown is async, so keep processing events/timeouts until there is * nothing more to do */ while (g_main_context_iteration (NULL, false)) { ; } runtime_shutdown (); LOG_OOB ("[%i lunar-launcher]: Exiting\n", getpid ()); return EXIT_SUCCESS; }
/* * Sample line tracking class for FIRST 2011 Competition * Jumpers on driver station digital I/O pins select the operating mode: * The Driver Station digital input 1 select whether the code tracks the straight * line or the forked line. Driver station digital input 2 selects whether the * code takes the left or right fork. You can set these inputs using jumpers on * the USB I/O module or in the driver station I/O Configuration pane (if there * is no Digital I/O module installed. * * Since there is the fork to contend with, the code tracks the edge of the line * using a technique similar to that used with a single-sensor Lego robot. * * The two places to do tuning are: * * defaultSteeringGain - this is the amount of turning correction applied * forkProfile & straightProfile - these are power profiles applied at various * times (one power setting / second of travel) as the robot moves towards * the wall. */ void AutonomousPeriodic(void) { // // loop until either we hit the "T" at the end or 8 seconds has // // elapsed. The time to the end should be less than 7 seconds // // for either path. // time = autotimer->Get(); // //if(time < 8.0 && !atCross) { // if(!atCross){ // // int timeInSeconds = (int) time; // int leftValue = left->Get() ? 0 : 1; // read the line tracking sensors // int middleValue = middle->Get() ? 0 : 1; // int rightValue = right->Get() ? 0 : 1; // // // compute the single value from the 3 sensors. Notice that the bits // // for the outside sensors are flipped depending on left or right // // fork. Also the sign of the steering direction is different for left/right. // if (goLeft)//on fork and go left // { // binaryValue = leftValue * 4 + middleValue * 2 + rightValue; // steeringGain = -defaultSteeringGain; // } // else //on straight, or on fork and go right // { // binaryValue = rightValue * 4 + middleValue * 2 + leftValue; // steeringGain = defaultSteeringGain; // } // speed=-.2; // turn = 0; // default to no turn // // switch (binaryValue) { // case 1: // just the outside sensor - drive straight // turn = 0; // break; // case 7: // all sensors - maybe at the "T" // if (time > stopTime) { // atCross = true; // speed = 0; // } // break; // case 0: // no sensors - apply previous correction // if (previousValue == 0 || previousValue == 1) { // turn = steeringGain; // } // else { // turn = -steeringGain; // } // break; // default: // anything else, steer back to the line // turn = -steeringGain; // } // // // // useful debugging output for tuning your power profile and steering gain // if(binaryValue != previousValue) // { // printf("Time: %2.2f sensor: %d speed: %1.2f turn: %1.2f atCross: %d\n", time, binaryValue, speed, turn, atCross); // } // // // move the robot forward // float angle = mygyro->GetAngle(); // get heading // drive->MecanumDrive_Cartesian(turn, speed, 0, angle); // // if (binaryValue != 0) // previousValue = binaryValue; // // oldTimeInSeconds = timeInSeconds; // } // // stop driving when finished // else // drive->MecanumDrive_Cartesian(0,0,0,mygyro->GetAngle()); // Wait(.1); drive->MecanumDrive_Cartesian(0,0,0,0); deploy->OperateDeployment(false,true); }
void DisabledPeriodic(void) { // increment the number of disabled periodic loops completed deploy->OperateDeployment(false,true); }
void madara::cid::ga_naive (Settings & settings, double duration) { ACE_High_Res_Timer timer; ACE_Time_Value max_tv (0, 0); ACE_hrtime_t elapsed (0); ACE_hrtime_t maximum (0); timer.reset (); timer.start (); max_tv.set (duration); maximum = max_tv.sec () * 1000000000; maximum += max_tv.usec () * 1000; #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_naive:" \ " creating an exact copy of the solution vector\n")); #endif // create an exact copy of the solution vector Deployment current; current.resize (settings.solution.size ()); std::copy (settings.solution.begin (), settings.solution.end (), current.begin ()); #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_naive:" \ " calculating latency for the solution so far\n")); #endif uint64_t orig_latency = calculate_latency (settings); uint64_t new_latency; while (maximum > elapsed) { // generate some candidates for mutating unsigned int candidate1 = rand () % settings.solution.size (); unsigned int candidate2 = rand () % settings.solution.size (); #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_naive:" \ " initial candidates: %u, %u\n", candidate1, candidate2)); #endif // loop until we have two different candidates while (candidate1 == candidate2) candidate1 = rand () % settings.solution.size (); #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_naive:" \ " final candidates: %u, %u\n", candidate1, candidate2)); #endif // attempt the swap std::swap (current[candidate1], current[candidate2]); new_latency = calculate_latency ( settings.network_latencies, settings.target_deployment, current); if (new_latency < orig_latency) { #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_naive:" \ " latency improvement: %Q->%Q. Copying solution.\n", orig_latency, new_latency)); #endif std::copy (current.begin (), current.end (), settings.solution.begin ()); orig_latency = new_latency; } timer.stop (); timer.elapsed_time (elapsed); } for (unsigned int i = 0; i < settings.solution.size (); ++i) { if (settings.solution_lookup[settings.solution[i]] != i) settings.solution_lookup[settings.solution[i]] = i; } }
void madara::cid::ga_degree (Settings & settings, double duration) { if (settings.solution.size () < 2) return; ACE_High_Res_Timer timer; ACE_Time_Value max_tv (0, 0); ACE_hrtime_t elapsed (0); ACE_hrtime_t maximum (0); timer.reset (); timer.start (); max_tv.set (duration); maximum = max_tv.sec () * 1000000000; maximum += max_tv.usec () * 1000; #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " entering main function\n")); #endif // create an exact copy of the solution vector Deployment current; current.resize (settings.solution.size ()); std::copy (settings.solution.begin (), settings.solution.end (), current.begin ()); uint64_t orig_latency = calculate_latency (settings); unsigned int num_degreed_nodes = 0; Workflow & deployment = settings.target_deployment; SummationsMap & averages = settings.network_summations; SolutionMap solution_lookup; #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " copying initial solution\n")); #endif for (unsigned int i = 0; i < current.size (); ++i) { solution_lookup[current[i]] = i; } #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " counting the degreed nodes in the deployment\n")); #endif // count the number of degreed nodes in the deployment. for (unsigned int i = 0; i < deployment.size (); ++i) { if (deployment[i].size () == 0) break; ++num_degreed_nodes; } #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " Attempting up to %f seconds worth of mutations to find better solution\n", duration)); #endif while (maximum > elapsed) { /** * 1/5 times, choose a naive solution. * 4/5 times, choose to swap someone from the high degreed candidates **/ int tactic = rand () % 5; unsigned int candidate1; unsigned int candidate2; if (tactic == 4) { #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " naively choosing candidates\n")); #endif // go with a naive solution candidate1 = rand () % settings.solution.size (); candidate2 = rand () % settings.solution.size (); if (settings.solution.size () > 0) { // loop until we have two different candidates while (candidate1 == candidate2) candidate1 = rand () % settings.solution.size (); } } else { #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " choosing degree-informed candidates\n")); #endif unsigned int choice = rand () % num_degreed_nodes; // use degree and latency information to form ideal candidates candidate1 = deployment[choice][0].first; LatencyVector & cur_summations = settings.network_summations[deployment[choice].size ()]; /** * the other candidate can be from a range: * 0-2 : top num_degreed_nodes * 3 : top 10% * 4 : top 25% **/ int candidate_type = rand () % 5; unsigned int range; if (cur_summations.size () < 50) { range = cur_summations.size () / 10 + 1; candidate2 = solution_lookup[cur_summations[rand () % range].first]; } else if (candidate_type <= 2) { if (num_degreed_nodes < 5) { range = cur_summations.size () / 20; } else { range = num_degreed_nodes; } #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " choosing from top %u candidates\n", range)); #endif candidate2 = solution_lookup[cur_summations[rand () % range].first]; } else if (candidate_type == 3) { // choose candidate2 from the top 10% range = cur_summations.size () / 10; #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " choosing from top %u candidates\n", range)); #endif candidate2 = solution_lookup[cur_summations[rand () % range].first]; } else { // choose candidate2 from the top 25% range = cur_summations.size () / 4; #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " choosing from top %u candidates\n", range)); #endif candidate2 = solution_lookup[cur_summations[rand () % range].first]; } #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " initial candidates: %u, %u\n", candidate1, candidate2)); #endif // loop until we have two different candidates while (range >= 2 && candidate1 == candidate2) candidate2 = solution_lookup[cur_summations[rand () % range].first]; } #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " final candidates: %u, %u\n", candidate1, candidate2)); #endif // attempt the swap if (candidate1 != candidate2) { std::swap (current[candidate1], current[candidate2]); solution_lookup[current[candidate1]] = candidate1; solution_lookup[current[candidate2]] = candidate2; uint64_t new_latency = calculate_latency ( settings.network_latencies, deployment, current); #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " latency: %Q->%Q\n", orig_latency, new_latency)); #endif if (new_latency < orig_latency) { #ifdef ENABLE_CID_LOGGING MADARA_DEBUG (MADARA_LOG_DETAILED_TRACE, (LM_DEBUG, DLINFO "madara::cid::ga_degree:" \ " updating solution to current\n", orig_latency, new_latency)); #endif std::copy (current.begin (), current.end (), settings.solution.begin ()); for (unsigned int j = 0; j < settings.solution.size (); ++j) { if (settings.solution_lookup[settings.solution[j]] != j) settings.solution_lookup[settings.solution[j]] = j; } orig_latency = new_latency; } } timer.stop (); timer.elapsed_time (elapsed); } }
static void bug_report_info (AboutConfigDialogPage *page) { Surface *surface = page->GetDialog()->GetSurface(); Deployment *deployment = page->GetDialog()->GetDeployment(); MoonWindowGtk *window = page->GetDialog()->GetWindow(); GtkWidget *dlg = gtk_dialog_new_with_buttons ("But Report Info", NULL /* FIXME parent */, (GtkDialogFlags)(GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT), "Close", GTK_RESPONSE_CLOSE, NULL); GtkWidget *vbox = GTK_DIALOG (dlg)->vbox; GtkWidget *hbox = gtk_hbox_new (FALSE, 0); GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_BUTTON); GtkWidget *label = gtk_label_new ("Cut and paste the information below into your bug report. " "Be aware this contains information about the current silverlight " "application you are viewing."); GtkWidget *textview; GtkTextBuffer *buffer = gtk_text_buffer_new (NULL); GString *str = g_string_new (""); g_string_append_printf (str, "Source: %s\n", deployment->GetXapLocation()); g_string_append_printf (str, "Width: %dpx\n", window->GetWidth ()); g_string_append_printf (str, "Height: %dpx\n", window->GetHeight ()); g_string_append_printf (str, "Background: %s\n", color_to_string (surface->GetBackgroundColor ())); g_string_append_printf (str, "RuntimeVersion: %s\n", deployment->GetRuntimeVersion() ? deployment->GetRuntimeVersion() : "(Unknown)"); g_string_append_printf (str, "Windowless: %s\n", window->GetWidget() == NULL ? "yes" : "no"); g_string_append_printf (str, "MaxFrameRate: %i\n", surface->GetTimeManager()->GetMaximumRefreshRate()); g_string_append_printf (str, "Codecs: %s\n", Media::IsMSCodecsInstalled () ? "ms-codecs" : #if INCLUDE_FFMPEG "ffmpeg" #else "none" #endif ); g_string_append (str, "Build configuration: "); #if DEBUG g_string_append (str, "debug"); #else g_string_append (str, "release"); #endif #if SANITY g_string_append (str, ", sanity checks"); #endif #if OBJECT_TRACKING g_string_append (str, ", object tracking"); #endif g_string_append (str, "\n"); gtk_text_buffer_set_text (buffer, str->str, str->len); textview = gtk_text_view_new_with_buffer (buffer); g_string_free (str, TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); GtkWidget *image_align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0); gtk_container_add (GTK_CONTAINER (image_align), image); gtk_box_pack_start (GTK_BOX (hbox), image_align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), textview, TRUE, TRUE, 0); gtk_widget_show_all (vbox); if (GTK_RESPONSE_CLOSE == gtk_dialog_run (GTK_DIALOG (dlg))) gtk_widget_destroy (dlg); }