Skip to content

Commit

Permalink
Make clippy happy,Tag v1.0.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
ranfdev committed Jan 4, 2021
1 parent 7faf967 commit a007eb4
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geopard"
version = "0.1.0"
version = "1.0.0-alpha"
authors = ["ranfdev <[email protected]>"]
edition = "2018"

Expand Down
7 changes: 6 additions & 1 deletion README.gemini
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ Under the hood, it uses gtk3 and rust. Everything related to IO is asynchronous.
To do that, it makes use of rust async/await capabilities and the async-std crate.

# How to change settings
You should find the configuration file in ~/.config/geopard/config.toml
You should find the configuration files in ~/.config/geopard/
If you use flatpak, they are in ~/.var/app/com.ranfdev.Geopard/config/geopard/

## How to build
### With Flatpak
If you have gnome-builder installed, use it to the open the folder of the source
code and hit the run button.

### Build with Nix
If you have the
=> https://nixos.org/ nix
Expand Down
4 changes: 4 additions & 0 deletions data/com.ranfdev.Geopard.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<url type="bugtracker">https://github.com/ranfdev/Geopard/issues/</url>
<content_rating type="oars-1.0" />
<releases>
<release version="1.0.0-alpha" date="2021-04-01">
This is the first working flatpak release. Some features (colors, caching)
are missing.
</release>
<release version="0.1.0" date="2020-07-10" />
</releases>
<kudos>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('geopard',
'rust',
version: '0.0.1',
version: '1.0.0',
license: 'MIT',
meson_version: '>= 0.50')

Expand Down
2 changes: 1 addition & 1 deletion nix/geopard.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

