gint close_all(void) { remove_input(); waiting_for_char = FALSE; waiting_for_timer = FALSE; gtk_statusbar_pop(GTK_STATUSBAR(StatusBar), id); close(Fichier); gtk_widget_destroy(Window); return FALSE; }
void RemoteReconfigSubjectImpl::swap(const char* addConfigurationString, const char* removeConfigurationString) throw(CORBA::SystemException) { jccl::Configuration add_elements, delete_elements; std::string add_element_string(addConfigurationString); std::string remove_element_string(removeConfigurationString); //Loading from an istream std::istringstream add_input(add_element_string); std::istringstream remove_input(remove_element_string); add_input >> add_elements; remove_input >> delete_elements; //Send pending changes to ConfigManager jccl::ConfigManager::instance()->addConfigurationRemovals(&delete_elements); jccl::ConfigManager::instance()->addConfigurationAdditions(&add_elements); }
static void stop_input(srs_plugin_t *plugin) { context_t *ctx = (context_t *)plugin->plugin_data; mrp_log_info("stopping input plugin"); if (ctx) { udev_unref(ctx->udev); while (ctx->nkbd > 0) remove_input(ctx, ctx->kbds->path, &ctx->nkbd, &ctx->kbds); mrp_free(ctx->kbds); ctx->nkbd = 0; ctx->kbds = NULL; } return; }
void ecriture(gpointer data, gint source, GdkInputCondition condition) { static gchar buffer[BUFFER_EMISSION]; static gchar *current_buffer; static gint bytes_to_write; gint bytes_written; gchar *car; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), (gfloat)car_written/(gfloat)nb_car ); if(car_written < nb_car) { /* Read the file only if buffer totally sent or if buffer empty */ if(current_buffer_position == bytes_read) { bytes_read = read(Fichier, buffer, BUFFER_EMISSION); current_buffer_position = 0; current_buffer = buffer; bytes_to_write = bytes_read; } car = current_buffer; if(config.delai != 0 || config.car != -1) { /* search for next LF */ bytes_to_write = current_buffer_position; while(*car != LINE_FEED && bytes_to_write < bytes_read) { car++; bytes_to_write++; } if(*car == LINE_FEED) bytes_to_write++; } /* write to serial port */ bytes_written = send_serial(current_buffer, bytes_to_write - current_buffer_position); if(bytes_written == -1) { /* Problem while writing, stop file transfer */ g_free(str); str = g_strdup_printf(_("Cannot write file %s\n"), strerror(errno)); show_message(str, MSG_ERR); close_all(); return; } car_written += bytes_written; current_buffer_position += bytes_written; current_buffer += bytes_written; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), (gfloat)car_written/(gfloat)nb_car ); if(config.delai != 0 && *car == LINE_FEED) { remove_input(); g_timeout_add(config.delai, (GSourceFunc)timer, NULL); waiting_for_timer = TRUE; } else if(config.car != -1 && *car == LINE_FEED) { remove_input(); waiting_for_char = TRUE; } } else { close_all(); return; } return; }