mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Avoid adding // to resource paths
The GResource machinery is not forgiving about this sort of thing. Fixes: #3469
This commit is contained in:
parent
c2727e6e04
commit
aeca9cb7ba
@ -191,19 +191,23 @@ gtk_application_load_resources (GtkApplication *application)
|
|||||||
{
|
{
|
||||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||||
const char *base_path;
|
const char *base_path;
|
||||||
|
const char *optional_slash = "/";
|
||||||
|
|
||||||
base_path = g_application_get_resource_base_path (G_APPLICATION (application));
|
base_path = g_application_get_resource_base_path (G_APPLICATION (application));
|
||||||
|
|
||||||
if (base_path == NULL)
|
if (base_path == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (base_path[strlen (base_path) - 1] == '/')
|
||||||
|
optional_slash = "";
|
||||||
|
|
||||||
/* Expand the icon search path */
|
/* Expand the icon search path */
|
||||||
{
|
{
|
||||||
GtkIconTheme *default_theme;
|
GtkIconTheme *default_theme;
|
||||||
char *iconspath;
|
char *iconspath;
|
||||||
|
|
||||||
default_theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
|
default_theme = gtk_icon_theme_get_for_display (gdk_display_get_default ());
|
||||||
iconspath = g_strconcat (base_path, "/icons/", NULL);
|
iconspath = g_strconcat (base_path, optional_slash, "icons/", NULL);
|
||||||
gtk_icon_theme_add_resource_path (default_theme, iconspath);
|
gtk_icon_theme_add_resource_path (default_theme, iconspath);
|
||||||
g_free (iconspath);
|
g_free (iconspath);
|
||||||
}
|
}
|
||||||
@ -212,7 +216,7 @@ gtk_application_load_resources (GtkApplication *application)
|
|||||||
{
|
{
|
||||||
char *menuspath;
|
char *menuspath;
|
||||||
|
|
||||||
menuspath = g_strconcat (base_path, "/gtk/menus.ui", NULL);
|
menuspath = g_strconcat (base_path, optional_slash, "gtk/menus.ui", NULL);
|
||||||
if (g_resources_get_info (menuspath, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
if (g_resources_get_info (menuspath, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
||||||
priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
||||||
g_free (menuspath);
|
g_free (menuspath);
|
||||||
@ -231,7 +235,7 @@ gtk_application_load_resources (GtkApplication *application)
|
|||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
path = g_strconcat (base_path, "/gtk/help-overlay.ui", NULL);
|
path = g_strconcat (base_path, optional_slash, "gtk/help-overlay.ui", NULL);
|
||||||
if (g_resources_get_info (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
if (g_resources_get_info (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
||||||
{
|
{
|
||||||
const char * const accels[] = { "<Control>question", NULL };
|
const char * const accels[] = { "<Control>question", NULL };
|
||||||
|
Loading…
Reference in New Issue
Block a user