-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export more internals so muda can be used in combination with ksni
- Loading branch information
Showing
13 changed files
with
132 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use gtk::prelude::*; | ||
|
||
use crate::AboutMetadata; | ||
|
||
/// Displays an about dialog using GTK with the provided metadata. | ||
pub struct AboutDialog { | ||
metadata: AboutMetadata, | ||
} | ||
|
||
impl AboutDialog { | ||
/// Create a new about dialog using `metadata` but without showing it. | ||
pub fn new(metadata: AboutMetadata) -> AboutDialog { | ||
AboutDialog { metadata } | ||
} | ||
|
||
/// Show the about dialog and block until it is closed. | ||
pub fn show(&self) { | ||
let mut builder = gtk::AboutDialog::builder().modal(true).resizable(false); | ||
|
||
if let Some(name) = &self.metadata.name { | ||
builder = builder.program_name(name); | ||
} | ||
if let Some(version) = &self.metadata.full_version() { | ||
builder = builder.version(version); | ||
} | ||
if let Some(authors) = &self.metadata.authors { | ||
builder = builder.authors(authors.clone()); | ||
} | ||
if let Some(comments) = &self.metadata.comments { | ||
builder = builder.comments(comments); | ||
} | ||
if let Some(copyright) = &self.metadata.copyright { | ||
builder = builder.copyright(copyright); | ||
} | ||
if let Some(license) = &self.metadata.license { | ||
builder = builder.license(license); | ||
} | ||
if let Some(website) = &self.metadata.website { | ||
builder = builder.website(website); | ||
} | ||
if let Some(website_label) = &self.metadata.website_label { | ||
builder = builder.website_label(website_label); | ||
} | ||
if let Some(icon) = &self.metadata.icon { | ||
builder = builder.logo(&icon.to_pixbuf()); | ||
} | ||
|
||
let about = builder.build(); | ||
|
||
about.run(); | ||
|
||
unsafe { | ||
about.destroy(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters