Commit 75fff482 authored by Guillaume Laurent's avatar Guillaume Laurent
Browse files

Added warning about callback on <Branch> items

parent b0f8915f
......@@ -1087,6 +1087,10 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
{
GtkAccelGroup *menu_group;
if (entry->callback)
g_warning ("gtk_item_factory_create_item(): Can't specify a callback on a branch: \"%s\"",
entry->path);
menu_group = gtk_accel_group_new ();
if (type_id == quark_type_last_branch)
......@@ -1103,7 +1107,9 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gtk_item_factory_add_item (ifactory,
path, entry->accelerator,
entry->callback, entry->callback_action, callback_data,
(type_id == quark_type_branch ||
type_id == quark_type_last_branch) ? NULL : entry->callback,
entry->callback_action, callback_data,
callback_type,
item_type_path,
widget);
......
......@@ -2245,7 +2245,7 @@ gtk_ifactory_cb (gpointer callback_data,
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
......@@ -2254,17 +2254,17 @@ static GtkItemFactoryEntry menu_items[] =
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_Preferences", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Color/_Red", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Green", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Blue", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/_Shape", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Help", NULL, gtk_ifactory_cb, 0, "<LastBranch>" },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
};
......
......@@ -2245,7 +2245,7 @@ gtk_ifactory_cb (gpointer callback_data,
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
......@@ -2254,17 +2254,17 @@ static GtkItemFactoryEntry menu_items[] =
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_Preferences", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Color/_Red", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Green", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Blue", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/_Shape", NULL, gtk_ifactory_cb, 0, "<Branch>" },
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Help", NULL, gtk_ifactory_cb, 0, "<LastBranch>" },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
};
......
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