Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Remove favicon support
Browse files Browse the repository at this point in the history
  • Loading branch information
koyuawsmbrtn committed Apr 29, 2021
1 parent 7877950 commit a477cce
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 52 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ A simple GTK Gopher/Gemini client written in Vala
- Cache
- Works on Linux-based smartphones
- Tries to be as themeable as possible using GTK themes and icon packs
- Favicons

## How to build/install?

Expand All @@ -36,7 +35,6 @@ Note: to build Fossil you need the following dependencies:
- valac - the Vala compiler
- meson - the build system
- cmake - used by meson
- gdk-pixbuf-2.0 - to resize favicons
- python 3.x
- json-glib
- gnutls
Expand Down
3 changes: 0 additions & 3 deletions src/gtk_ui/legacy_widget/tab_head.vala
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ public class Fossil.GtkUi.LegacyWidget.TabHead : Gtk.Box {
private Fossil.GtkUi.LegacyWidget.Tab tab;
private Gtk.Spinner spinner = new Gtk.Spinner();
private Gtk.Image error_icon = new Gtk.Image.from_icon_name("dialog-error", Gtk.IconSize.LARGE_TOOLBAR);
public static Gtk.Image favicon = new Gtk.Image.from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
private int title_chars = 25;

public TabHead(Fossil.GtkUi.LegacyWidget.Tab tab) {
close_button = new Gtk.Button.from_icon_name("window-close-symbolic");
close_button.relief = Gtk.ReliefStyle.NONE;
this.orientation = Gtk.Orientation.HORIZONTAL;
pack_start(spinner);
pack_start(favicon);
pack_start(error_icon);
pack_start(title);
pack_end(close_button);
Expand All @@ -32,7 +30,6 @@ public class Fossil.GtkUi.LegacyWidget.TabHead : Gtk.Box {
spinner.active = state == LOADING;
spinner.visible = state == LOADING;
error_icon.visible = state == ERROR;
favicon.visible = state != ERROR;
if (title.char_count() > title_chars){
if (title == tab.uri){
var startcut = title.index_of_nth_char(title_chars/2);
Expand Down
1 change: 0 additions & 1 deletion src/stores/about.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class Fossil.Store.About : Object, Fossil.Interface.ResourceStore {

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
var substore = substores.get(request.uri);
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
if (substore != null) {
substore.request(request,filepath,upload);
} else {
Expand Down
1 change: 0 additions & 1 deletion src/stores/cache.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class Fossil.Store.Cache : Object, Fossil.Interface.ResourceStore, Fossil
request.finish();
}
request.setResource(resource,"cache");
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
}

//if maxage is 0 assume the age doesn't matter
Expand Down
1 change: 0 additions & 1 deletion src/stores/file.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class Fossil.Store.File : Object, Fossil.Interface.ResourceStore {
}

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
if (upload){
request.setStatus("error/noupload","Uploding not supported");
request.finish();
Expand Down
13 changes: 0 additions & 13 deletions src/stores/finger.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class Fossil.Store.Finger : Object, Fossil.Interface.ResourceStore {
public Fossil.Util.ConnectionHelper connection_helper = new Fossil.Util.ConnectionHelper();

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
if (filepath == null){
request.setStatus("error/internal","Filepath required!");
request.finish();
Expand Down Expand Up @@ -86,18 +85,6 @@ private class Fossil.FingerResourceFetcher : Object {
var message = @"$query\r\n";
conn.output_stream.write (message.data);
print ("[finger] Wrote request\n");

try {
var file_from_http = File.new_for_uri(@"https://$host/favicon.ico");
File local_file = File.new_for_path("/tmp/fossil-favicon.ico");
file_from_http.copy(local_file, FileCopyFlags.OVERWRITE);
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file("/tmp/fossil-favicon.ico");
var pxb = pixbuf.scale_simple(16, 16, Gdk.InterpType.BILINEAR);
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_pixbuf(pxb);
} catch (Error e) {
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
}

// Receive response
var input_stream = new DataInputStream (conn.input_stream);
var helper = new Fossil.Util.ResourceFileWriteHelper(request,resource.filepath,0);
Expand Down
12 changes: 0 additions & 12 deletions src/stores/gemini.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ private class Fossil.GeminiResourceFetcher : Object {

bool beyond_header = false;
Fossil.Util.ResourceFileWriteHelper? helper = null;

try {
var file_from_http = File.new_for_uri(@"https://$host/favicon.ico");
File local_file = File.new_for_path("/tmp/fossil-favicon.ico");
file_from_http.copy(local_file, FileCopyFlags.OVERWRITE);
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file("/tmp/fossil-favicon.ico");
var pxb = pixbuf.scale_simple(16, 16, Gdk.InterpType.BILINEAR);
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_pixbuf(pxb);
} catch (Error e) {
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
}

try{
var statusline = input_stream.read_line(null);
beyond_header = true;
Expand Down
1 change: 0 additions & 1 deletion src/stores/geminiupload.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class Fossil.Store.GeminiUpload : Object, Fossil.Interface.ResourceStore
public Fossil.Util.ConnectionHelper connection_helper = new Fossil.Util.ConnectionHelper();

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
// parse uri
var parsed_uri = new Fossil.Util.ParsedUri(request.uri,false);
if(!(parsed_uri.scheme == "gemini+upload")){
Expand Down
1 change: 0 additions & 1 deletion src/stores/geminiwrite.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class Fossil.Store.GeminiWrite : Object, Fossil.Interface.ResourceStore {
public Fossil.Util.ConnectionHelper connection_helper = new Fossil.Util.ConnectionHelper();

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
// parse uri
var parsed_uri = new Fossil.Util.ParsedUri(request.uri,false);
if(!(parsed_uri.scheme == "gemini+write")){
Expand Down
11 changes: 0 additions & 11 deletions src/stores/gopher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,6 @@ public class Fossil.Gopher.ResourceFetcher : Object {

request.setStatus("loading");

try {
var file_from_http = File.new_for_uri(@"https://$host/favicon.ico");
File local_file = File.new_for_path("/tmp/fossil-favicon.ico");
file_from_http.copy(local_file, FileCopyFlags.OVERWRITE);
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file("/tmp/fossil-favicon.ico");
var pxb = pixbuf.scale_simple(16, 16, Gdk.InterpType.BILINEAR);
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_pixbuf(pxb);
} catch (Error e) {
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
}

try {
//send gopher request
var message = @"$query\r\n";
Expand Down
5 changes: 2 additions & 3 deletions src/stores/gopherwrite.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class Fossil.Store.GopherWrite : Object, Fossil.Interface.ResourceStore {
//gopher+write(t|f)://<server>[:<port>]/<encoded_selector>

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
// parse uri
var parsed_uri = new Fossil.Util.ParsedUri(request.uri,false);
if(!(parsed_uri.scheme == "gopher+writet" || parsed_uri.scheme == "gopher+writef")){
Expand Down Expand Up @@ -206,8 +205,8 @@ public class Fossil.gopherwriteGopher.ResourceUploader : Object {
return true;
} catch (GLib.Error e) {
request.setStatus("error/internal","Error while reading file:\n"+e.message);
print("[gopherwrite][error] Error while reading file:\n"+e.message);
return false;
print("[gopherwrite][error] Error while reading file:\n"+e.message);
return false;
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/stores/internal.vala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
public class Fossil.Store.Internal : Object, Fossil.Interface.ResourceStore {

public void request(Fossil.Request request,string? filepath = null, bool upload = false){
Fossil.GtkUi.LegacyWidget.TabHead.favicon.set_from_icon_name("text-x-generic", Gtk.IconSize.LARGE_TOOLBAR);
if (filepath == null){
request.setStatus("error/internal","Filepath required!");
request.finish();
Expand Down Expand Up @@ -87,8 +86,8 @@ Praesent metus quam, accumsan eget nunc a, pellentesque sodales velit. Aliquam u
resource.add_metadata("text/plain","Hello World");
request.setResource(resource,"fossil");
} else if (request.uri == "fossil://about") {
var helper = new Fossil.Util.ResourceFileWriteHelper(request,filepath,0);
helper.appendString("# About
var helper = new Fossil.Util.ResourceFileWriteHelper(request,filepath,0);
helper.appendString("# About
Fossil version 1.0
A gemini/gopher client originally written by Baschdel as Dragonstone, now forked and maintained by koyu.space under the name Fossil
Expand Down

0 comments on commit a477cce

Please sign in to comment.