Bug 422906 - "Change a big toplevel "if(...) { <code> }" introduced by bug 415163 to an "if(!...) return; <code>"" [p=frnchfrgg-mozbugs@altern.org (RIVAUD Julien [_FrnchFrgg_]) r+sr=roc a1.9=beltzner]

This commit is contained in:
reed@reedloden.com 2008-03-18 12:31:50 -07:00
Родитель 19a507b921
Коммит dbcf29a8c3
1 изменённых файлов: 58 добавлений и 56 удалений

Просмотреть файл

@ -397,65 +397,67 @@ moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data)
static gint static gint
ensure_combo_box_entry_widgets() ensure_combo_box_entry_widgets()
{ {
if (!gComboBoxEntryTextareaWidget || if (gComboBoxEntryTextareaWidget &&
!gComboBoxEntryButtonWidget || gComboBoxEntryButtonWidget &&
!gComboBoxEntryArrowWidget) { gComboBoxEntryArrowWidget)
GtkWidget* buttonChild; return MOZ_GTK_SUCCESS;
/* Create a ComboBoxEntry if needed */ GtkWidget* buttonChild;
if (!gComboBoxEntryWidget) {
gComboBoxEntryWidget = gtk_combo_box_entry_new();
setup_widget_prototype(gComboBoxEntryWidget);
}
/* Get its inner Entry and Button */ /* Create a ComboBoxEntry if needed */
gtk_container_forall(GTK_CONTAINER(gComboBoxEntryWidget), if (!gComboBoxEntryWidget) {
moz_gtk_get_combo_box_entry_inner_widgets, gComboBoxEntryWidget = gtk_combo_box_entry_new();
NULL); setup_widget_prototype(gComboBoxEntryWidget);
if (!gComboBoxEntryTextareaWidget) {
ensure_entry_widget();
gComboBoxEntryTextareaWidget = gEntryWidget;
}
if (gComboBoxEntryButtonWidget) {
/* Get the Arrow inside the Button */
buttonChild = GTK_BIN(gComboBoxEntryButtonWidget)->child;
if (GTK_IS_HBOX(buttonChild)) {
/* appears-as-list = FALSE, cell-view = TRUE; the button
* contains an hbox. This hbox is there because ComboBoxEntry
* inherits from ComboBox which needs to place a cell renderer,
* a separator, and an arrow in the button when appears-as-list
* is FALSE. Here the hbox should only contain an arrow, since
* a ComboBoxEntry doesn't need all those widgets in the
* button. */
gtk_container_forall(GTK_CONTAINER(buttonChild),
moz_gtk_get_combo_box_entry_arrow,
NULL);
} else if(GTK_IS_ARROW(buttonChild)) {
/* appears-as-list = TRUE, or cell-view = FALSE;
* the button only contains an arrow */
gComboBoxEntryArrowWidget = buttonChild;
g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
&gComboBoxEntryArrowWidget);
gtk_widget_realize(gComboBoxEntryArrowWidget);
}
} else {
/* Shouldn't be reached with current internal gtk implementation;
* we use a generic toggle button as last resort fallback to avoid
* crashing. */
ensure_toggle_button_widget();
gComboBoxEntryButtonWidget = gToggleButtonWidget;
}
if (!gComboBoxEntryArrowWidget) {
/* Shouldn't be reached with current internal gtk implementation;
* we gButtonArrowWidget as last resort fallback to avoid
* crashing. */
ensure_button_arrow_widget();
gComboBoxEntryArrowWidget = gButtonArrowWidget;
}
} }
/* Get its inner Entry and Button */
gtk_container_forall(GTK_CONTAINER(gComboBoxEntryWidget),
moz_gtk_get_combo_box_entry_inner_widgets,
NULL);
if (!gComboBoxEntryTextareaWidget) {
ensure_entry_widget();
gComboBoxEntryTextareaWidget = gEntryWidget;
}
if (gComboBoxEntryButtonWidget) {
/* Get the Arrow inside the Button */
buttonChild = GTK_BIN(gComboBoxEntryButtonWidget)->child;
if (GTK_IS_HBOX(buttonChild)) {
/* appears-as-list = FALSE, cell-view = TRUE; the button
* contains an hbox. This hbox is there because ComboBoxEntry
* inherits from ComboBox which needs to place a cell renderer,
* a separator, and an arrow in the button when appears-as-list
* is FALSE. Here the hbox should only contain an arrow, since
* a ComboBoxEntry doesn't need all those widgets in the
* button. */
gtk_container_forall(GTK_CONTAINER(buttonChild),
moz_gtk_get_combo_box_entry_arrow,
NULL);
} else if(GTK_IS_ARROW(buttonChild)) {
/* appears-as-list = TRUE, or cell-view = FALSE;
* the button only contains an arrow */
gComboBoxEntryArrowWidget = buttonChild;
g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
&gComboBoxEntryArrowWidget);
gtk_widget_realize(gComboBoxEntryArrowWidget);
}
} else {
/* Shouldn't be reached with current internal gtk implementation;
* we use a generic toggle button as last resort fallback to avoid
* crashing. */
ensure_toggle_button_widget();
gComboBoxEntryButtonWidget = gToggleButtonWidget;
}
if (!gComboBoxEntryArrowWidget) {
/* Shouldn't be reached with current internal gtk implementation;
* we gButtonArrowWidget as last resort fallback to avoid
* crashing. */
ensure_button_arrow_widget();
gComboBoxEntryArrowWidget = gButtonArrowWidget;
}
return MOZ_GTK_SUCCESS; return MOZ_GTK_SUCCESS;
} }