Menu|Item: Fix FIXME re non-const interned strings

These are members of the private struct, so it hurts no one to fix this.
This commit is contained in:
Daniel Boles 2018-04-17 20:03:07 +01:00
parent a7a4a459ea
commit 0c46d94ec3
4 changed files with 5 additions and 6 deletions

View File

@ -2763,8 +2763,7 @@ gtk_menu_set_accel_path (GtkMenu *menu,
if (accel_path) if (accel_path)
g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */ g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */
/* FIXME: accel_path should be defined as const gchar* */ priv->accel_path = g_intern_string (accel_path);
priv->accel_path = (gchar*)g_intern_string (accel_path);
if (priv->accel_path) if (priv->accel_path)
_gtk_menu_refresh_accel_paths (menu, FALSE); _gtk_menu_refresh_accel_paths (menu, FALSE);
} }

View File

@ -2345,7 +2345,7 @@ _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
if (postfix) if (postfix)
{ {
new_path = g_strconcat (prefix, "/", postfix, NULL); new_path = g_strconcat (prefix, "/", postfix, NULL);
path = priv->accel_path = (char*)g_intern_string (new_path); path = priv->accel_path = g_intern_string (new_path);
g_free (new_path); g_free (new_path);
} }
} }
@ -2397,7 +2397,7 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
widget = GTK_WIDGET (menu_item); widget = GTK_WIDGET (menu_item);
/* store new path */ /* store new path */
priv->accel_path = (char*)g_intern_string (accel_path); priv->accel_path = g_intern_string (accel_path);
/* forget accelerators associated with old path */ /* forget accelerators associated with old path */
gtk_widget_set_accel_path (widget, NULL, NULL); gtk_widget_set_accel_path (widget, NULL, NULL);

View File

@ -36,7 +36,7 @@ struct _GtkMenuItemPrivate
guint timer; guint timer;
gchar *accel_path; const char *accel_path;
GtkAction *action; GtkAction *action;
GtkActionHelper *action_helper; GtkActionHelper *action_helper;

View File

@ -45,7 +45,7 @@ struct _GtkMenuPrivate
GtkWidget *old_active_menu_item; GtkWidget *old_active_menu_item;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
gchar *accel_path; const char *accel_path;
GtkMenuPositionFunc position_func; GtkMenuPositionFunc position_func;
gpointer position_func_data; gpointer position_func_data;