Add boolean destroying (gtk_menu_destroy): Set priv->destroying
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkmenu.c Fix bug 136446. (struct _GtkMenuPrivate): Add boolean destroying (gtk_menu_destroy): Set priv->destroying (gtk_menu_remove): don't update the table information when the menu is being destroyed. * gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix * gtk/gtktoolbar.[ch]: Some formatting fixes
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
6dcda29ed1
commit
db6cc5f788
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkmenu.c Fix bug 136446.
|
||||
(struct _GtkMenuPrivate): Add boolean destroying
|
||||
(gtk_menu_destroy): Set priv->destroying
|
||||
(gtk_menu_remove): don't update the table information when the
|
||||
menu is being destroyed.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix
|
||||
|
||||
* gtk/gtktoolbar.[ch]: Some formatting fixes
|
||||
|
||||
Tue Mar 9 01:25:10 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_paint): Fix a typo.
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkmenu.c Fix bug 136446.
|
||||
(struct _GtkMenuPrivate): Add boolean destroying
|
||||
(gtk_menu_destroy): Set priv->destroying
|
||||
(gtk_menu_remove): don't update the table information when the
|
||||
menu is being destroyed.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix
|
||||
|
||||
* gtk/gtktoolbar.[ch]: Some formatting fixes
|
||||
|
||||
Tue Mar 9 01:25:10 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_paint): Fix a typo.
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkmenu.c Fix bug 136446.
|
||||
(struct _GtkMenuPrivate): Add boolean destroying
|
||||
(gtk_menu_destroy): Set priv->destroying
|
||||
(gtk_menu_remove): don't update the table information when the
|
||||
menu is being destroyed.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix
|
||||
|
||||
* gtk/gtktoolbar.[ch]: Some formatting fixes
|
||||
|
||||
Tue Mar 9 01:25:10 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_paint): Fix a typo.
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkmenu.c Fix bug 136446.
|
||||
(struct _GtkMenuPrivate): Add boolean destroying
|
||||
(gtk_menu_destroy): Set priv->destroying
|
||||
(gtk_menu_remove): don't update the table information when the
|
||||
menu is being destroyed.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix
|
||||
|
||||
* gtk/gtktoolbar.[ch]: Some formatting fixes
|
||||
|
||||
Tue Mar 9 01:25:10 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_paint): Fix a typo.
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
Tue Mar 9 02:11:50 2004 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkmenu.c Fix bug 136446.
|
||||
(struct _GtkMenuPrivate): Add boolean destroying
|
||||
(gtk_menu_destroy): Set priv->destroying
|
||||
(gtk_menu_remove): don't update the table information when the
|
||||
menu is being destroyed.
|
||||
|
||||
* gtk/gtkmenu.c (gtk_menu_set_monitor): Formatting fix
|
||||
|
||||
* gtk/gtktoolbar.[ch]: Some formatting fixes
|
||||
|
||||
Tue Mar 9 01:25:10 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkframe.c (gtk_frame_paint): Fix a typo.
|
||||
|
||||
@ -87,6 +87,8 @@ struct _GtkMenuPrivate
|
||||
gint heights_length;
|
||||
|
||||
gint monitor_num;
|
||||
|
||||
gboolean destroying;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@ -767,6 +769,7 @@ gtk_menu_destroy (GtkObject *object)
|
||||
{
|
||||
GtkMenu *menu;
|
||||
GtkMenuAttachData *data;
|
||||
GtkMenuPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (object));
|
||||
|
||||
@ -804,6 +807,10 @@ gtk_menu_destroy (GtkObject *object)
|
||||
if (menu->tearoff_window)
|
||||
gtk_widget_destroy (menu->tearoff_window);
|
||||
|
||||
priv = gtk_menu_get_private (menu);
|
||||
|
||||
priv->destroying = TRUE;
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
@ -982,11 +989,13 @@ gtk_menu_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkMenu *menu;
|
||||
GtkMenuPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (container));
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||
|
||||
menu = GTK_MENU (container);
|
||||
priv = gtk_menu_get_private (menu);
|
||||
|
||||
/* Clear out old_active_menu_item if it matches the item we are removing
|
||||
*/
|
||||
@ -997,6 +1006,7 @@ gtk_menu_remove (GtkContainer *container,
|
||||
}
|
||||
|
||||
GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
|
||||
if (!priv->destroying)
|
||||
gtk_menu_do_remove (GTK_MENU_SHELL (container), widget);
|
||||
g_object_set_data (G_OBJECT (widget), ATTACH_INFO_KEY, NULL);
|
||||
}
|
||||
@ -4090,7 +4100,8 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
void gtk_menu_set_monitor (GtkMenu *menu,
|
||||
void
|
||||
gtk_menu_set_monitor (GtkMenu *menu,
|
||||
gint monitor_num)
|
||||
{
|
||||
GtkMenuPrivate *priv;
|
||||
|
||||
151
gtk/gtktoolbar.c
151
gtk/gtktoolbar.c
@ -2995,32 +2995,6 @@ gtk_toolbar_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
gchar *
|
||||
_gtk_toolbar_elide_underscores (const gchar *original)
|
||||
{
|
||||
gchar *q, *result;
|
||||
const gchar *p;
|
||||
gboolean last_underscore;
|
||||
|
||||
q = result = g_malloc (strlen (original) + 1);
|
||||
last_underscore = FALSE;
|
||||
|
||||
for (p = original; *p; p++)
|
||||
{
|
||||
if (!last_underscore && *p == '_')
|
||||
last_underscore = TRUE;
|
||||
else
|
||||
{
|
||||
last_underscore = FALSE;
|
||||
*q++ = *p;
|
||||
}
|
||||
}
|
||||
|
||||
*q = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deprecated API
|
||||
*/
|
||||
@ -3849,51 +3823,6 @@ calculate_max_homogeneous_pixels (GtkWidget *widget)
|
||||
return PANGO_PIXELS (MAX_HOMOGENEOUS_N_CHARS * char_width);
|
||||
}
|
||||
|
||||
gint
|
||||
_gtk_toolbar_get_default_space_size (void)
|
||||
{
|
||||
return DEFAULT_SPACE_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_toolbar_paint_space_line (GtkWidget *widget,
|
||||
GtkToolbar *toolbar,
|
||||
GdkRectangle *area,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
|
||||
const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
|
||||
|
||||
gint space_size;
|
||||
GtkToolbarSpaceStyle space_style;
|
||||
GtkOrientation orientation;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
space_size = get_space_size (toolbar);
|
||||
space_style = get_space_style (toolbar);
|
||||
orientation = toolbar? toolbar->orientation : GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_paint_vline (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), area, widget,
|
||||
"toolbar",
|
||||
allocation->y + allocation->height * start_fraction,
|
||||
allocation->y + allocation->height * end_fraction,
|
||||
allocation->x + (space_size - widget->style->xthickness) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_paint_hline (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), area, widget,
|
||||
"toolbar",
|
||||
allocation->x + allocation->width * start_fraction,
|
||||
allocation->x + allocation->width * end_fraction,
|
||||
allocation->y + (space_size - widget->style->ythickness) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
toolbar_content_expose (ToolbarContent *content,
|
||||
GtkContainer *container,
|
||||
@ -4596,6 +4525,9 @@ get_shadow_type (GtkToolbar *toolbar)
|
||||
/*
|
||||
* API checks
|
||||
*/
|
||||
#define mixed_api_warning \
|
||||
"mixing deprecated and non-deprecated GtkToolbar API is not allowed"
|
||||
|
||||
static gboolean
|
||||
gtk_toolbar_check_old_api (GtkToolbar *toolbar)
|
||||
{
|
||||
@ -4603,7 +4535,7 @@ gtk_toolbar_check_old_api (GtkToolbar *toolbar)
|
||||
|
||||
if (priv->api_mode == NEW_API)
|
||||
{
|
||||
g_warning ("mixing deprecated and non-deprecated GtkToolbar API is not allowed");
|
||||
g_warning (mixed_api_warning);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -4618,10 +4550,83 @@ gtk_toolbar_check_new_api (GtkToolbar *toolbar)
|
||||
|
||||
if (priv->api_mode == OLD_API)
|
||||
{
|
||||
g_warning ("mixing deprecated and non-deprecated GtkToolbar API is not allowed");
|
||||
g_warning (mixed_api_warning);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->api_mode = NEW_API;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GTK+ internal methods */
|
||||
|
||||
gint
|
||||
_gtk_toolbar_get_default_space_size (void)
|
||||
{
|
||||
return DEFAULT_SPACE_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_toolbar_paint_space_line (GtkWidget *widget,
|
||||
GtkToolbar *toolbar,
|
||||
GdkRectangle *area,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION);
|
||||
const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION);
|
||||
|
||||
gint space_size;
|
||||
GtkToolbarSpaceStyle space_style;
|
||||
GtkOrientation orientation;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
space_size = get_space_size (toolbar);
|
||||
space_style = get_space_style (toolbar);
|
||||
orientation = toolbar? toolbar->orientation : GTK_ORIENTATION_HORIZONTAL;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_paint_vline (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), area, widget,
|
||||
"toolbar",
|
||||
allocation->y + allocation->height * start_fraction,
|
||||
allocation->y + allocation->height * end_fraction,
|
||||
allocation->x + (space_size - widget->style->xthickness) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_paint_hline (widget->style, widget->window,
|
||||
GTK_WIDGET_STATE (widget), area, widget,
|
||||
"toolbar",
|
||||
allocation->x + allocation->width * start_fraction,
|
||||
allocation->x + allocation->width * end_fraction,
|
||||
allocation->y + (space_size - widget->style->ythickness) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
gchar *
|
||||
_gtk_toolbar_elide_underscores (const gchar *original)
|
||||
{
|
||||
gchar *q, *result;
|
||||
const gchar *p;
|
||||
gboolean last_underscore;
|
||||
|
||||
q = result = g_malloc (strlen (original) + 1);
|
||||
last_underscore = FALSE;
|
||||
|
||||
for (p = original; *p; p++)
|
||||
{
|
||||
if (!last_underscore && *p == '_')
|
||||
last_underscore = TRUE;
|
||||
else
|
||||
{
|
||||
last_underscore = FALSE;
|
||||
*q++ = *p;
|
||||
}
|
||||
}
|
||||
|
||||
*q = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -164,7 +164,6 @@ void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar,
|
||||
GtkToolItem *tool_item,
|
||||
gint index);
|
||||
|
||||
|
||||
/* internal functions */
|
||||
gchar * _gtk_toolbar_elide_underscores (const gchar *original);
|
||||
void _gtk_toolbar_paint_space_line (GtkWidget *widget,
|
||||
@ -173,6 +172,9 @@ void _gtk_toolbar_paint_space_line (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
gint _gtk_toolbar_get_default_space_size (void);
|
||||
|
||||
|
||||
|
||||
/* deprecated */
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
void gtk_toolbar_set_icon_size (GtkToolbar *toolbar,
|
||||
GtkIconSize icon_size);
|
||||
|
||||
Reference in New Issue
Block a user