Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move icon setup to startup phase using gtk_window_set_default_icon_from_file

Prateek Sunalb06fea450c5a
diff --git a/mobile/apps/auth/linux/my_application.cc b/mobile/apps/auth/linux/my_application.cc
index ce0d32b535..fd98eff85b 100644
--- a/mobile/apps/auth/linux/my_application.cc
+++ b/mobile/apps/auth/linux/my_application.cc
@@ -83,23 +83,6 @@ static void my_application_activate(GApplication *application)
}
gtk_window_set_default_size(window, 1280, 720);
-
- // Set window icon for when running without .desktop file
- // Try loading from bundled assets first
- gchar *exe_path = g_file_read_link("/proc/self/exe", nullptr);
- if (exe_path != nullptr) {
- gchar *exe_dir = g_path_get_dirname(exe_path);
- gchar *icon_path = g_build_filename(exe_dir, "data", "flutter_assets", "assets", "icons", "auth-icon.png", nullptr);
- GdkPixbuf *icon = gdk_pixbuf_new_from_file(icon_path, nullptr);
- if (icon != nullptr) {
- gtk_window_set_icon(window, icon);
- g_object_unref(icon);
- }
- g_free(icon_path);
- g_free(exe_dir);
- g_free(exe_path);
- }
-
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
@@ -139,11 +122,18 @@ static gboolean my_application_local_command_line(GApplication *application, gch
// Implements GApplication::startup.
static void my_application_startup(GApplication *application)
{
- // MyApplication* self = MY_APPLICATION(object);
-
- // Perform any actions required at application startup.
-
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
+
+ // Set default window icon from bundled assets
+ gchar *exe_path = g_file_read_link("/proc/self/exe", nullptr);
+ if (exe_path != nullptr) {
+ gchar *exe_dir = g_path_get_dirname(exe_path);
+ gchar *icon_path = g_build_filename(exe_dir, "data", "flutter_assets", "assets", "icons", "auth-icon.png", nullptr);
+ gtk_window_set_default_icon_from_file(icon_path, nullptr);
+ g_free(icon_path);
+ g_free(exe_dir);
+ g_free(exe_path);
+ }
}
// Implements GApplication::shutdown.