void ExampleWindow::on_printoperation_done(Gtk::PrintOperationResult result, const Glib::RefPtr<PrintFormOperation>& operation) { //Printing is "done" when the print data is spooled. if (result == Gtk::PRINT_OPERATION_RESULT_ERROR) { Gtk::MessageDialog err_dialog(*this, "Error printing form", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); err_dialog.run(); } else if (result == Gtk::PRINT_OPERATION_RESULT_APPLY) { //Update PrintSettings with the ones used in this PrintOperation: m_refSettings = operation->get_print_settings(); } if (! operation->is_finished()) { //We will connect to the status-changed signal to track status //and update a status bar. In addition, you can, for example, //keep a list of active print operations, or provide a progress dialog. operation->signal_status_changed().connect(sigc::bind(sigc::mem_fun(*this, &ExampleWindow::on_printoperation_status_changed), operation)); } }
static void handle_input(XtPointer client_data, int *source, XtInputId *id) { if (gps_poll(gpsdata) < 0) { XtRemoveInput(gps_input); (void)gps_close(gpsdata); XtRemoveTimeOut(timeout); XmTextFieldSetString(text_10, "No GPS data available"); (void)err_dialog(toplevel, "No GPS data available.\n\n" "Check the connection to gpsd and if gpsd is running"); gps_lost = true; gps_timeout = XtAppAddTimeOut(app, 3000, handle_gps, app); } }
/* Callback which occurs when the OK button is clicked */ static void missing_val_dialog_accept (GtkWidget *w, gpointer data) { struct missing_val_dialog *dialog = data; if ( gtk_toggle_button_get_active (dialog->button_discrete)) { gint nvals = 0; gint badvals = 0; gint i; mv_clear(&dialog->mvl); for(i = 0 ; i < 3 ; ++i ) { gchar *text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->mv[i]))); union value v; if ( !text || strlen (g_strstrip (text)) == 0 ) { g_free (text); continue; } if ( text_to_value (text, dialog->pv, &v)) { nvals++; mv_add_value (&dialog->mvl, &v); } else badvals++; g_free (text); value_destroy (&v, var_get_width (dialog->pv)); } if ( nvals == 0 || badvals > 0 ) { err_dialog (_("Incorrect value for variable type"), GTK_WINDOW (dialog->window)); return ; } } if (gtk_toggle_button_get_active (dialog->button_range)) { gchar *discrete_text ; union value low_val ; union value high_val; const gchar *low_text = gtk_entry_get_text (GTK_ENTRY (dialog->low)); const gchar *high_text = gtk_entry_get_text (GTK_ENTRY (dialog->high)); if ( text_to_value (low_text, dialog->pv, &low_val) && text_to_value (high_text, dialog->pv, &high_val)) { if ( low_val.f > high_val.f ) { err_dialog (_("Incorrect range specification"), GTK_WINDOW (dialog->window)); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); return ; } } else { err_dialog (_("Incorrect range specification"), GTK_WINDOW (dialog->window)); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); return; } discrete_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->discrete))); mv_clear (&dialog->mvl); mv_add_range (&dialog->mvl, low_val.f, high_val.f); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); if ( discrete_text && strlen (g_strstrip (discrete_text)) > 0 ) { union value discrete_val; if ( !text_to_value (discrete_text, dialog->pv, &discrete_val)) { err_dialog (_("Incorrect value for variable type"), GTK_WINDOW (dialog->window) ); g_free (discrete_text); value_destroy (&discrete_val, var_get_width (dialog->pv)); return; } mv_add_value (&dialog->mvl, &discrete_val); value_destroy (&discrete_val, var_get_width (dialog->pv)); } g_free (discrete_text); } if (gtk_toggle_button_get_active (dialog->button_none)) mv_clear (&dialog->mvl); var_set_missing_values (dialog->pv, &dialog->mvl); gtk_widget_hide (dialog->window); }
/*@ -globstate -branchstate @*/ void handle_gps(XtPointer client_data, XtIntervalId *ignored) { char *err_str = NULL; char error[128]; static bool dialog_posted = false; /*@i@*/gpsdata = gps_open(server, port); if (!gpsdata) { switch (errno ){ case NL_NOSERVICE: err_str = "can't get service entry"; break; case NL_NOHOST: err_str = "can't get host entry"; break; case NL_NOPROTO: err_str = "can't get protocol entry"; break; case NL_NOSOCK: err_str = "can't create socket"; break; case NL_NOSOCKOPT: err_str = "error SETSOCKOPT SO_REUSEADDR"; break; case NL_NOCONNECT: err_str = "can't connect to host"; break; default: err_str = "Unknown"; break; } if (!gps_lost && !dialog_posted) { (void)snprintf(error, sizeof(error), "No GPS data available.\n\n%s\n\n" "Check the connection to gpsd and if " "gpsd is running.", err_str); (void)err_dialog(toplevel, error); dialog_posted = true; } gps_timeout = XtAppAddTimeOut(app, 1000, handle_gps, app); } else { timeout = XtAppAddTimeOut(app, 2000, handle_time_out, app); timer = time(NULL); gps_set_raw_hook(gpsdata, update_panel); if (jitteropt) (void)gps_query(gpsdata, "J=1"); if (device) (void)gps_query(gpsdata, "F=%s", device); (void)gps_query(gpsdata, "w+x"); gps_input = XtAppAddInput(app, gpsdata->gps_fd, (XtPointer)XtInputReadMask, handle_input, NULL); if (gps_lost || dialog_posted) (void)err_dialog(toplevel, "GPS data is available."); dialog_posted = gps_lost = false; } }
void AsistenteJerarquia::on_botonAceptar_click() { VistaEntidadNueva* entidadPadre = NULL; VistaEntidadNueva* entidad = NULL; VistaEntidad * vep = NULL; Gtk::RadioButton* radio = NULL; bool musthide = false; int countSelected=0; Gtk::Entry *entryNombre = 0; this->m_builder->get_widget("entryNombre", entryNombre); string nom =entryNombre->get_text(); if ( nom != "") { this->vjerarquia->setNombre(nom); Gtk::TreeModel::iterator iter = this->comboBox.get_active(); if (iter) { //Si esta nodificando y ya tenia un padre vep = this->vjerarquia->getEntidadPadre(); if (vep != NULL){ vep->getEntidad()->quitarJerarquiaHija(); } Gtk::TreeModel::Row row = *iter; entidadPadre = row[this->m_ColumnasCombo.m_col_vEnt_Pointer]; this->vjerarquia->setEntidadPadre(entidadPadre); entidadPadre->getEntidad()->setJerarquiaHija(this->vjerarquia->getJerarquia()); //cobertura, interseccion this->m_builder->get_widget("radioParcial", radio); if (radio->get_active() == true){ this->vjerarquia->getJerarquia()->setCobertura(TIPO_COBERTURA_PARCIAL); }else{ this->vjerarquia->getJerarquia()->setCobertura(TIPO_COBERTURA_TOTAL); } this->m_builder->get_widget("radioExclusiva", radio); if (radio->get_active() == true){ this->vjerarquia->getJerarquia()->setInterseccion(TIPO_INTERSECCION_EXCLUSIVA); }else{ this->vjerarquia->getJerarquia()->setInterseccion(TIPO_INTERSECCION_SUPERPUESTA); } //Ahora seteo las entidades hijas typedef Gtk::TreeModel::Children type_children; type_children children = this->refTreeModel->children(); type_children::iterator iter = children.begin(); type_children::iterator iter1 = children.end(); while (iter != iter1) { Gtk::TreeModel::Row row = *iter; // si esta seleccionada la agrego o actualizo if (row[this->m_Columnas.m_col_selected] == true) { countSelected++; if (this->vjerarquia->unidaConEntidad(row[this->m_Columnas.m_col_vEnt_Pointer]) == false){ entidad = row[this->m_Columnas.m_col_vEnt_Pointer]; this->vjerarquia->agregarEntidadEspecializada(entidad); this->vjerarquia->getJerarquia()->agregarEntidadEspecializada(entidad->getEntidadNueva()); entidad->getEntidadNueva()->agregarJerarquiaPadre(this->vjerarquia->getJerarquia()); } }else{ if (this->vjerarquia->unidaConEntidad(row[this->m_Columnas.m_col_vEnt_Pointer]) == true){ this->vjerarquia->removerEntidadEspecializada(row[this->m_Columnas.m_col_vEnt_Pointer]); } } iter++; } if (countSelected>0){ musthide = true; }else{ Gtk::MessageDialog err_dialog1(*this, "Select at least one children", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); err_dialog1.run(); } }else{ Gtk::MessageDialog err_dialog2(*this, "Select the father", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); err_dialog2.run(); } } else { Gtk::MessageDialog err_dialog(*this, "No name", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); err_dialog.run(); } if (musthide==true){ this->vjerarquia->resetearLanzarProp(); this->hide(); } Ide::getInstance()->getDiagActual()->queue_draw(); Ide::getInstance()->regenerarTreePanel(); }