nsresult nsOperaProfileMigrator::SetWString(void* aTransform, nsIPrefBranch* aBranch) { PrefTransform* xform = (PrefTransform*)aTransform; nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1")); NS_ConvertUTF8toUTF16 data(xform->stringValue); pls->SetData(data.get()); return aBranch->SetComplexValue(xform->targetPrefName, NS_GET_IID(nsIPrefLocalizedString), pls); }
nsresult nsNetscapeProfileMigratorBase::SetWString(void* aTransform, nsIPrefBranch* aBranch) { PrefTransform* xform = (PrefTransform*)aTransform; if (xform->prefHasValue) { nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1")); nsAutoString data = NS_ConvertUTF8toUTF16(xform->stringValue); pls->SetData(data.get()); return aBranch->SetComplexValue(xform->targetPrefName ? xform->targetPrefName : xform->sourcePrefName, NS_GET_IID(nsIPrefLocalizedString), pls); } return NS_OK; }
static bool RunMuxing(const std::string& dest_path, const std::string& args) { Gtk::Dialog dlg(BF_("Muxing \"%1%\"") % fs::name_str(dest_path) % bf::stop); SetDialogStrict(dlg, 400, -1); Gtk::TextView& txt_view = NewManaged<Gtk::TextView>(); Execution::Data edat; Gtk::ProgressBar& prg_bar = NewManaged<Gtk::ProgressBar>(); { Gtk::VBox& box = *dlg.get_vbox(); PackStart(box, prg_bar); Gtk::Expander& expdr = PackStart(box, NewManaged<Gtk::Expander>(_("Show/_hide Details"), true)); txt_view.set_editable(false); txt_view.set_size_request(0, 200); expdr.add(PackDetails(txt_view)); dlg.get_action_area()->set_layout(Gtk::BUTTONBOX_CENTER); dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dlg.signal_response().connect(bb::bind(&OnResponse, boost::ref(edat), _1)); dlg.show_all(); } //dlg.run(); ExitData ed; { Execution::Pulse pls(prg_bar); std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop; AppendCommandText(txt_view, cmd); ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid); } if( !ed.IsGood() && !edat.userAbort ) { MessageBox(_("Muxing error"), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, BF_("The reason is \"%1%\" (see Details)") % ExitDescription(ed) % bf::stop); dlg.run(); } return ed.IsGood(); }
void nsSeamonkeyProfileMigrator::WriteFontsBranch(nsIPrefService* aPrefService, nsVoidArray* aPrefs) { nsresult rv; // Enumerate the branch nsCOMPtr<nsIPrefBranch> branch; aPrefService->GetBranch("font.", getter_AddRefs(branch)); PRUint32 count = aPrefs->Count(); for (PRUint32 i = 0; i < count; ++i) { FontPref* pref = (FontPref*)aPrefs->ElementAt(i); switch (pref->type) { case nsIPrefBranch::PREF_STRING: rv = branch->SetCharPref(pref->prefName, pref->stringValue); PL_strfree(pref->stringValue); pref->stringValue = nsnull; break; case nsIPrefBranch::PREF_BOOL: rv = branch->SetBoolPref(pref->prefName, pref->boolValue); break; case nsIPrefBranch::PREF_INT: rv = branch->SetIntPref(pref->prefName, pref->intValue); break; case nsIPrefBranch::PREF_INVALID: nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1")); pls->SetData(pref->wstringValue); rv = branch->SetComplexValue(pref->prefName, NS_GET_IID(nsIPrefLocalizedString), pls); NS_Free(pref->wstringValue); pref->wstringValue = nsnull; break; } NS_Free(pref->prefName); pref->prefName = nsnull; delete pref; pref = nsnull; } aPrefs->Clear(); }
static inline void file_to(file*o,stream s){pls(s,"{%d %d}",o->address.i,o->size_in_bytes.i);}