Skip to content

Commit

Permalink
make values actually optional
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Nov 12, 2018
1 parent 6ef2143 commit 6ec2ed9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
27 changes: 16 additions & 11 deletions atom/browser/browser_linux.cc
Expand Up @@ -143,20 +143,25 @@ bool Browser::IsUnityRunning() {
}

void ShowAboutPanel() {
std::string app_name, version, copyright, icon_path;
std::string app_name, version, copyright, icon_path, credits, website;

about_panel_options_.GetString("applicationName", &app_name);
about_panel_options_.GetString("applicationVersion", &version);
about_panel_options_.GetString("copyright", &copyright);
about_panel_options_.GetString("iconPath", &icon_path);

GdkPixbuf* icon = gdk_pixbuf_new_from_file(icon_path.c_str(), NULL);
GtkWidget* dialog = gtk_about_dialog_new();

gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), app_name.c_str());
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), version.c_str());
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog), copyright.c_str());
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), icon);
if (about_panel_options_.GetString("applicationName", &app_name))
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog),
app_name.c_str());
if (about_panel_options_.GetString("applicationVersion", &version))
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), version.c_str());
if (about_panel_options_.GetString("copyright", &copyright))
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog), copyright.c_str());
if (about_panel_options_.GetString("credits", &credits))
gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), credits.c_str());
if (about_panel_options_.GetString("website", &website))
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), website.c_str());
if (about_panel_options_.GetString("iconPath", &icon_path)) {
GdkPixbuf* icon = gdk_pixbuf_new_from_file(icon_path.c_str(), NULL);
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), icon);
}

g_object_unref(icon), icon = NULL;

Expand Down
5 changes: 2 additions & 3 deletions docs/api/app.md
Expand Up @@ -1075,12 +1075,11 @@ Show the app's about panel options. These options can be overridden with `app.se
* `applicationVersion` String (optional) - The app's version.
* `copyright` String (optional) - Copyright information.
* `credits` String (optional) - Credit information.
* `website` String (optional) - The app's website. _Linux_
* `version` String (optional) - The app's build version number. _macOS_

Set the about panel options. This will override the values defined in the app's
`.plist` file. See the [Apple docs][about-panel-options] for more details.

All except `version` are **required** on Linux.
`.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.

### `app.startAccessingSecurityScopedResource(bookmarkData)` _macOS (mas)_

Expand Down

0 comments on commit 6ec2ed9

Please sign in to comment.