Commit f95f2a76 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Decide early if icon name is a file path

parent 8e2f090a
...@@ -887,25 +887,27 @@ girara_set_window_icon(girara_session_t* session, const char* name) ...@@ -887,25 +887,27 @@ girara_set_window_icon(girara_session_t* session, const char* name)
return false; return false;
} }
char* path = girara_fix_path(name);
GtkWindow* window = GTK_WINDOW(session->gtk.window); GtkWindow* window = GTK_WINDOW(session->gtk.window);
char* path = girara_fix_path(name);
bool success = true;
girara_debug("Loading window icon from file: %s", path); if (g_file_test(path, G_FILE_TEST_EXISTS) == TRUE) {
GError* error = NULL; girara_debug("Loading window icon from file: %s", path);
gtk_window_set_icon_from_file(window, path, &error);
g_free(path);
if (error == NULL) {
return true;
}
girara_debug("Failed to load window icon (file): %s", error->message); GError* error = NULL;
g_error_free(error); success = gtk_window_set_icon_from_file(window, path, &error);
girara_debug("Loading window icon with name: %s", name); if (success == false) {
gtk_window_set_icon_name(window, name); girara_debug("Failed to load window icon (file): %s", error->message);
g_error_free(error);
}
} else {
girara_debug("Loading window icon with name: %s", name);
gtk_window_set_icon_name(window, name);
}
return true; g_free(path);
return success;
} }
girara_list_t* girara_list_t*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment