Commit e7355f82 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

gtk/gtkcontainer.c gtk/gtkexpander.c gtk/gtkframe.c gtk/gtklabel.c

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

	* gtk/gtkcontainer.c
	* gtk/gtkexpander.c
	* gtk/gtkframe.c
	* gtk/gtklabel.c
	* gtk/gtkmain.c
	* gtk/gtkmenu.c
	* gtk/gtkmenuitem.c
	* gtk/gtkmenushell.c
	* gtk/gtknotebook.c
	* gtk/gtkseparatortoolitem.c
	* gtk/gtksocket.c
	* gtk/gtktextlayout.c
	* gtk/gtktoggletoolbutton.c
	* gtk/gtktoolbutton.c
	* gtk/gtktoolitem.c
	* gtk/gtktree.c
	* gtk/gtktreeitem.c: replace "foo && GTK_IS_FOO (foo)" by simply
	"GTK_IS_FOO (foo)".


svn path=/trunk/; revision=19481
parent 0f1958e3
2008-02-06 Michael Natterer <mitch@imendio.com>
* gtk/gtkcontainer.c
* gtk/gtkexpander.c
* gtk/gtkframe.c
* gtk/gtklabel.c
* gtk/gtkmain.c
* gtk/gtkmenu.c
* gtk/gtkmenuitem.c
* gtk/gtkmenushell.c
* gtk/gtknotebook.c
* gtk/gtkseparatortoolitem.c
* gtk/gtksocket.c
* gtk/gtktextlayout.c
* gtk/gtktoggletoolbutton.c
* gtk/gtktoolbutton.c
* gtk/gtktoolitem.c
* gtk/gtktree.c
* gtk/gtktreeitem.c: replace "foo && GTK_IS_FOO (foo)" by simply
"GTK_IS_FOO (foo)".
2008-02-05 Matthias Clasen <mclasen@redhat.com> 2008-02-05 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprintsettings.c (gtk_print_settings_get_page_ranges): * gtk/gtkprintsettings.c (gtk_print_settings_get_page_ranges):
......
...@@ -1868,7 +1868,7 @@ old_focus_coords (GtkContainer *container, ...@@ -1868,7 +1868,7 @@ old_focus_coords (GtkContainer *container,
GtkWidget *widget = GTK_WIDGET (container); GtkWidget *widget = GTK_WIDGET (container);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (toplevel) && GTK_WINDOW (toplevel)->focus_widget) if (GTK_IS_WINDOW (toplevel) && GTK_WINDOW (toplevel)->focus_widget)
{ {
GtkWidget *old_focus = GTK_WINDOW (toplevel)->focus_widget; GtkWidget *old_focus = GTK_WINDOW (toplevel)->focus_widget;
......
...@@ -1552,7 +1552,7 @@ gtk_expander_get_label (GtkExpander *expander) ...@@ -1552,7 +1552,7 @@ gtk_expander_get_label (GtkExpander *expander)
priv = expander->priv; priv = expander->priv;
if (priv->label_widget && GTK_IS_LABEL (priv->label_widget)) if (GTK_IS_LABEL (priv->label_widget))
return gtk_label_get_text (GTK_LABEL (priv->label_widget)); return gtk_label_get_text (GTK_LABEL (priv->label_widget));
else else
return NULL; return NULL;
...@@ -1584,7 +1584,7 @@ gtk_expander_set_use_underline (GtkExpander *expander, ...@@ -1584,7 +1584,7 @@ gtk_expander_set_use_underline (GtkExpander *expander,
{ {
priv->use_underline = use_underline; priv->use_underline = use_underline;
if (priv->label_widget && GTK_IS_LABEL (priv->label_widget)) if (GTK_IS_LABEL (priv->label_widget))
gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), use_underline); gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), use_underline);
g_object_notify (G_OBJECT (expander), "use-underline"); g_object_notify (G_OBJECT (expander), "use-underline");
...@@ -1638,7 +1638,7 @@ gtk_expander_set_use_markup (GtkExpander *expander, ...@@ -1638,7 +1638,7 @@ gtk_expander_set_use_markup (GtkExpander *expander,
{ {
priv->use_markup = use_markup; priv->use_markup = use_markup;
if (priv->label_widget && GTK_IS_LABEL (priv->label_widget)) if (GTK_IS_LABEL (priv->label_widget))
gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup); gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup);
g_object_notify (G_OBJECT (expander), "use-markup"); g_object_notify (G_OBJECT (expander), "use-markup");
......
...@@ -349,7 +349,7 @@ gtk_frame_get_label (GtkFrame *frame) ...@@ -349,7 +349,7 @@ gtk_frame_get_label (GtkFrame *frame)
{ {
g_return_val_if_fail (GTK_IS_FRAME (frame), NULL); g_return_val_if_fail (GTK_IS_FRAME (frame), NULL);
if (frame->label_widget && GTK_IS_LABEL (frame->label_widget)) if (GTK_IS_LABEL (frame->label_widget))
return gtk_label_get_text (GTK_LABEL (frame->label_widget)); return gtk_label_get_text (GTK_LABEL (frame->label_widget));
else else
return NULL; return NULL;
......
...@@ -882,15 +882,15 @@ gtk_label_mnemonic_activate (GtkWidget *widget, ...@@ -882,15 +882,15 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
*/ */
parent = widget->parent; parent = widget->parent;
if (parent && GTK_IS_NOTEBOOK (parent)) if (GTK_IS_NOTEBOOK (parent))
return FALSE; return FALSE;
while (parent) while (parent)
{ {
if (GTK_WIDGET_CAN_FOCUS (parent) || if (GTK_WIDGET_CAN_FOCUS (parent) ||
(!group_cycling && GTK_WIDGET_GET_CLASS (parent)->activate_signal) || (!group_cycling && GTK_WIDGET_GET_CLASS (parent)->activate_signal) ||
(parent->parent && GTK_IS_NOTEBOOK (parent->parent)) || GTK_IS_NOTEBOOK (parent->parent) ||
(GTK_IS_MENU_ITEM (parent))) GTK_IS_MENU_ITEM (parent))
return gtk_widget_mnemonic_activate (parent, group_cycling); return gtk_widget_mnemonic_activate (parent, group_cycling);
parent = parent->parent; parent = parent->parent;
} }
...@@ -949,7 +949,7 @@ gtk_label_setup_mnemonic (GtkLabel *label, ...@@ -949,7 +949,7 @@ gtk_label_setup_mnemonic (GtkLabel *label,
mnemonic_menu = menu_shell; mnemonic_menu = menu_shell;
} }
if (!(menu_shell && GTK_IS_MENU (menu_shell))) if (!GTK_IS_MENU (menu_shell))
{ {
gtk_window_add_mnemonic (GTK_WINDOW (toplevel), gtk_window_add_mnemonic (GTK_WINDOW (toplevel),
label->mnemonic_keyval, label->mnemonic_keyval,
......
...@@ -1636,7 +1636,7 @@ gtk_main_get_window_group (GtkWidget *widget) ...@@ -1636,7 +1636,7 @@ gtk_main_get_window_group (GtkWidget *widget)
if (widget) if (widget)
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (toplevel)) if (GTK_IS_WINDOW (toplevel))
return gtk_window_get_group (GTK_WINDOW (toplevel)); return gtk_window_get_group (GTK_WINDOW (toplevel));
else else
return gtk_window_get_group (NULL); return gtk_window_get_group (NULL);
...@@ -2293,7 +2293,7 @@ gtk_propagate_event (GtkWidget *widget, ...@@ -2293,7 +2293,7 @@ gtk_propagate_event (GtkWidget *widget,
GtkWidget *window; GtkWidget *window;
window = gtk_widget_get_toplevel (widget); window = gtk_widget_get_toplevel (widget);
if (window && GTK_IS_WINDOW (window)) if (GTK_IS_WINDOW (window))
{ {
/* If there is a grab within the window, give the grab widget /* If there is a grab within the window, give the grab widget
* a first crack at the key event * a first crack at the key event
...@@ -2304,7 +2304,7 @@ gtk_propagate_event (GtkWidget *widget, ...@@ -2304,7 +2304,7 @@ gtk_propagate_event (GtkWidget *widget,
if (!handled_event) if (!handled_event)
{ {
window = gtk_widget_get_toplevel (widget); window = gtk_widget_get_toplevel (widget);
if (window && GTK_IS_WINDOW (window)) if (GTK_IS_WINDOW (window))
{ {
if (GTK_WIDGET_IS_SENSITIVE (window)) if (GTK_WIDGET_IS_SENSITIVE (window))
gtk_widget_event (window, event); gtk_widget_event (window, event);
......
...@@ -1393,7 +1393,7 @@ gtk_menu_popup (GtkMenu *menu, ...@@ -1393,7 +1393,7 @@ gtk_menu_popup (GtkMenu *menu,
} }
/* Set transient for to get the right window group and parent relationship */ /* Set transient for to get the right window group and parent relationship */
if (parent_toplevel && GTK_IS_WINDOW (parent_toplevel)) if (GTK_IS_WINDOW (parent_toplevel))
gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel),
GTK_WINDOW (parent_toplevel)); GTK_WINDOW (parent_toplevel));
......
...@@ -1618,7 +1618,7 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item, ...@@ -1618,7 +1618,7 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
gtk_widget_set_accel_path (widget, NULL, NULL); gtk_widget_set_accel_path (widget, NULL, NULL);
/* install accelerators associated with new path */ /* install accelerators associated with new path */
if (widget->parent && GTK_IS_MENU (widget->parent)) if (GTK_IS_MENU (widget->parent))
{ {
GtkMenu *menu = GTK_MENU (widget->parent); GtkMenu *menu = GTK_MENU (widget->parent);
......
...@@ -1016,7 +1016,7 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell, ...@@ -1016,7 +1016,7 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
g_return_val_if_fail (child != NULL, FALSE); g_return_val_if_fail (child != NULL, FALSE);
parent = child->parent; parent = child->parent;
while (parent && GTK_IS_MENU_SHELL (parent)) while (GTK_IS_MENU_SHELL (parent))
{ {
if (parent == (GtkWidget*) menu_shell) if (parent == (GtkWidget*) menu_shell)
return TRUE; return TRUE;
......
...@@ -3655,7 +3655,7 @@ gtk_notebook_get_child_property (GtkContainer *container, ...@@ -3655,7 +3655,7 @@ gtk_notebook_get_child_property (GtkContainer *container,
case CHILD_PROP_TAB_LABEL: case CHILD_PROP_TAB_LABEL:
label = gtk_notebook_get_tab_label (notebook, child); label = gtk_notebook_get_tab_label (notebook, child);
if (label && GTK_IS_LABEL (label)) if (GTK_IS_LABEL (label))
g_value_set_string (value, GTK_LABEL (label)->label); g_value_set_string (value, GTK_LABEL (label)->label);
else else
g_value_set_string (value, NULL); g_value_set_string (value, NULL);
...@@ -3663,7 +3663,7 @@ gtk_notebook_get_child_property (GtkContainer *container, ...@@ -3663,7 +3663,7 @@ gtk_notebook_get_child_property (GtkContainer *container,
case CHILD_PROP_MENU_LABEL: case CHILD_PROP_MENU_LABEL:
label = gtk_notebook_get_menu_label (notebook, child); label = gtk_notebook_get_menu_label (notebook, child);
if (label && GTK_IS_LABEL (label)) if (GTK_IS_LABEL (label))
g_value_set_string (value, GTK_LABEL (label)->label); g_value_set_string (value, GTK_LABEL (label)->label);
else else
g_value_set_string (value, NULL); g_value_set_string (value, NULL);
...@@ -4427,7 +4427,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook) ...@@ -4427,7 +4427,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
} }
if (notebook->menu && page->default_menu) if (notebook->menu && page->default_menu)
{ {
if (page->tab_label && GTK_IS_LABEL (page->tab_label)) if (GTK_IS_LABEL (page->tab_label))
gtk_label_set_text (GTK_LABEL (page->menu_label), gtk_label_set_text (GTK_LABEL (page->menu_label),
GTK_LABEL (page->tab_label)->label); GTK_LABEL (page->tab_label)->label);
else else
...@@ -5929,7 +5929,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook, ...@@ -5929,7 +5929,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
page = list->data; page = list->data;
if (page->default_menu) if (page->default_menu)
{ {
if (page->tab_label && GTK_IS_LABEL (page->tab_label)) if (GTK_IS_LABEL (page->tab_label))
page->menu_label = gtk_label_new (GTK_LABEL (page->tab_label)->label); page->menu_label = gtk_label_new (GTK_LABEL (page->tab_label)->label);
else else
page->menu_label = gtk_label_new (""); page->menu_label = gtk_label_new ("");
...@@ -6981,7 +6981,7 @@ gtk_notebook_get_tab_label_text (GtkNotebook *notebook, ...@@ -6981,7 +6981,7 @@ gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
tab_label = gtk_notebook_get_tab_label (notebook, child); tab_label = gtk_notebook_get_tab_label (notebook, child);
if (tab_label && GTK_IS_LABEL (tab_label)) if (GTK_IS_LABEL (tab_label))
return gtk_label_get_text (GTK_LABEL (tab_label)); return gtk_label_get_text (GTK_LABEL (tab_label));
else else
return NULL; return NULL;
...@@ -7116,7 +7116,7 @@ gtk_notebook_get_menu_label_text (GtkNotebook *notebook, ...@@ -7116,7 +7116,7 @@ gtk_notebook_get_menu_label_text (GtkNotebook *notebook,
menu_label = gtk_notebook_get_menu_label (notebook, child); menu_label = gtk_notebook_get_menu_label (notebook, child);
if (menu_label && GTK_IS_LABEL (menu_label)) if (GTK_IS_LABEL (menu_label))
return gtk_label_get_text (GTK_LABEL (menu_label)); return gtk_label_get_text (GTK_LABEL (menu_label));
else else
return NULL; return NULL;
......
...@@ -205,7 +205,7 @@ gtk_separator_tool_item_expose (GtkWidget *widget, ...@@ -205,7 +205,7 @@ gtk_separator_tool_item_expose (GtkWidget *widget,
if (priv->draw) if (priv->draw)
{ {
if (widget->parent && GTK_IS_TOOLBAR (widget->parent)) if (GTK_IS_TOOLBAR (widget->parent))
toolbar = GTK_TOOLBAR (widget->parent); toolbar = GTK_TOOLBAR (widget->parent);
_gtk_toolbar_paint_space_line (widget, toolbar, _gtk_toolbar_paint_space_line (widget, toolbar,
......
...@@ -360,7 +360,7 @@ _gtk_socket_end_embedding (GtkSocket *socket) ...@@ -360,7 +360,7 @@ _gtk_socket_end_embedding (GtkSocket *socket)
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket)); GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
gint i; gint i;
if (toplevel && GTK_IS_WINDOW (toplevel)) if (GTK_IS_WINDOW (toplevel))
_gtk_socket_windowing_end_embedding_toplevel (socket); _gtk_socket_windowing_end_embedding_toplevel (socket);
g_object_unref (socket->plug_window); g_object_unref (socket->plug_window);
...@@ -890,7 +890,7 @@ _gtk_socket_add_window (GtkSocket *socket, ...@@ -890,7 +890,7 @@ _gtk_socket_add_window (GtkSocket *socket,
/* Add a pointer to the socket on our toplevel window */ /* Add a pointer to the socket on our toplevel window */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
if (toplevel && GTK_IS_WINDOW (toplevel)) if (GTK_IS_WINDOW (toplevel))
gtk_window_add_embedded_xid (GTK_WINDOW (toplevel), xid); gtk_window_add_embedded_xid (GTK_WINDOW (toplevel), xid);
_gtk_socket_windowing_embed_notify (socket); _gtk_socket_windowing_embed_notify (socket);
......
...@@ -1821,7 +1821,7 @@ allocate_child_widgets (GtkTextLayout *text_layout, ...@@ -1821,7 +1821,7 @@ allocate_child_widgets (GtkTextLayout *text_layout,
/* shaped_object is NULL for child anchors with no /* shaped_object is NULL for child anchors with no
* widgets stored at them * widgets stored at them
*/ */
if (shaped_object && GTK_IS_WIDGET (shaped_object)) if (GTK_IS_WIDGET (shaped_object))
{ {
PangoRectangle extents; PangoRectangle extents;
......
...@@ -193,7 +193,7 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item) ...@@ -193,7 +193,7 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
const gchar *label_text = gtk_tool_button_get_label (tool_button); const gchar *label_text = gtk_tool_button_get_label (tool_button);
const gchar *stock_id = gtk_tool_button_get_stock_id (tool_button); const gchar *stock_id = gtk_tool_button_get_stock_id (tool_button);
if (label_widget && GTK_IS_LABEL (label_widget)) if (GTK_IS_LABEL (label_widget))
{ {
label = gtk_label_get_label (GTK_LABEL (label_widget)); label = gtk_label_get_label (GTK_LABEL (label_widget));
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (label_widget)); use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (label_widget));
......
...@@ -614,7 +614,7 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item) ...@@ -614,7 +614,7 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
gboolean use_mnemonic = TRUE; gboolean use_mnemonic = TRUE;
const char *label; const char *label;
if (button->priv->label_widget && GTK_IS_LABEL (button->priv->label_widget)) if (GTK_IS_LABEL (button->priv->label_widget))
{ {
label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget)); label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget)); use_mnemonic = gtk_label_get_use_underline (GTK_LABEL (button->priv->label_widget));
...@@ -638,7 +638,7 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item) ...@@ -638,7 +638,7 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
else else
menu_item = gtk_image_menu_item_new_with_label (label); menu_item = gtk_image_menu_item_new_with_label (label);
if (button->priv->icon_widget && GTK_IS_IMAGE (button->priv->icon_widget)) if (GTK_IS_IMAGE (button->priv->icon_widget))
{ {
menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget), menu_image = clone_image_menu_size (GTK_IMAGE (button->priv->icon_widget),
gtk_widget_get_settings (GTK_WIDGET (button))); gtk_widget_get_settings (GTK_WIDGET (button)));
......
...@@ -1120,7 +1120,7 @@ gtk_tool_item_rebuild_menu (GtkToolItem *tool_item) ...@@ -1120,7 +1120,7 @@ gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
widget = GTK_WIDGET (tool_item); widget = GTK_WIDGET (tool_item);
if (widget->parent && GTK_IS_TOOL_SHELL (widget->parent)) if (GTK_IS_TOOL_SHELL (widget->parent))
gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (widget->parent)); gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (widget->parent));
} }
......
...@@ -473,7 +473,7 @@ gtk_tree_parent_set (GtkWidget *widget, ...@@ -473,7 +473,7 @@ gtk_tree_parent_set (GtkWidget *widget,
GtkWidget *child; GtkWidget *child;
GList *children; GList *children;
if (widget->parent && GTK_IS_TREE (widget->parent)) if (GTK_IS_TREE (widget->parent))
{ {
gtk_tree_unselect_all (tree); gtk_tree_unselect_all (tree);
...@@ -638,7 +638,7 @@ gtk_tree_remove_items (GtkTree *tree, ...@@ -638,7 +638,7 @@ gtk_tree_remove_items (GtkTree *tree,
else else
{ {
GtkWidget *tmp = GTK_WIDGET (tree); GtkWidget *tmp = GTK_WIDGET (tree);
while (tmp->parent && GTK_IS_TREE (tmp->parent)) while (GTK_IS_TREE (tmp->parent))
tmp = tmp->parent; tmp = tmp->parent;
root_tree = GTK_TREE (tmp); root_tree = GTK_TREE (tmp);
......
...@@ -784,7 +784,7 @@ gtk_real_tree_item_toggle (GtkItem *item) ...@@ -784,7 +784,7 @@ gtk_real_tree_item_toggle (GtkItem *item)
if(!GTK_WIDGET_IS_SENSITIVE(item)) if(!GTK_WIDGET_IS_SENSITIVE(item))
return; return;
if (GTK_WIDGET (item)->parent && GTK_IS_TREE (GTK_WIDGET (item)->parent)) if (GTK_IS_TREE (GTK_WIDGET (item)->parent))
gtk_tree_select_child (GTK_TREE (GTK_WIDGET (item)->parent), gtk_tree_select_child (GTK_TREE (GTK_WIDGET (item)->parent),
GTK_WIDGET (item)); GTK_WIDGET (item));
else else
......
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