rustPlatform.buildRustPackage rec {
pname = "geopard";
version = "0.1.0";
version = "1.0.0-alpha";

src = lib.cleanSource ../.;
cargoSha256 = "0b77w95bj6avnxgs5ia93hhq3jr9cmbpa5zw8i37s688633il15x";
Expand Down
20 changes: 10 additions & 10 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl DrawCtx {
.fonts
.heading
.as_ref()
.or(default_config.fonts.heading.as_ref())
.or_else(|| default_config.fonts.heading.as_ref())
.unwrap()
});
tag_h1.set_property_size_points(tag_h1.get_property_size_points() * 1.4);
Expand All @@ -156,7 +156,7 @@ impl DrawCtx {
.fonts
.heading
.as_ref()
.or(default_config.fonts.heading.as_ref())
.or_else(|| default_config.fonts.heading.as_ref())
.unwrap()
});
tag_h1.set_property_size_points(tag_h1.get_property_size_points() * 1.2);
Expand All @@ -167,7 +167,7 @@ impl DrawCtx {
.fonts
.heading
.as_ref()
.or(default_config.fonts.heading.as_ref())
.or_else(|| default_config.fonts.heading.as_ref())
.unwrap(),
);
let tag_pre = DrawCtx::create_tag(
Expand All @@ -176,7 +176,7 @@ impl DrawCtx {
.fonts
.preformatted
.as_ref()
.or(default_config.fonts.preformatted.as_ref())
.or_else(|| default_config.fonts.preformatted.as_ref())
.unwrap(),
);
let tag_p = DrawCtx::create_tag(
Expand All @@ -185,7 +185,7 @@ impl DrawCtx {
.fonts
.paragraph
.as_ref()
.or(default_config.fonts.paragraph.as_ref())
.or_else(|| default_config.fonts.paragraph.as_ref())
.unwrap(),
);
let tag_q = DrawCtx::create_tag(
Expand All @@ -194,7 +194,7 @@ impl DrawCtx {
.fonts
.quote
.as_ref()
.or(default_config.fonts.quote.as_ref())
.or_else(|| default_config.fonts.quote.as_ref())
.unwrap(),
);
tag_q.set_property_style(pango::Style::Italic);
Expand All @@ -205,7 +205,7 @@ impl DrawCtx {
.fonts
.quote
.as_ref()
.or(default_config.fonts.paragraph.as_ref())
.or_else(|| default_config.fonts.paragraph.as_ref())
.unwrap(),
);

Expand Down Expand Up @@ -235,7 +235,7 @@ impl DrawCtx {
let tag_name = match n {
1 => "h1",
2 => "h2",
3 | _ => "h3",
_ => "h3",
};

let start = text_iter.get_offset();
Expand Down Expand Up @@ -291,7 +291,7 @@ impl DrawCtx {
.fonts
.paragraph
.as_ref()
.or(default_config.fonts.paragraph.as_ref())
.or_else(|| default_config.fonts.paragraph.as_ref())
.unwrap();

let tag = gtk::TextTagBuilder::new()
Expand All @@ -305,7 +305,7 @@ impl DrawCtx {

Self::set_linkhandler(&tag, link.clone());

let label = label.unwrap_or(link.url());
let label = label.unwrap_or_else(|| link.url());
info!("Setted url {:?} to tag", Self::get_linkhandler(&tag));
debug!("Link set successfully");
self.insert_paragraph(&mut text_iter, &label);
Expand Down
6 changes: 3 additions & 3 deletions src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ impl<T: glib::IsA<gtk::Widget>, M> Component<T, M> {
}
}
pub fn id(&self) -> usize {
return self.id;
self.id
}
pub fn widget(&self) -> &T {
return &self.widget;
&self.widget
}
pub fn chan(&self) -> flume::Sender<M> {
return self.chan.clone();
self.chan.clone()
}
}
4 changes: 2 additions & 2 deletions src/gemini/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ impl Parser {
PageElement::Empty
} else if self.inside_pre {
PageElement::Preformatted(line.to_string())
} else if line.starts_with("#") {
} else if line.starts_with('#') {
PageElement::Heading(line.to_string())
} else if line.starts_with(">") {
} else if line.starts_with('>') {
PageElement::Quote(line.to_string())
} else if let Some(captures) = R_GEMINI_LINK.captures(&line) {
match (captures.name("href"), captures.name("label")) {
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ fn main() {
let app_clone = application.clone();
let windows = Rc::new(RefCell::new(vec![]));

let windows_clone = windows.clone();
application.connect_activate(move |_| {
let window = window::Window::new(&app_clone, config.clone());
window.widget().show_all();
window.widget().present();
windows_clone.borrow_mut().push(window);
windows.borrow_mut().push(window);
});

let ret = application.run(&std::env::args().collect::<Vec<String>>());
Expand Down
12 changes: 5 additions & 7 deletions src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Tab {

let (in_chan_tx, in_chan_rx) = flume::unbounded();

let draw_ctx = DrawCtx::new(text_view.clone(), config.clone());
let draw_ctx = DrawCtx::new(text_view.clone(), config);
let gemini_client = gemini::ClientBuilder::new().redirect(true).build();
let links = HashMap::new();
let req_handle = None;
Expand All @@ -67,7 +67,7 @@ impl Tab {
scroll_win.set_vexpand(true);
scroll_win.add(&text_view);

let this = Self {
Self {
draw_ctx,
gemini_client,
req_handle,
Expand All @@ -79,9 +79,7 @@ impl Tab {
scroll_win,
load_progress: 0.0,
id: new_component_id(),
};

this
}
}
pub fn build_request_ctx(&self, url: Url) -> RequestCtx {
RequestCtx {
Expand Down Expand Up @@ -312,7 +310,7 @@ impl Tab {

for tag in iter.get_tags() {
if let Some(url) = DrawCtx::get_linkhandler(&tag) {
return Ok(url.clone());
return Ok(url);
}
}

Expand Down Expand Up @@ -472,7 +470,7 @@ impl Tab {
continue;
}
Err(e) => {
Err(e)?;
return Err(e.into())
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Window {
this.bind_signals();
this.add_tab();

let receiver: flume::Receiver<WindowMsg> = receiver.clone();
let receiver: flume::Receiver<WindowMsg> = receiver;
let handle = glibctx()
.spawn_local_with_handle(async move {
while let Ok(msg) = receiver.recv_async().await {
Expand All @@ -111,7 +111,7 @@ impl Window {
})
.unwrap();

Component::new(new_component_id(), window, sender.clone(), handle)
Component::new(new_component_id(), window, sender, handle)
}

fn gen_tab_label(&self, id: usize, url: Url) -> gtk::Box {
Expand Down Expand Up @@ -142,7 +142,7 @@ impl Window {
fn add_tab(&mut self) -> flume::Sender<TabMsg> {
let tab = Tab::new(self.config.clone(), self.sender.clone());
let handler = tab.run();
let sender = handler.chan().clone();
let sender = handler.chan();
let widget = handler.widget().clone();
self.tabs.push(handler);

Expand Down

0 comments on commit a007eb4

Please sign in to comment.