Menu|Item: Fix FIXME re non-const interned strings
authorDaniel Boles <dboles.src@gmail.com>
Tue, 17 Apr 2018 19:03:07 +0000 (20:03 +0100)
committerDaniel Boles <dboles.src@gmail.com>
Tue, 17 Apr 2018 19:53:48 +0000 (20:53 +0100)
These are members of the private struct, so it hurts no one to fix this.

gtk/gtkmenu.c
gtk/gtkmenuitem.c
gtk/gtkmenuitemprivate.h
gtk/gtkmenuprivate.h

index 57ee7910b28cee0d0bbdfe4109416c5857383bd7..1978f49b44dc44047a3a6f464e07bf0920c61264 100644 (file)
@@ -2388,8 +2388,7 @@ gtk_menu_set_accel_path (GtkMenu     *menu,
   if (accel_path)
     g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */
 
-  /* FIXME: accel_path should be defined as const gchar* */
-  priv->accel_path = (gchar*)g_intern_string (accel_path);
+  priv->accel_path = g_intern_string (accel_path);
   if (priv->accel_path)
     _gtk_menu_refresh_accel_paths (menu, FALSE);
 }
index d827bb276d235a58f8a722ab6ecf48ff4d17a405..06867ab088c9af6a8bd6cd3d83c763593390bf24 100644 (file)
@@ -1693,7 +1693,7 @@ _gtk_menu_item_refresh_accel_path (GtkMenuItem   *menu_item,
           if (postfix)
             {
               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);
             }
         }
@@ -1745,7 +1745,7 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
   widget = GTK_WIDGET (menu_item);
 
   /* 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 */
   gtk_widget_set_accel_path (widget, NULL, NULL);
index 66407f64e9a7dfb97319be372d7ae4536a8da9ae..0008c1f1874739f677bf70bea6da49f2efbfd84d 100644 (file)
@@ -34,7 +34,7 @@ struct _GtkMenuItemPrivate
 
   guint timer;
 
-  gchar  *accel_path;
+  const char *accel_path;
 
   GtkActionHelper *action_helper;
 
index e34f1131f8b3ba39d680dcb173450a32ea2b43d6..3ef3525a885a03ca555c4ab804d64e0c6c4727d1 100644 (file)
@@ -45,7 +45,7 @@ struct _GtkMenuPrivate
   GtkWidget *old_active_menu_item;
 
   GtkAccelGroup *accel_group;
-  gchar         *accel_path;
+  const char    *accel_path;
 
   GtkMenuPositionFunc position_func;
   gpointer            position_func_data;