move item insertion logic here from gtk_menu_real_insert(),

Fri Dec 19 21:52:46 2003  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
	here from gtk_menu_real_insert(),
	(gtk_menu_real_insert): just call gtk_menu_do_insert(),
	(gtk_menu_reorder_child): run _do_insert after inserting the child
	(unbreaks _reorder_child, reported by Tim Janik).
This commit is contained in:
Kristian Rietveld 2003-12-19 20:56:19 +00:00 committed by Kristian Rietveld
parent f615072cde
commit 8a834dce94
6 changed files with 65 additions and 9 deletions

View File

@ -1,3 +1,11 @@
Fri Dec 19 21:52:46 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
here from gtk_menu_real_insert(),
(gtk_menu_real_insert): just call gtk_menu_do_insert(),
(gtk_menu_reorder_child): run _do_insert after inserting the child
(unbreaks _reorder_child, reported by Tim Janik).
2003-12-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Use

View File

@ -1,3 +1,11 @@
Fri Dec 19 21:52:46 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
here from gtk_menu_real_insert(),
(gtk_menu_real_insert): just call gtk_menu_do_insert(),
(gtk_menu_reorder_child): run _do_insert after inserting the child
(unbreaks _reorder_child, reported by Tim Janik).
2003-12-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Use

View File

@ -1,3 +1,11 @@
Fri Dec 19 21:52:46 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
here from gtk_menu_real_insert(),
(gtk_menu_real_insert): just call gtk_menu_do_insert(),
(gtk_menu_reorder_child): run _do_insert after inserting the child
(unbreaks _reorder_child, reported by Tim Janik).
2003-12-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Use

View File

@ -1,3 +1,11 @@
Fri Dec 19 21:52:46 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
here from gtk_menu_real_insert(),
(gtk_menu_real_insert): just call gtk_menu_do_insert(),
(gtk_menu_reorder_child): run _do_insert after inserting the child
(unbreaks _reorder_child, reported by Tim Janik).
2003-12-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Use

View File

@ -1,3 +1,11 @@
Fri Dec 19 21:52:46 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkmenu.c (gtk_menu_do_insert): move item insertion logic
here from gtk_menu_real_insert(),
(gtk_menu_real_insert): just call gtk_menu_do_insert(),
(gtk_menu_reorder_child): run _do_insert after inserting the child
(unbreaks _reorder_child, reported by Tim Janik).
2003-12-19 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Use

View File

@ -172,6 +172,9 @@ static void gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
static void gtk_menu_select_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
static void gtk_menu_do_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
static void gtk_menu_real_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
@ -964,19 +967,14 @@ gtk_menu_new (void)
}
static void
gtk_menu_real_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position)
gtk_menu_do_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position)
{
gint i;
GList *children;
GtkMenuPrivate *priv;
if (GTK_WIDGET_REALIZED (menu_shell))
gtk_widget_set_parent_window (child, GTK_MENU (menu_shell)->bin_window);
GTK_MENU_SHELL_CLASS (parent_class)->insert (menu_shell, child, position);
priv = gtk_menu_get_private (GTK_MENU (menu_shell));
if (position < 0)
@ -1015,6 +1013,19 @@ gtk_menu_real_insert (GtkMenuShell *menu_shell,
position, position + 1);
}
static void
gtk_menu_real_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position)
{
if (GTK_WIDGET_REALIZED (menu_shell))
gtk_widget_set_parent_window (child, GTK_MENU (menu_shell)->bin_window);
GTK_MENU_SHELL_CLASS (parent_class)->insert (menu_shell, child, position);
gtk_menu_do_insert (menu_shell, child, position);
}
static void
gtk_menu_tearoff_bg_copy (GtkMenu *menu)
{
@ -1772,13 +1783,18 @@ gtk_menu_reorder_child (GtkMenu *menu,
gint position)
{
GtkMenuShell *menu_shell;
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (GTK_IS_MENU_ITEM (child));
menu_shell = GTK_MENU_SHELL (menu);
if (g_list_find (menu_shell->children, child))
{
menu_shell->children = g_list_remove (menu_shell->children, child);
menu_shell->children = g_list_insert (menu_shell->children, child, position);
menu_shell->children = g_list_insert (menu_shell->children, child, position);
gtk_menu_do_insert (menu_shell, child, position);
if (GTK_WIDGET_VISIBLE (menu_shell))
gtk_widget_queue_resize (GTK_WIDGET (menu_shell));
}