Skip to content

Commit

Permalink
show icon in about dialog also for dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
momentarylapse committed Oct 5, 2024
1 parent 500775e commit fd85573
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Tsunami.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Tsunami::Tsunami() :
perf_mon = nullptr;

set_property("name", AppName);
set_property("version", AppVersion + " \"" + AppNickname + "\"");
set_property("version", AppVersion);
set_property("comment", _("Editor for audio files"));
set_property("website", "http://michi.is-a-geek.org/software");
set_property("copyright", "© 2007-2024 by Michael Ankele");
Expand Down
6 changes: 5 additions & 1 deletion src/lib/hui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ Application::Application(const string &app_name, const string &def_lang, Flags _
else if (os::fs::exists(directory_static | "icon.ico"))
set_property("logo", str(directory_static | "icon.ico"));


// default "icon" used for windows (just name)
set_property("icon", app_name);
}
Expand Down Expand Up @@ -238,6 +237,11 @@ static std::function<void()> _run_after_gui_init_func_;
static void on_gtk_application_activate(GApplication *_g_app, gpointer user_data) {
auto app = reinterpret_cast<Application*>(user_data);
_init_global_css_classes_();

// add local icon theme
auto icon_theme = gtk_icon_theme_get_for_display(gdk_display_get_default());
gtk_icon_theme_add_search_path(icon_theme, str(Application::directory_static | "icons").c_str());

if (_run_after_gui_init_func_)
_run_after_gui_init_func_();
else
Expand Down
5 changes: 3 additions & 2 deletions src/lib/hui/WindowGtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ void Window::_init_(const string &title, int width, int height, Window *_parent,
// icon
#if GTK_CHECK_VERSION(4,0,0)

auto icon_theme = gtk_icon_theme_get_for_display(gtk_widget_get_display(window));
gtk_icon_theme_add_search_path(icon_theme, str(Application::directory_static | "icons").c_str());
auto icon_theme = gtk_icon_theme_get_for_display(gdk_display_get_default());

string icon = Application::get_property("icon");
//msg_write(gtk_icon_theme_has_icon(icon_theme, icon.c_str()));
gtk_window_set_default_icon_name("tsunami");
gtk_window_set_icon_name(GTK_WINDOW(window), icon.c_str());
#else
string logo = Application::get_property("logo");
Expand Down
19 changes: 17 additions & 2 deletions src/lib/hui/common_dlg_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,23 @@ void about_box(Window *win) {
gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dlg), Application::get_property("license").c_str());
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dlg), Application::get_property("website").c_str());
#if GTK_CHECK_VERSION(4,0,0)
auto *_logo = gdk_texture_new_from_file(g_file_new_for_path(Application::get_property("logo").c_str()), &error);
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dlg), GDK_PAINTABLE(_logo));

auto icon_theme = gtk_icon_theme_get_for_display(gdk_display_get_default());
auto icon = gtk_icon_theme_lookup_icon(icon_theme,
"tsunami", // icon name
nullptr,
128, // icon size
1, // scale
GTK_TEXT_DIR_NONE,
GTK_ICON_LOOKUP_FORCE_REGULAR); // flags);

gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dlg), GDK_PAINTABLE(icon));

//msg_write("ABOUT..." + Application::get_property("logo"));
/*auto *_logo = gdk_texture_new_from_file(g_file_new_for_path(Application::get_property("logo").c_str()), &error);
if (error)
msg_error(error->message);
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dlg), GDK_PAINTABLE(_logo));*/


/*auto icon_theme = gtk_icon_theme_get_for_display(gtk_widget_get_display(dlg));
Expand Down

0 comments on commit fd85573

Please sign in to comment.