void edited() { std::string data = _text.get_string_value(); gchar *converted; gsize bread, bwritten; GError *error = 0; if (_encoding != "utf8" && _encoding != "UTF8" && _encoding != "utf-8" && _encoding != "UTF-8") { converted = g_convert(data.data(), (gssize)data.length(), _encoding.c_str(), "UTF-8", &bread, &bwritten, &error); if (converted == NULL || data.length() != bread) { std::string message = base::strfmt("Data could not be converted back to %s", _encoding.c_str()); if (error) { message.append(": ").append(error->message); g_error_free(error); } _message.set_text(message); if (converted != NULL) g_free(converted); return; } _owner->assign_data(converted, bwritten); g_free(converted); _message.set_text(""); } else { _owner->assign_data(data.data(), data.length()); _message.set_text(""); } }
void ObjectSelectionPage::setup_filters() { Db_plugin *plugin= ((WbPluginDbImport*)_form)->db_plugin(); bool empty= true; reset(); _filters.clear(); if (plugin->db_objects_selection_model(Db_plugin::dbotTable)->total_items_count() > 0) { _filters[Db_plugin::dbotTable]= add_filter(plugin->db_objects_struct_name_by_type(Db_plugin::dbotTable), _("Import %s Objects"), plugin->db_objects_selection_model(Db_plugin::dbotTable), plugin->db_objects_exclusion_model(Db_plugin::dbotTable), plugin->db_objects_enabled_flag(Db_plugin::dbotTable)); empty= false; } if (plugin->db_objects_selection_model(Db_plugin::dbotView)->total_items_count() > 0) { _filters[Db_plugin::dbotView]= add_filter(plugin->db_objects_struct_name_by_type(Db_plugin::dbotView), _("Import %s Objects"), plugin->db_objects_selection_model(Db_plugin::dbotView), plugin->db_objects_exclusion_model(Db_plugin::dbotView), plugin->db_objects_enabled_flag(Db_plugin::dbotView)); empty= false; } if (plugin->db_objects_selection_model(Db_plugin::dbotRoutine)->total_items_count() > 0) { _filters[Db_plugin::dbotRoutine]= add_filter(plugin->db_objects_struct_name_by_type(Db_plugin::dbotRoutine), _("Import %s Objects"), plugin->db_objects_selection_model(Db_plugin::dbotRoutine), plugin->db_objects_exclusion_model(Db_plugin::dbotRoutine), plugin->db_objects_enabled_flag(Db_plugin::dbotRoutine)); empty= false; } if (plugin->db_objects_selection_model(Db_plugin::dbotTrigger)->total_items_count() > 0) { _filters[Db_plugin::dbotTrigger]= add_filter(plugin->db_objects_struct_name_by_type(Db_plugin::dbotTrigger), _("Import %s Objects"), plugin->db_objects_selection_model(Db_plugin::dbotTrigger), plugin->db_objects_exclusion_model(Db_plugin::dbotTrigger), plugin->db_objects_enabled_flag(Db_plugin::dbotTrigger)); empty= false; } _empty_label.show(empty); }
void set_text(const std::string &text) { _label.set_text(text); set_size(_label.get_preferred_width(), _label.get_preferred_height()); }