@@ -147,21 +147,27 @@ bool Browser::IsEmojiPanelSupported() {
147147}
148148
149149void Browser::ShowAboutPanel () {
150- std::string app_name, version, copyright, icon_path, website;
151-
152150 GtkAboutDialog* dialog = GTK_ABOUT_DIALOG (gtk_about_dialog_new ());
153151
154- if (about_panel_options_.GetString (" applicationName" , &app_name))
155- gtk_about_dialog_set_program_name (dialog, app_name.c_str ());
156- if (about_panel_options_.GetString (" applicationVersion" , &version))
157- gtk_about_dialog_set_version (dialog, version.c_str ());
158- if (about_panel_options_.GetString (" copyright" , ©right))
159- gtk_about_dialog_set_copyright (dialog, copyright.c_str ());
160- if (about_panel_options_.GetString (" website" , &website))
161- gtk_about_dialog_set_website (dialog, website.c_str ());
162- if (about_panel_options_.GetString (" iconPath" , &icon_path)) {
152+ const auto & opts = about_panel_options_;
153+ const std::string* str;
154+ const base::Value* val;
155+
156+ if ((str = opts.FindStringKey (" applicationName" ))) {
157+ gtk_about_dialog_set_program_name (dialog, str->c_str ());
158+ }
159+ if ((str = opts.FindStringKey (" applicationVersion" ))) {
160+ gtk_about_dialog_set_version (dialog, str->c_str ());
161+ }
162+ if ((str = opts.FindStringKey (" copyright" ))) {
163+ gtk_about_dialog_set_copyright (dialog, str->c_str ());
164+ }
165+ if ((str = opts.FindStringKey (" website" ))) {
166+ gtk_about_dialog_set_website (dialog, str->c_str ());
167+ }
168+ if ((str = opts.FindStringKey (" iconPath" ))) {
163169 GError* error = nullptr ;
164- GdkPixbuf* icon = gdk_pixbuf_new_from_file (icon_path. c_str (), &error);
170+ GdkPixbuf* icon = gdk_pixbuf_new_from_file (str-> c_str (), &error);
165171 if (error != nullptr ) {
166172 g_warning (" %s" , error->message );
167173 g_clear_error (&error);
@@ -171,19 +177,27 @@ void Browser::ShowAboutPanel() {
171177 }
172178 }
173179
180+ if ((val = opts.FindListKey (" authors" ))) {
181+ std::vector<const char *> cstrs;
182+ for (const auto & authorVal : val->GetList ()) {
183+ if (authorVal.is_string ()) {
184+ cstrs.push_back (authorVal.GetString ().c_str ());
185+ }
186+ }
187+ if (cstrs.empty ()) {
188+ LOG (WARNING) << " No author strings found in 'authors' array" ;
189+ } else {
190+ cstrs.push_back (nullptr ); // null-terminated char* array
191+ gtk_about_dialog_set_authors (dialog, cstrs.data ());
192+ }
193+ }
194+
174195 gtk_dialog_run (GTK_DIALOG (dialog));
175196 g_clear_object (&dialog);
176197}
177198
178199void Browser::SetAboutPanelOptions (const base::DictionaryValue& options) {
179- about_panel_options_.Clear ();
180-
181- for (const auto & pair : options) {
182- const std::string& key = pair.first ;
183- const auto & val = pair.second ;
184- if (!key.empty () && val->is_string ())
185- about_panel_options_.SetString (key, val->GetString ());
186- }
200+ about_panel_options_ = options.Clone ();
187201}
188202
189203} // namespace electron
0 commit comments