gtk/gtkmenushell.c gtk/gtktable.c gtk/gtktext.c gtk/gtktipsquery.c

2008-02-27  Michael Natterer  <mitch@imendio.com>

	* gtk/gtkmenushell.c
	* gtk/gtktable.c
	* gtk/gtktext.c
	* gtk/gtktipsquery.c
	* gtk/gtktoolbar.c
	* gtk/gtktreeitem.c
	* gtk/gtktreeview.c
	* gtk/gtkviewport.c
	* gtk/gtkwin32embedwidget.c: remove g_return_if_fail() from
	private functions and virtual function implementations.


svn path=/trunk/; revision=19668
This commit is contained in:
Michael Natterer 2008-02-27 11:30:10 +00:00 committed by Michael Natterer
parent f14bf84699
commit 45debfb0ef
10 changed files with 99 additions and 341 deletions

View File

@ -1,3 +1,16 @@
2008-02-27 Michael Natterer <mitch@imendio.com>
* gtk/gtkmenushell.c
* gtk/gtktable.c
* gtk/gtktext.c
* gtk/gtktipsquery.c
* gtk/gtktoolbar.c
* gtk/gtktreeitem.c
* gtk/gtktreeview.c
* gtk/gtkviewport.c
* gtk/gtkwin32embedwidget.c: remove g_return_if_fail() from
private functions and virtual function implementations.
2008-02-27 Richard Hult <richard@imendio.com> 2008-02-27 Richard Hult <richard@imendio.com>
* gdk/quartz/GdkQuartzView.c: * gdk/quartz/GdkQuartzView.c:

View File

