Commit 8102e79d authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

feature check menu items in the compatibility code (this required me to

Sun Jun  7 14:34:31 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
        check menu items in the compatibility code (this required me to remove
        the "<check>" part from the menu item name, grrr).
parent 50a9ba1f
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
Sun Jun 7 14:34:31 1998 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_menu_entries): feature
check menu items in the compatibility code (this required me to remove
the "<check>" part from the menu item name, grrr).
1998-06-07 Marius Vollmer <mvo@zagadka.ping.de>
* gdk/gdk.h (gdk_color_copy, gdk_color_free): New prototypes.
......
......@@ -162,6 +162,15 @@
#define G_GNUC_CONST
#endif /* !__GNUC__ */
/* Hacker macro to place breakpoints for x86 machines.
* Actuall use is strongly deprecated of course ;)
*/
#if defined (__i386__)
#define G_BREAKPOINT() G_STMT_START{ __asm__ ("int $03"); }G_STMT_END
#else /* !__i386__ */
#define G_BREAKPOINT()
#endif /* __i386__ */
/* Wrap the __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros,
* so we can refer to them as strings unconditionally.
*/
......
......@@ -1028,21 +1028,26 @@ void
gtk_item_factory_create_menu_entries (guint n_entries,
GtkMenuEntry *entries)
{
static GtkPatternSpec pspec = { 42, 0 };
static GtkPatternSpec pspec_separator = { 42, 0 };
static GtkPatternSpec pspec_check = { 42, 0 };
guint i;
if (!n_entries)
return;
g_return_if_fail (entries != NULL);
if (pspec.pattern_length == 0)
gtk_pattern_spec_init (&pspec, "*<separator>*");
if (pspec_separator.pattern_length == 0)
{
gtk_pattern_spec_init (&pspec_separator, "*<separator>*");
gtk_pattern_spec_init (&pspec_check, "*<check>*");
}
for (i = 0; i < n_entries; i++)
{
GtkItemFactory *ifactory;
GtkItemFactoryEntry entry;
gchar *path;
gchar *cpath;
path = entries[i].path;
ifactory = gtk_item_factory_from_path (path);
......@@ -1057,17 +1062,41 @@ gtk_item_factory_create_menu_entries (guint n_entries,
while (*path != '>')
path++;
path++;
cpath = NULL;
entry.path = path;
entry.accelerator = entries[i].accelerator;
entry.callback = entries[i].callback;
entry.callback_action = 0;
entry.item_type = (gtk_pattern_match_string (&pspec, path) ?
(gpointer) key_type_separator_item :
NULL);
if (gtk_pattern_match_string (&pspec_separator, path))
entry.item_type = (gpointer) key_type_separator_item;
else if (!gtk_pattern_match_string (&pspec_check, path))
entry.item_type = NULL;
else
{
gboolean in_brace = FALSE;
gchar *c;
cpath = g_new (gchar, strlen (path));
c = cpath;
while (*path != 0)
{
if (*path == '<')
in_brace = TRUE;
else if (*path == '>')
in_brace = FALSE;
else if (!in_brace)
*(c++) = *path;
path++;
}
*c = 0;
entry.item_type = (gpointer) key_type_toggle_item;
entry.path = cpath;
}
gtk_item_factory_create_item (ifactory, &entry, entries[i].callback_data, 2);
entries[i].widget = gtk_item_factory_get_widget (ifactory, entries[i].path);
g_free (cpath);
}
}
......
......@@ -187,7 +187,7 @@ void gtk_item_factory_popup_with_data(GtkItemFactory *ifactory,
gpointer gtk_item_factory_popup_data (GtkItemFactory *ifactory);
gpointer gtk_item_factory_popup_data_from_widget (GtkWidget *widget);
/* Compatibility functions for ol GtkMenuFactory code
/* Compatibility functions for deprecated GtkMenuFactory code
*/
GtkItemFactory* gtk_item_factory_from_path (const gchar *path);
void gtk_item_factory_create_menu_entries (guint n_entries,
......
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