Skip to content

Commit

Permalink
feat: initial port gtk4
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Sep 25, 2024
2 parents 9f12a62 + bddfb4f commit 389156c
Show file tree
Hide file tree
Showing 12 changed files with 475 additions and 456 deletions.
4 changes: 4 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ button.pathbar {
border-radius: 0;
padding: 0 6px;
}

.combo {
padding: 2.5px 3px;
}
2 changes: 1 addition & 1 deletion src/API/IFileAccess.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Taxi {
*/
public async abstract List<FileInfo> get_file_list ();

public abstract GLib.Uri get_uri ();
public abstract GLib.Uri? get_uri ();

public abstract void goto_dir (GLib.Uri uri);

Expand Down
6 changes: 3 additions & 3 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class Taxi.Taxi : Gtk.Application {
var provider = new Gtk.CssProvider ();
provider.load_from_resource ("com/github/alecaddd/taxi/Application.css");
Gtk.StyleContext.add_provider_for_display (
Gdk.Display.get_default (),
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
Gdk.Display.get_default (),
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();
Expand Down
9 changes: 5 additions & 4 deletions src/Backend/ConnectionSaver.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ namespace Taxi {
}
bookmark.add_application (uri, "taxi", "taxi");
return bookmark.to_file (file_name);
} catch (BookmarkFileError e) {
} catch (Error e) {
message (e.message);
}

return false;
}

Expand All @@ -64,7 +65,7 @@ namespace Taxi {
bookmark.load_from_file (file_name);
bookmark.remove_application (uri, "taxi");
return bookmark.to_file (file_name);
} catch (BookmarkFileError e) {
} catch (Error e) {
message (e.message);
return false;
}
Expand All @@ -82,7 +83,7 @@ namespace Taxi {
foreach (string uri in bookmark.get_uris ()) {
connection_list.append (uri);
}
} catch (BookmarkFileError e) {
} catch (Error e) {
message (e.message);
}
}
Expand All @@ -96,7 +97,7 @@ namespace Taxi {
try {
bookmark.load_from_file (file_name);
return bookmark.has_item (uri);
} catch (BookmarkFileError e) {
} catch (Error e) {
message (e.message);
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/Backend/FileAccess.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ namespace Taxi {
}
}

public virtual GLib.Uri get_uri () {
public virtual GLib.Uri? get_uri () {
var uri = file_handle.get_uri ();
if (!uri.has_suffix ("/")) {
uri += "/";
}
return GLib.Uri.parse (uri, PARSE_RELAXED);

try {
return GLib.Uri.parse (uri, PARSE_RELAXED);
} catch (Error e) {
message (e.message);
}

return null;
}

public virtual void goto_dir (GLib.Uri uri) {
Expand Down
Loading

0 comments on commit 389156c

Please sign in to comment.