feat: torrent scheme deep link and file associations (#866)

This commit is contained in:
Levi authored and GitHub committed 2025-01-16 00:02:00 +08:00
1 parent ccb3267fba
commit acc7ed8f6b
30 files changed
+464 -79

No files matched your search

@@ -11,4 +11,5 @@ Exec=gopeed
Icon=com.gopeed.Gopeed
Type=Application
Categories=Utility;Internet
Keywords=Bittorrent;Downloader;
Keywords=Bittorrent;Downloader;
MimeType=x-scheme-handler/gopeed;x-scheme-handler/magnet;application/x-bittorrent;
+9 -2
View File
@@ -17,6 +17,13 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GList* windows = gtk_application_get_windows(GTK_APPLICATION(application));
if (windows) {
gtk_window_present(GTK_WINDOW(windows->data));
return;
}
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
@@ -79,7 +86,7 @@ static gboolean my_application_local_command_line(GApplication* application, gch
g_application_activate(application);
*exit_status = 0;
return TRUE;
return FALSE;
}
// Implements GObject::dispose.
@@ -100,6 +107,6 @@ static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
"flags", G_APPLICATION_HANDLES_COMMAND_LINE | G_APPLICATION_HANDLES_OPEN,
nullptr));
}
@@ -14,4 +14,9 @@ categories:
- Network
- Utility
supported_mime_type:
- x-scheme-handler/gopeed
- x-scheme-handler/magnet
- application/x-bittorrent
startup_notify: true
@@ -28,4 +28,9 @@ categories:
- Network
- Utility
supported_mime_type:
- x-scheme-handler/gopeed
- x-scheme-handler/magnet
- application/x-bittorrent
startup_notify: true