@ -506,8 +506,6 @@ gtk_menu_shell_realize (GtkWidget *widget)
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
g_return_if_fail (GTK_IS_MENU_SHELL (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.x = widget->allocation.x; attributes.x = widget->allocation.x;
@ -773,14 +771,9 @@ static gint
gtk_menu_shell_key_press (GtkWidget *widget, gtk_menu_shell_key_press (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)
{ {
GtkMenuShell *menu_shell; GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
gboolean enable_mnemonics; gboolean enable_mnemonics;
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
menu_shell = GTK_MENU_SHELL (widget);
if (!menu_shell->active_menu_item && menu_shell->parent_menu_shell) if (!menu_shell->active_menu_item && menu_shell->parent_menu_shell)
return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event); return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
@ -801,12 +794,7 @@ static gint
gtk_menu_shell_enter_notify (GtkWidget *widget, gtk_menu_shell_enter_notify (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
{ {
GtkMenuShell *menu_shell; GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
menu_shell = GTK_MENU_SHELL (widget);
if (menu_shell->active) if (menu_shell->active)
{ {
@ -873,17 +861,11 @@ static gint
gtk_menu_shell_leave_notify (GtkWidget *widget, gtk_menu_shell_leave_notify (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
{ {
GtkMenuShell *menu_shell;
GtkMenuItem *menu_item;
GtkWidget *event_widget;
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_VISIBLE (widget)) if (GTK_WIDGET_VISIBLE (widget))
{ {
menu_shell = GTK_MENU_SHELL (widget); GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
event_widget = gtk_get_event_widget ((GdkEvent*) event); GtkWidget *event_widget = gtk_get_event_widget ((GdkEvent*) event);
GtkMenuItem *menu_item;
if (!event_widget || !GTK_IS_MENU_ITEM (event_widget)) if (!event_widget || !GTK_IS_MENU_ITEM (event_widget))
return TRUE; return TRUE;
@ -929,14 +911,10 @@ static void
gtk_menu_shell_remove (GtkContainer *container, gtk_menu_shell_remove (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkMenuShell *menu_shell; GtkMenuShell *menu_shell = GTK_MENU_SHELL (container);
gint was_visible; gint was_visible;
g_return_if_fail (GTK_IS_MENU_SHELL (container));
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
was_visible = GTK_WIDGET_VISIBLE (widget); was_visible = GTK_WIDGET_VISIBLE (widget);
menu_shell = GTK_MENU_SHELL (container);
menu_shell->children = g_list_remove (menu_shell->children, widget); menu_shell->children = g_list_remove (menu_shell->children, widget);
if (widget == menu_shell->active_menu_item) if (widget == menu_shell->active_menu_item)
@ -960,15 +938,10 @@ gtk_menu_shell_forall (GtkContainer *container,
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
GtkMenuShell *menu_shell; GtkMenuShell *menu_shell = GTK_MENU_SHELL (container);
GtkWidget *child; GtkWidget *child;
GList *children; GList *children;
g_return_if_fail (GTK_IS_MENU_SHELL (container));
g_return_if_fail (callback != NULL);
menu_shell = GTK_MENU_SHELL (container);
children = menu_shell->children; children = menu_shell->children;
while (children) while (children)
{ {

View File

@ -798,11 +798,7 @@ gtk_table_get_homogeneous (GtkTable *table)
static void static void
gtk_table_finalize (GObject *object) gtk_table_finalize (GObject *object)
{ {
GtkTable *table; GtkTable *table = GTK_TABLE (object);
g_return_if_fail (GTK_IS_TABLE (object));
table = GTK_TABLE (object);
g_free (table->rows); g_free (table->rows);
g_free (table->cols); g_free (table->cols);
@ -814,14 +810,9 @@ static void
gtk_table_size_request (GtkWidget *widget, gtk_table_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkTable *table; GtkTable *table = GTK_TABLE (widget);
gint row, col; gint row, col;
g_return_if_fail (GTK_IS_TABLE (widget));
g_return_if_fail (requisition != NULL);
table = GTK_TABLE (widget);
requisition->width = 0; requisition->width = 0;
requisition->height = 0; requisition->height = 0;
@ -849,13 +840,9 @@ static void
gtk_table_size_allocate (GtkWidget *widget, gtk_table_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkTable *table; GtkTable *table = GTK_TABLE (widget);
g_return_if_fail (GTK_IS_TABLE (widget));
g_return_if_fail (allocation != NULL);
widget->allocation = *allocation; widget->allocation = *allocation;
table = GTK_TABLE (widget);
gtk_table_size_allocate_init (table); gtk_table_size_allocate_init (table);
gtk_table_size_allocate_pass1 (table); gtk_table_size_allocate_pass1 (table);
@ -866,9 +853,6 @@ static void
gtk_table_add (GtkContainer *container, gtk_table_add (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (widget != NULL);
gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1); gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
} }
@ -876,14 +860,10 @@ static void
gtk_table_remove (GtkContainer *container, gtk_table_remove (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkTable *table; GtkTable *table = GTK_TABLE (container);
GtkTableChild *child; GtkTableChild *child;
GList *children; GList *children;
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (widget != NULL);
table = GTK_TABLE (container);
children = table->children; children = table->children;
while (children) while (children)
@ -913,14 +893,10 @@ gtk_table_forall (GtkContainer *container,
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
GtkTable *table; GtkTable *table = GTK_TABLE (container);
GtkTableChild *child; GtkTableChild *child;
GList *children; GList *children;
g_return_if_fail (GTK_IS_TABLE (container));
g_return_if_fail (callback != NULL);
table = GTK_TABLE (container);
children = table->children; children = table->children;
while (children) while (children)

View File

@ -1165,11 +1165,7 @@ gtk_text_get_chars (GtkOldEditable *old_editable,
static void static void
gtk_text_destroy (GtkObject *object) gtk_text_destroy (GtkObject *object)
{ {
GtkText *text; GtkText *text = GTK_TEXT (object);
g_return_if_fail (GTK_IS_TEXT (object));
text = GTK_TEXT (object);
if (text->hadj) if (text->hadj)
{ {
@ -1196,13 +1192,9 @@ gtk_text_destroy (GtkObject *object)
static void static void
gtk_text_finalize (GObject *object) gtk_text_finalize (GObject *object)
{ {
GtkText *text; GtkText *text = GTK_TEXT (object);
GList *tmp_list; GList *tmp_list;
g_return_if_fail (GTK_IS_TEXT (object));
text = GTK_TEXT (object);
/* Clean up the internal structures */ /* Clean up the internal structures */
if (text->use_wchar) if (text->use_wchar)
g_free (text->text.wc); g_free (text->text.wc);
@ -1238,15 +1230,11 @@ gtk_text_finalize (GObject *object)
static void static void
gtk_text_realize (GtkWidget *widget) gtk_text_realize (GtkWidget *widget)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
GtkOldEditable *old_editable; GtkOldEditable *old_editable = GTK_OLD_EDITABLE (widget);
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
g_return_if_fail (GTK_IS_TEXT (widget));
text = GTK_TEXT (widget);
old_editable = GTK_OLD_EDITABLE (widget);
GTK_WIDGET_SET_FLAGS (text, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (text, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD; attributes.window_type = GDK_WINDOW_CHILD;
@ -1360,11 +1348,7 @@ gtk_text_state_changed (GtkWidget *widget,
static void static void
gtk_text_unrealize (GtkWidget *widget) gtk_text_unrealize (GtkWidget *widget)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
g_return_if_fail (GTK_IS_TEXT (widget));
text = GTK_TEXT (widget);
gdk_window_set_user_data (text->text_area, NULL); gdk_window_set_user_data (text->text_area, NULL);
gdk_window_destroy (text->text_area); gdk_window_destroy (text->text_area);
@ -1499,9 +1483,6 @@ gtk_text_size_request (GtkWidget *widget,
gint char_height; gint char_height;
gint char_width; gint char_width;
g_return_if_fail (GTK_IS_TEXT (widget));
g_return_if_fail (requisition != NULL);
xthickness = widget->style->xthickness + TEXT_BORDER_ROOM; xthickness = widget->style->xthickness + TEXT_BORDER_ROOM;
ythickness = widget->style->ythickness + TEXT_BORDER_ROOM; ythickness = widget->style->ythickness + TEXT_BORDER_ROOM;
@ -1523,12 +1504,7 @@ static void
gtk_text_size_allocate (GtkWidget *widget, gtk_text_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
g_return_if_fail (GTK_IS_TEXT (widget));
g_return_if_fail (allocation != NULL);
text = GTK_TEXT (widget);
widget->allocation = *allocation; widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
@ -1553,9 +1529,6 @@ static gint
gtk_text_expose (GtkWidget *widget, gtk_text_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->window == GTK_TEXT (widget)->text_area) if (event->window == GTK_TEXT (widget)->text_area)
{ {
TDEBUG (("in gtk_text_expose (expose)\n")); TDEBUG (("in gtk_text_expose (expose)\n"));
@ -1603,14 +1576,8 @@ static gint
gtk_text_button_press (GtkWidget *widget, gtk_text_button_press (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
GtkOldEditable *old_editable; GtkOldEditable *old_editable = GTK_OLD_EDITABLE (widget);
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
text = GTK_TEXT (widget);
old_editable = GTK_OLD_EDITABLE (widget);
if (text->button && (event->button != text->button)) if (text->button && (event->button != text->button))
return FALSE; return FALSE;
@ -1700,15 +1667,10 @@ static gint
gtk_text_button_release (GtkWidget *widget, gtk_text_button_release (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
GtkOldEditable *old_editable; GtkOldEditable *old_editable;
GdkDisplay *display; GdkDisplay *display;
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
text = GTK_TEXT (widget);
gtk_grab_remove (widget); gtk_grab_remove (widget);
if (text->button != event->button) if (text->button != event->button)
@ -1768,16 +1730,11 @@ static gint
gtk_text_motion_notify (GtkWidget *widget, gtk_text_motion_notify (GtkWidget *widget,
GdkEventMotion *event) GdkEventMotion *event)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
gint x, y; gint x, y;
gint height; gint height;
GdkModifierType mask; GdkModifierType mask;
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
text = GTK_TEXT (widget);
x = event->x; x = event->x;
y = event->y; y = event->y;
mask = event->state; mask = event->state;
@ -1849,12 +1806,10 @@ gtk_text_delete_text (GtkEditable *editable,
gint start_pos, gint start_pos,
gint end_pos) gint end_pos)
{ {
GtkText *text; GtkText *text = GTK_TEXT (editable);
g_return_if_fail (start_pos >= 0); g_return_if_fail (start_pos >= 0);
text = GTK_TEXT (editable);
gtk_text_set_point (text, start_pos); gtk_text_set_point (text, start_pos);
if (end_pos < 0) if (end_pos < 0)
end_pos = TEXT_LENGTH (text); end_pos = TEXT_LENGTH (text);
@ -1867,18 +1822,12 @@ static gint
gtk_text_key_press (GtkWidget *widget, gtk_text_key_press (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)
{ {
GtkText *text; GtkText *text = GTK_TEXT (widget);
GtkOldEditable *old_editable; GtkOldEditable *old_editable = GTK_OLD_EDITABLE (widget);
gchar key; gchar key;
gint return_val; gint return_val;
gint position; gint position;
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
text = GTK_TEXT (widget);
old_editable = GTK_OLD_EDITABLE (widget);
key = event->keyval; key = event->keyval;
return_val = TRUE; return_val = TRUE;

View File

@ -252,11 +252,7 @@ gtk_tips_query_get_arg (GtkObject *object,
static void static void
gtk_tips_query_destroy (GtkObject *object) gtk_tips_query_destroy (GtkObject *object)
{ {
GtkTipsQuery *tips_query; GtkTipsQuery *tips_query = GTK_TIPS_QUERY (object);
g_return_if_fail (GTK_IS_TIPS_QUERY (object));
tips_query = GTK_TIPS_QUERY (object);
if (tips_query->in_query) if (tips_query->in_query)
gtk_tips_query_stop_query (tips_query); gtk_tips_query_stop_query (tips_query);

View File

@ -2475,12 +2475,7 @@ static void
gtk_toolbar_add (GtkContainer *container, gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkToolbar *toolbar; GtkToolbar *toolbar = GTK_TOOLBAR (container);
g_return_if_fail (GTK_IS_TOOLBAR (container));
g_return_if_fail (widget != NULL);
toolbar = GTK_TOOLBAR (container);
if (GTK_IS_TOOL_ITEM (widget)) if (GTK_IS_TOOL_ITEM (widget))
gtk_toolbar_insert (toolbar, GTK_TOOL_ITEM (widget), -1); gtk_toolbar_insert (toolbar, GTK_TOOL_ITEM (widget), -1);
@ -2492,17 +2487,11 @@ static void
gtk_toolbar_remove (GtkContainer *container, gtk_toolbar_remove (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkToolbar *toolbar; GtkToolbar *toolbar = GTK_TOOLBAR (container);
GtkToolbarPrivate *priv; GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
ToolbarContent *content_to_remove; ToolbarContent *content_to_remove;
GList *list; GList *list;
g_return_if_fail (GTK_IS_TOOLBAR (container));
g_return_if_fail (GTK_IS_WIDGET (widget));
toolbar = GTK_TOOLBAR (container);
priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
content_to_remove = NULL; content_to_remove = NULL;
for (list = priv->content; list != NULL; list = list->next) for (list = priv->content; list != NULL; list = list->next)
{ {

View File

@ -221,8 +221,6 @@ gtk_tree_item_init (GtkTreeItem *tree_item)
{ {
GtkWidget *eventbox, *pixmapwid; GtkWidget *eventbox, *pixmapwid;
g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
tree_item->expanded = FALSE; tree_item->expanded = FALSE;
tree_item->subtree = NULL; tree_item->subtree = NULL;
GTK_WIDGET_SET_FLAGS (tree_item, GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS (tree_item, GTK_CAN_FOCUS);
@ -442,8 +440,6 @@ gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item)
static void static void
gtk_tree_item_realize (GtkWidget *widget) gtk_tree_item_realize (GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
if (GTK_WIDGET_CLASS (parent_class)->realize) if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget); (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
@ -457,16 +453,10 @@ static void
gtk_tree_item_size_request (GtkWidget *widget, gtk_tree_item_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (widget);
GtkTreeItem* item; GtkTreeItem *item = GTK_TREE_ITEM (widget);
GtkRequisition child_requisition; GtkRequisition child_requisition;
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
g_return_if_fail (requisition != NULL);
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
requisition->width = (GTK_CONTAINER (widget)->border_width + requisition->width = (GTK_CONTAINER (widget)->border_width +
widget->style->xthickness) * 2; widget->style->xthickness) * 2;
requisition->height = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2;
@ -493,24 +483,18 @@ static void
gtk_tree_item_size_allocate (GtkWidget *widget, gtk_tree_item_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (widget);
GtkTreeItem* item; GtkTreeItem *item = GTK_TREE_ITEM (widget);
GtkAllocation child_allocation; GtkAllocation child_allocation;
gint border_width; gint border_width;
int temp; int temp;
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
g_return_if_fail (allocation != NULL);
widget->allocation = *allocation; widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window, gdk_window_move_resize (widget->window,
allocation->x, allocation->y, allocation->x, allocation->y,
allocation->width, allocation->height); allocation->width, allocation->height);
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
if (bin->child) if (bin->child)
{ {
border_width = (GTK_CONTAINER (widget)->border_width + border_width = (GTK_CONTAINER (widget)->border_width +
@ -612,9 +596,6 @@ gtk_tree_item_paint (GtkWidget *widget,
GdkRectangle child_area, item_area; GdkRectangle child_area, item_area;
GtkTreeItem* tree_item; GtkTreeItem* tree_item;
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
g_return_if_fail (area != NULL);
/* FIXME: We should honor tree->view_mode, here - I think /* FIXME: We should honor tree->view_mode, here - I think
* the desired effect is that when the mode is VIEW_ITEM, * the desired effect is that when the mode is VIEW_ITEM,
* only the subitem is drawn as selected, not the entire * only the subitem is drawn as selected, not the entire
@ -677,10 +658,6 @@ static gint
gtk_tree_item_button_press (GtkWidget *widget, gtk_tree_item_button_press (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == GDK_BUTTON_PRESS if (event->type == GDK_BUTTON_PRESS
&& GTK_WIDGET_IS_SENSITIVE(widget) && GTK_WIDGET_IS_SENSITIVE(widget)
&& !GTK_WIDGET_HAS_FOCUS (widget)) && !GTK_WIDGET_HAS_FOCUS (widget))
@ -726,9 +703,6 @@ gtk_tree_item_expose (GtkWidget *widget,
GdkEventExpose *event; GdkEventExpose *event;
} data; } data;
g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget)) if (GTK_WIDGET_DRAWABLE (widget))
{ {
gtk_tree_item_paint (widget, &event->area); gtk_tree_item_paint (widget, &event->area);
@ -860,17 +834,13 @@ gtk_real_tree_item_collapse (GtkTreeItem *tree_item)
static void static void
gtk_tree_item_destroy (GtkObject *object) gtk_tree_item_destroy (GtkObject *object)
{ {
GtkTreeItem* item; GtkTreeItem* item = GTK_TREE_ITEM(object);
GtkWidget* child; GtkWidget* child;
g_return_if_fail (GTK_IS_TREE_ITEM (object));
#ifdef TREE_DEBUG #ifdef TREE_DEBUG
g_message("+ gtk_tree_item_destroy [object %#x]\n", (int)object); g_message("+ gtk_tree_item_destroy [object %#x]\n", (int)object);
#endif /* TREE_DEBUG */ #endif /* TREE_DEBUG */
item = GTK_TREE_ITEM(object);
/* free sub tree if it exist */ /* free sub tree if it exist */
child = item->subtree; child = item->subtree;
if (child) if (child)
@ -964,13 +934,8 @@ gtk_tree_item_remove_subtree (GtkTreeItem* item)
static void static void
gtk_tree_item_map (GtkWidget *widget) gtk_tree_item_map (GtkWidget *widget)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (widget);
GtkTreeItem* item; GtkTreeItem* item = GTK_TREE_ITEM(widget);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
@ -990,14 +955,10 @@ gtk_tree_item_map (GtkWidget *widget)
static void static void
gtk_tree_item_unmap (GtkWidget *widget) gtk_tree_item_unmap (GtkWidget *widget)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (widget);
GtkTreeItem* item; GtkTreeItem* item = GTK_TREE_ITEM(widget);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
gdk_window_hide (widget->window); gdk_window_hide (widget->window);
@ -1018,14 +979,8 @@ gtk_tree_item_forall (GtkContainer *container,
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (container);
GtkTreeItem *tree_item; GtkTreeItem *tree_item = GTK_TREE_ITEM (container);
g_return_if_fail (GTK_IS_TREE_ITEM (container));
g_return_if_fail (callback != NULL);
bin = GTK_BIN (container);
tree_item = GTK_TREE_ITEM (container);
if (bin->child) if (bin->child)
(* callback) (bin->child, callback_data); (* callback) (bin->child, callback_data);

View File

@ -1732,12 +1732,8 @@ gtk_tree_view_map_buttons (GtkTreeView *tree_view)
static void static void
gtk_tree_view_map (GtkWidget *widget) gtk_tree_view_map (GtkWidget *widget)
{ {
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list; GList *tmp_list;
GtkTreeView *tree_view;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
@ -1763,15 +1759,11 @@ gtk_tree_view_map (GtkWidget *widget)
static void static void
gtk_tree_view_realize (GtkWidget *widget) gtk_tree_view_realize (GtkWidget *widget)
{ {
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list; GList *tmp_list;
GtkTreeView *tree_view;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* Make the main, clipping window */ /* Make the main, clipping window */
@ -1854,15 +1846,10 @@ gtk_tree_view_realize (GtkWidget *widget)
static void static void
gtk_tree_view_unrealize (GtkWidget *widget) gtk_tree_view_unrealize (GtkWidget *widget)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkTreeViewPrivate *priv; GtkTreeViewPrivate *priv = tree_view->priv;
GList *list; GList *list;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
priv = tree_view->priv;
if (priv->scroll_timeout != 0) if (priv->scroll_timeout != 0)
{ {
g_source_remove (priv->scroll_timeout); g_source_remove (priv->scroll_timeout);
@ -2042,13 +2029,9 @@ static void
gtk_tree_view_size_request (GtkWidget *widget, gtk_tree_view_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list; GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
/* we validate GTK_TREE_VIEW_NUM_ROWS_PER_IDLE rows initially just to make /* we validate GTK_TREE_VIEW_NUM_ROWS_PER_IDLE rows initially just to make
* sure we have some size. In practice, with a lot of static lists, this * sure we have some size. In practice, with a lot of static lists, this
* should get a good width. * should get a good width.
@ -2298,20 +2281,16 @@ static void
gtk_tree_view_size_allocate (GtkWidget *widget, gtk_tree_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *tmp_list; GList *tmp_list;
GtkTreeView *tree_view;
gboolean width_changed = FALSE; gboolean width_changed = FALSE;
gint old_width = widget->allocation.width; gint old_width = widget->allocation.width;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
if (allocation->width != widget->allocation.width) if (allocation->width != widget->allocation.width)
width_changed = TRUE; width_changed = TRUE;
widget->allocation = *allocation; widget->allocation = *allocation;
tree_view = GTK_TREE_VIEW (widget);
tmp_list = tree_view->priv->children; tmp_list = tree_view->priv->children;
while (tmp_list) while (tmp_list)
@ -2464,7 +2443,7 @@ static gboolean
gtk_tree_view_button_press (GtkWidget *widget, gtk_tree_view_button_press (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *list; GList *list;
GtkTreeViewColumn *column = NULL; GtkTreeViewColumn *column = NULL;
gint i; gint i;
@ -2475,10 +2454,6 @@ gtk_tree_view_button_press (GtkWidget *widget,
gboolean path_is_selectable; gboolean path_is_selectable;
gboolean rtl; gboolean rtl;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
tree_view = GTK_TREE_VIEW (widget);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_tree_view_stop_editing (tree_view, FALSE); gtk_tree_view_stop_editing (tree_view, FALSE);
gtk_widget_style_get (widget, gtk_widget_style_get (widget,
@ -2959,12 +2934,7 @@ static gboolean
gtk_tree_view_button_release (GtkWidget *widget, gtk_tree_view_button_release (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG)) if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
return gtk_tree_view_button_release_drag_column (widget, event); return gtk_tree_view_button_release_drag_column (widget, event);
@ -3016,12 +2986,7 @@ static gboolean
gtk_tree_view_grab_broken (GtkWidget *widget, gtk_tree_view_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event) GdkEventGrabBroken *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG)) if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
gtk_tree_view_button_release_drag_column (widget, (GdkEventButton *)event); gtk_tree_view_button_release_drag_column (widget, (GdkEventButton *)event);
@ -4174,7 +4139,7 @@ static gboolean
gtk_tree_view_bin_expose (GtkWidget *widget, gtk_tree_view_bin_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkTreePath *path; GtkTreePath *path;
GtkRBTree *tree; GtkRBTree *tree;
GList *list; GList *list;
@ -4211,12 +4176,8 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
gboolean row_ending_details; gboolean row_ending_details;
gboolean draw_vgrid_lines, draw_hgrid_lines; gboolean draw_vgrid_lines, draw_hgrid_lines;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
tree_view = GTK_TREE_VIEW (widget);
gtk_widget_style_get (widget, gtk_widget_style_get (widget,
"horizontal-separator", &horizontal_separator, "horizontal-separator", &horizontal_separator,
"vertical-separator", &vertical_separator, "vertical-separator", &vertical_separator,
@ -4919,11 +4880,7 @@ static gboolean
gtk_tree_view_expose (GtkWidget *widget, gtk_tree_view_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (event->window == tree_view->priv->bin_window) if (event->window == tree_view->priv->bin_window)
{ {
@ -5434,15 +5391,11 @@ static gboolean
gtk_tree_view_enter_notify (GtkWidget *widget, gtk_tree_view_enter_notify (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkRBTree *tree; GtkRBTree *tree;
GtkRBNode *node; GtkRBNode *node;
gint new_y; gint new_y;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
tree_view = GTK_TREE_VIEW (widget);
/* Sanity check it */ /* Sanity check it */
if (event->window != tree_view->priv->bin_window) if (event->window != tree_view->priv->bin_window)
return FALSE; return FALSE;
@ -7465,14 +7418,10 @@ static void
gtk_tree_view_remove (GtkContainer *container, gtk_tree_view_remove (GtkContainer *container,
GtkWidget *widget) GtkWidget *widget)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GtkTreeViewChild *child = NULL; GtkTreeViewChild *child = NULL;
GList *tmp_list; GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (container));
tree_view = GTK_TREE_VIEW (container);
tmp_list = tree_view->priv->children; tmp_list = tree_view->priv->children;
while (tmp_list) while (tmp_list)
{ {
@ -7511,16 +7460,11 @@ gtk_tree_view_forall (GtkContainer *container,
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GtkTreeViewChild *child = NULL; GtkTreeViewChild *child = NULL;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GList *tmp_list; GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (container));
g_return_if_fail (callback != NULL);
tree_view = GTK_TREE_VIEW (container);
tmp_list = tree_view->priv->children; tmp_list = tree_view->priv->children;
while (tmp_list) while (tmp_list)
{ {
@ -7846,15 +7790,9 @@ static gint
gtk_tree_view_focus (GtkWidget *widget, gtk_tree_view_focus (GtkWidget *widget,
GtkDirectionType direction) GtkDirectionType direction)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkContainer *container = GTK_CONTAINER (widget);
GtkWidget *focus_child; GtkWidget *focus_child;
GtkContainer *container;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (GTK_WIDGET_VISIBLE (widget), FALSE);
container = GTK_CONTAINER (widget);
tree_view = GTK_TREE_VIEW (widget);
if (!GTK_WIDGET_IS_SENSITIVE (container)) if (!GTK_WIDGET_IS_SENSITIVE (container))
return FALSE; return FALSE;
@ -7915,14 +7853,10 @@ static void
gtk_tree_view_style_set (GtkWidget *widget, gtk_tree_view_style_set (GtkWidget *widget,
GtkStyle *previous_style) GtkStyle *previous_style)
{ {
GtkTreeView *tree_view; GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *list; GList *list;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
{ {
gdk_window_set_back_pixmap (widget->window, NULL, FALSE); gdk_window_set_back_pixmap (widget->window, NULL, FALSE);

View File

@ -645,14 +645,9 @@ static void
gtk_viewport_paint (GtkWidget *widget, gtk_viewport_paint (GtkWidget *widget,
GdkRectangle *area) GdkRectangle *area)
{ {
GtkViewport *viewport;
g_return_if_fail (GTK_IS_VIEWPORT (widget));
g_return_if_fail (area != NULL);
if (GTK_WIDGET_DRAWABLE (widget)) if (GTK_WIDGET_DRAWABLE (widget))
{ {
viewport = GTK_VIEWPORT (widget); GtkViewport *viewport = GTK_VIEWPORT (widget);
gtk_paint_shadow (widget->style, widget->window, gtk_paint_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, viewport->shadow_type, GTK_STATE_NORMAL, viewport->shadow_type,
@ -691,11 +686,8 @@ static void
gtk_viewport_add (GtkContainer *container, gtk_viewport_add (GtkContainer *container,
GtkWidget *child) GtkWidget *child)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (container);
g_return_if_fail (GTK_IS_WIDGET (child));
bin = GTK_BIN (container);
g_return_if_fail (bin->child == NULL); g_return_if_fail (bin->child == NULL);
gtk_widget_set_parent_window (child, GTK_VIEWPORT (bin)->bin_window); gtk_widget_set_parent_window (child, GTK_VIEWPORT (bin)->bin_window);
@ -707,11 +699,9 @@ static void
gtk_viewport_size_request (GtkWidget *widget, gtk_viewport_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
GtkBin *bin; GtkBin *bin = GTK_BIN (widget);
GtkRequisition child_requisition; GtkRequisition child_requisition;
bin = GTK_BIN (widget);
requisition->width = GTK_CONTAINER (widget)->border_width; requisition->width = GTK_CONTAINER (widget)->border_width;
requisition->height = GTK_CONTAINER (widget)->border_width; requisition->height = GTK_CONTAINER (widget)->border_width;
@ -796,14 +786,8 @@ static void
gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
GtkViewport *viewport; GtkViewport *viewport = GTK_VIEWPORT (data);
GtkBin *bin; GtkBin *bin = GTK_BIN (data);
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
g_return_if_fail (GTK_IS_VIEWPORT (data));
viewport = GTK_VIEWPORT (data);
bin = GTK_BIN (data);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child) && if (bin->child && GTK_WIDGET_VISIBLE (bin->child) &&
GTK_WIDGET_REALIZED (viewport)) GTK_WIDGET_REALIZED (viewport))
@ -829,12 +813,10 @@ static void
gtk_viewport_style_set (GtkWidget *widget, gtk_viewport_style_set (GtkWidget *widget,
GtkStyle *previous_style) GtkStyle *previous_style)
{ {
GtkViewport *viewport;
if (GTK_WIDGET_REALIZED (widget) && if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget)) !GTK_WIDGET_NO_WINDOW (widget))
{ {
viewport = GTK_VIEWPORT (widget); GtkViewport *viewport = GTK_VIEWPORT (widget);
gtk_style_set_background (widget->style, viewport->bin_window, GTK_STATE_NORMAL); gtk_style_set_background (widget->style, viewport->bin_window, GTK_STATE_NORMAL);
gtk_style_set_background (widget->style, widget->window, widget->state); gtk_style_set_background (widget->style, widget->window, widget->state);

View File

@ -128,11 +128,7 @@ _gtk_win32_embed_widget_dialog_procedure (GtkWin32EmbedWidget *embed_widget,
static void static void
gtk_win32_embed_widget_unrealize (GtkWidget *widget) gtk_win32_embed_widget_unrealize (GtkWidget *widget)
{ {
GtkWin32EmbedWidget *embed_widget; GtkWin32EmbedWidget *embed_widget = GTK_WIN32_EMBED_WIDGET (widget);
g_return_if_fail (GTK_IS_WIN32_EMBED_WIDGET (widget));
embed_widget = GTK_WIN32_EMBED_WIDGET (widget);
embed_widget->old_window_procedure = NULL; embed_widget->old_window_procedure = NULL;
@ -176,17 +172,12 @@ gtk_win32_embed_widget_window_process (HWND hwnd, UINT msg, WPARAM wparam, LPARA
static void static void
gtk_win32_embed_widget_realize (GtkWidget *widget) gtk_win32_embed_widget_realize (GtkWidget *widget)
{ {
GtkWindow *window; GtkWindow *window = GTK_WINDOW (widget);
GtkWin32EmbedWidget *embed_widget; GtkWin32EmbedWidget *embed_widget = GTK_WIN32_EMBED_WIDGET (widget);
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
LONG_PTR styles; LONG_PTR styles;
g_return_if_fail (GTK_IS_WIN32_EMBED_WIDGET (widget));
window = GTK_WINDOW (widget);
embed_widget = GTK_WIN32_EMBED_WIDGET (widget);
/* ensure widget tree is properly size allocated */ /* ensure widget tree is properly size allocated */
if (widget->allocation.x == -1 && if (widget->allocation.x == -1 &&
widget->allocation.y == -1 && widget->allocation.y == -1 &&