diff options
-rw-r--r-- | calendar/gui/weekday-picker.c | 24 | ||||
-rw-r--r-- | mail/e-mail-attachment-bar.c | 24 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 20 | ||||
-rw-r--r-- | shell/e-shell-content.c | 50 | ||||
-rw-r--r-- | shell/e-shell-meego.c | 2 | ||||
-rw-r--r-- | shell/e-shell-sidebar.c | 42 | ||||
-rw-r--r-- | shell/e-shell-switcher.c | 62 | ||||
-rw-r--r-- | widgets/misc/e-calendar.c | 44 | ||||
-rw-r--r-- | widgets/misc/e-map.c | 26 | ||||
-rw-r--r-- | widgets/misc/e-menu-tool-button.c | 27 | ||||
-rw-r--r-- | widgets/table/e-table.c | 20 |
11 files changed, 236 insertions, 105 deletions
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c index c2165f6d16..44993724a9 100644 --- a/calendar/gui/weekday-picker.c +++ b/calendar/gui/weekday-picker.c @@ -219,8 +219,9 @@ weekday_picker_realize (GtkWidget *widget) } static void -weekday_picker_size_request (GtkWidget *widget, - GtkRequisition *requisition) +weekday_picker_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { WeekdayPicker *wp; WeekdayPickerPrivate *priv; @@ -228,8 +229,20 @@ weekday_picker_size_request (GtkWidget *widget, wp = WEEKDAY_PICKER (widget); priv = wp->priv; - requisition->width = (priv->max_letter_width + 2 * PADDING + 1) * 7 + 1; - requisition->height = (priv->font_ascent + priv->font_descent + 2 * PADDING + 2); + *minimum_width = *natural_width = (priv->max_letter_width + 2 * PADDING + 1) * 7 + 1; +} +static void +weekday_picker_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + WeekdayPicker *wp; + WeekdayPickerPrivate *priv; + + wp = WEEKDAY_PICKER (widget); + priv = wp->priv; + + *minimum_height = *natural_height = (priv->font_ascent + priv->font_descent + 2 * PADDING + 2); } static void @@ -346,7 +359,8 @@ weekday_picker_class_init (WeekdayPickerClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = weekday_picker_realize; - widget_class->size_request = weekday_picker_size_request; + widget_class->get_preferred_width = weekday_picker_get_preferred_width; + widget_class->get_preferred_height = weekday_picker_get_preferred_height; widget_class->size_allocate = weekday_picker_size_allocate; widget_class->style_set = weekday_picker_style_set; widget_class->focus = weekday_picker_focus; diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c index 519eaf89b7..954a3e056f 100644 --- a/mail/e-mail-attachment-bar.c +++ b/mail/e-mail-attachment-bar.c @@ -322,26 +322,6 @@ mail_attachment_bar_constructed (GObject *object) G_OBJECT_CLASS (parent_class)->constructed (object); } -static void -mail_attachment_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - /* XXX This works around GtkHTMLEmbedded not taking visibility - * into account when calculating its size (at least I think - * that's where it's broken). Without the workaround, we - * get a sizable gap between the headers and body when this - * widget is invisible. Once we finally move to WebKit, - * remove this. */ - if (!gtk_widget_get_visible (widget)) { - requisition->width = 0; - requisition->height = 0; - return; - } - - /* Chain up to parent's size_request() method. */ - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); -} - static EAttachmentViewPrivate * mail_attachment_bar_get_private (EAttachmentView *view) { @@ -461,7 +441,6 @@ static void mail_attachment_bar_class_init (EMailAttachmentBarClass *class) { GObjectClass *object_class; - GtkWidgetClass *widget_class; parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailAttachmentBarPrivate)); @@ -472,9 +451,6 @@ mail_attachment_bar_class_init (EMailAttachmentBarClass *class) object_class->dispose = mail_attachment_bar_dispose; object_class->constructed = mail_attachment_bar_constructed; - widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = mail_attachment_bar_size_request; - g_object_class_install_property ( object_class, PROP_ACTIVE_VIEW, diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 2b24aae5e1..7c538de519 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -231,8 +231,17 @@ guess_screen_width (EMailShellSidebar *sidebar) } static void -mail_shell_sidebar_size_request (GtkWidget *widget, - GtkRequisition *requisition) +mail_shell_sidebar_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, minimum_height, natural_height); +} + +static void +mail_shell_sidebar_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { /* We override the normal size-request handler so that we can * spit out a treeview with a suitable width. We measure the @@ -258,7 +267,7 @@ mail_shell_sidebar_size_request (GtkWidget *widget, sidebar = E_MAIL_SHELL_SIDEBAR (widget); - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); + GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, minimum_width, natural_width); /* This string is a mockup only; it doesn't need to be translated */ layout = gtk_widget_create_pango_layout ( @@ -274,7 +283,7 @@ mail_shell_sidebar_size_request (GtkWidget *widget, border = 2 * style->xthickness + 4; sidebar_width = ink_rect.width + border; sidebar_width = MIN (sidebar_width, screen_width / 4); - requisition->width = MAX (requisition->width, sidebar_width); + *minimum_width = *natural_width = MAX (*natural_width, sidebar_width); } static guint32 @@ -305,7 +314,8 @@ mail_shell_sidebar_class_init (EMailShellSidebarClass *class) object_class->constructed = mail_shell_sidebar_constructed; widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = mail_shell_sidebar_size_request; + widget_class->get_preferred_width = mail_shell_sidebar_get_preferred_width; + widget_class->get_preferred_height = mail_shell_sidebar_get_preferred_height; shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class); shell_sidebar_class->check_state = mail_shell_sidebar_check_state; diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c index 38b62738be..586b706859 100644 --- a/shell/e-shell-content.c +++ b/shell/e-shell-content.c @@ -213,31 +213,54 @@ shell_content_constructed (GObject *object) } static void -shell_content_size_request (GtkWidget *widget, - GtkRequisition *requisition) +shell_content_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) { EShellContentPrivate *priv; - GtkRequisition child_requisition; + gint min, nat; + gint child_min, child_nat; GtkWidget *child; priv = E_SHELL_CONTENT_GET_PRIVATE (widget); - requisition->width = 0; - requisition->height = 0; + *minimum = *natural = 0; child = gtk_bin_get_child (GTK_BIN (widget)); - gtk_widget_get_preferred_size (child, requisition, NULL); + gtk_widget_get_preferred_width (child, &child_min, &child_nat); + gtk_widget_get_preferred_width (priv->alert_bar, &min, &nat); + + *minimum = MAX (min, child_min); + *natural = MAX (nat, child_nat); + + if (priv->searchbar == NULL) + return; + + gtk_widget_get_preferred_width (priv->searchbar, &min, &nat); + *minimum = MAX (*minimum, min); + *natural = MAX (*natural, nat); +} - gtk_widget_get_preferred_size (priv->alert_bar, &child_requisition, NULL); - requisition->width = MAX (requisition->width, child_requisition.width); - requisition->height += child_requisition.height; +static void +shell_content_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + EShellContentPrivate *priv; + gint min, nat; + GtkWidget *child; + + priv = E_SHELL_CONTENT_GET_PRIVATE (widget); + + child = gtk_bin_get_child (GTK_BIN (widget)); + gtk_widget_get_preferred_height (child, minimum, natural); if (priv->searchbar == NULL) return; - gtk_widget_get_preferred_size (priv->searchbar, &child_requisition, NULL); - requisition->width = MAX (requisition->width, child_requisition.width); - requisition->height += child_requisition.height; + gtk_widget_get_preferred_height (priv->searchbar, &min, &nat); + *minimum += min; + *natural += nat; } static void @@ -398,7 +421,8 @@ e_shell_content_class_init (EShellContentClass *class) object_class->constructed = shell_content_constructed; widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = shell_content_size_request; + widget_class->get_preferred_width = shell_content_get_preferred_width; + widget_class->get_preferred_height = shell_content_get_preferred_height; widget_class->size_allocate = shell_content_size_allocate; container_class = GTK_CONTAINER_CLASS (class); diff --git a/shell/e-shell-meego.c b/shell/e-shell-meego.c index 29c7f293fd..51a2da9cf1 100644 --- a/shell/e-shell-meego.c +++ b/shell/e-shell-meego.c @@ -106,7 +106,7 @@ e_shell_detect_meego (gboolean *is_meego, &dummy_t, &dummy_i, &dummy_l, &dummy_l, &moblin_string); - gdk_error_trap_pop (); + gdk_error_trap_pop_ignored (); } if (moblin_string) { diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c index 5aa16e019d..618910a600 100644 --- a/shell/e-shell-sidebar.c +++ b/shell/e-shell-sidebar.c @@ -220,25 +220,44 @@ shell_sidebar_constructed (GObject *object) } static void -shell_sidebar_size_request (GtkWidget *widget, - GtkRequisition *requisition) +shell_sidebar_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) { EShellSidebarPrivate *priv; - GtkRequisition child_requisition; + gint child_min, child_nat; GtkWidget *child; priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget); - requisition->width = 0; - requisition->height = 0; + child = gtk_bin_get_child (GTK_BIN (widget)); + gtk_widget_get_preferred_width (child, minimum, natural); + + child = priv->event_box; + gtk_widget_get_preferred_width (child, &child_min, &child_nat); + *minimum = MAX (*minimum, child_min); + *natural = MAX (*natural, child_nat); +} + +static void +shell_sidebar_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + EShellSidebarPrivate *priv; + gint child_min, child_nat; + GtkWidget *child; + + priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget); child = gtk_bin_get_child (GTK_BIN (widget)); - gtk_widget_get_preferred_size (child, requisition, NULL); + gtk_widget_get_preferred_height (child, minimum, natural); child = priv->event_box; - gtk_widget_get_preferred_size (child, &child_requisition, NULL); - requisition->width = MAX (requisition->width, child_requisition.width); - requisition->height += child_requisition.height; + gtk_widget_get_preferred_height (child, &child_min, &child_nat); + + *minimum += child_min; + *natural += child_nat; } static void @@ -283,7 +302,7 @@ shell_sidebar_forall (GtkContainer *container, priv = E_SHELL_SIDEBAR_GET_PRIVATE (container); - if (include_internals) + if (include_internals && callback_data) callback (priv->event_box, callback_data); /* Chain up to parent's forall() method. */ @@ -308,7 +327,8 @@ e_shell_sidebar_class_init (EShellSidebarClass *class) object_class->constructed = shell_sidebar_constructed; widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = shell_sidebar_size_request; + widget_class->get_preferred_width = shell_sidebar_get_preferred_width; + widget_class->get_preferred_height = shell_sidebar_get_preferred_height; widget_class->size_allocate = shell_sidebar_size_allocate; container_class = GTK_CONTAINER_CLASS (class); diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c index 2d2d13c153..f785054c08 100644 --- a/shell/e-shell-switcher.c +++ b/shell/e-shell-switcher.c @@ -247,8 +247,9 @@ shell_switcher_dispose (GObject *object) } static void -shell_switcher_size_request (GtkWidget *widget, - GtkRequisition *requisition) +shell_switcher_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) { EShellSwitcherPrivate *priv; GtkWidget *child; @@ -256,28 +257,62 @@ shell_switcher_size_request (GtkWidget *widget, priv = E_SHELL_SWITCHER_GET_PRIVATE (widget); - requisition->width = 0; - requisition->height = 0; + *minimum = *natural = 0; child = gtk_bin_get_child (GTK_BIN (widget)); if (child != NULL) - gtk_widget_get_preferred_size (child, requisition, NULL); + gtk_widget_get_preferred_width (child, minimum, natural); + + if (!priv->toolbar_visible) + return; + + for (iter = priv->proxies; iter != NULL; iter = iter->next) { + GtkWidget *widget_proxy = iter->data; + gint child_min, child_nat; + + gtk_widget_get_preferred_width ( + widget_proxy, &child_min, &child_nat); + + child_min += H_PADDING; + child_nat += H_PADDING; + + *minimum = MAX (*minimum, child_min); + *natural = MAX (*natural, child_nat); + } +} + +static void +shell_switcher_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + EShellSwitcherPrivate *priv; + GtkWidget *child; + GList *iter; + + priv = E_SHELL_SWITCHER_GET_PRIVATE (widget); + + *minimum = *natural = 0; + + child = gtk_bin_get_child (GTK_BIN (widget)); + if (child != NULL) + gtk_widget_get_preferred_height (child, minimum, natural); if (!priv->toolbar_visible) return; for (iter = priv->proxies; iter != NULL; iter = iter->next) { GtkWidget *widget = iter->data; - GtkRequisition child_requisition; + gint child_min, child_nat; - gtk_widget_get_preferred_size (widget, &child_requisition, NULL); + gtk_widget_get_preferred_height ( + widget, &child_min, &child_nat); - child_requisition.width += H_PADDING; - child_requisition.height += V_PADDING; + child_min += V_PADDING; + child_nat += V_PADDING; - requisition->width = MAX ( - requisition->width, child_requisition.width); - requisition->height += child_requisition.height; + *minimum += child_min; + *natural += child_nat; } } @@ -451,7 +486,8 @@ e_shell_switcher_class_init (EShellSwitcherClass *class) object_class->dispose = shell_switcher_dispose; widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = shell_switcher_size_request; + widget_class->get_preferred_width = shell_switcher_get_preferred_width; + widget_class->get_preferred_height = shell_switcher_get_preferred_height; widget_class->size_allocate = shell_switcher_size_allocate; widget_class->screen_changed = shell_switcher_screen_changed; diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index d835ba89ae..c21a6a4547 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -69,8 +69,12 @@ static void e_calendar_dispose (GObject *object); static void e_calendar_realize (GtkWidget *widget); static void e_calendar_style_set (GtkWidget *widget, GtkStyle *previous_style); -static void e_calendar_size_request (GtkWidget *widget, - GtkRequisition *requisition); +static void e_calendar_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width); +static void e_calendar_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height); static void e_calendar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gint e_calendar_drag_motion (GtkWidget *widget, @@ -115,7 +119,8 @@ e_calendar_class_init (ECalendarClass *class) widget_class->realize = e_calendar_realize; widget_class->style_set = e_calendar_style_set; - widget_class->size_request = e_calendar_size_request; + widget_class->get_preferred_width = e_calendar_get_preferred_width; + widget_class->get_preferred_height = e_calendar_get_preferred_height; widget_class->size_allocate = e_calendar_size_allocate; widget_class->drag_motion = e_calendar_drag_motion; widget_class->drag_leave = e_calendar_drag_leave; @@ -281,26 +286,37 @@ e_calendar_style_set (GtkWidget *widget, } static void -e_calendar_size_request (GtkWidget *widget, - GtkRequisition *requisition) +e_calendar_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) { ECalendar *cal; GtkStyle *style; - gint col_width, row_height, width, height; + gint col_width; cal = E_CALENDAR (widget); style = gtk_widget_get_style (GTK_WIDGET (cal)); - g_object_get ((cal->calitem), - "row_height", &row_height, - "column_width", &col_width, - NULL); + g_object_get ((cal->calitem), "column_width", &col_width, NULL); - height = row_height * cal->min_rows; - width = col_width * cal->min_cols; + *minimum = *natural = col_width * cal->min_cols + style->xthickness * 2; +} + +static void +e_calendar_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + ECalendar *cal; + GtkStyle *style; + gint row_height; + + cal = E_CALENDAR (widget); + style = gtk_widget_get_style (GTK_WIDGET (cal)); + + g_object_get ((cal->calitem), "row_height", &row_height, NULL); - requisition->width = width + style->xthickness * 2; - requisition->height = height + style->ythickness * 2; + *minimum = *natural = row_height * cal->min_rows + style->ythickness * 2; } static void diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c index 89ca22b76a..842d396c7e 100644 --- a/widgets/misc/e-map.c +++ b/widgets/misc/e-map.c @@ -388,20 +388,35 @@ e_map_unrealize (GtkWidget *widget) } static void -e_map_size_request (GtkWidget *widget, GtkRequisition *requisition) +e_map_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural) { EMap *map; g_return_if_fail (widget != NULL); g_return_if_fail (E_IS_MAP (widget)); - g_return_if_fail (requisition != NULL); map = E_MAP (widget); /* TODO: Put real sizes here. */ - requisition->width = gdk_pixbuf_get_width (map->priv->map_pixbuf); - requisition->height = gdk_pixbuf_get_height (map->priv->map_pixbuf); + *minimum = *natural = gdk_pixbuf_get_width (map->priv->map_pixbuf); +} + +static void +e_map_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) +{ + EMap *view; + EMapPrivate *priv; + + g_return_if_fail (widget != NULL); + g_return_if_fail (E_IS_MAP (widget)); + + view = E_MAP (widget); + priv = view->priv; + + /* TODO: Put real sizes here. */ + + *minimum = *natural = gdk_pixbuf_get_height (priv->map_pixbuf); } static void @@ -621,7 +636,8 @@ e_map_class_init (EMapClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = e_map_realize; widget_class->unrealize = e_map_unrealize; - widget_class->size_request = e_map_size_request; + widget_class->get_preferred_height = e_map_get_preferred_height; + widget_class->get_preferred_width = e_map_get_preferred_width; widget_class->size_allocate = e_map_size_allocate; widget_class->button_press_event = e_map_button_press; widget_class->button_release_event = e_map_button_release; diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c index 612ed801f2..628fdea55d 100644 --- a/widgets/misc/e-menu-tool-button.c +++ b/widgets/misc/e-menu-tool-button.c @@ -100,14 +100,23 @@ menu_tool_button_update_button (GtkToolButton *tool_button) } static void -menu_tool_button_size_request (GtkWidget *widget, - GtkRequisition *requisition) +menu_tool_button_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) { - gint minimum_width; + GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)-> + get_preferred_height (widget, minimal_height, natural_height); +} + +static void +menu_tool_button_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + gint minimum_width, min_height, nat_height; - /* Chain up to parent's size_request() method. */ GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)-> - size_request (widget, requisition); + get_preferred_width (widget, minimal_width, natural_width); /* XXX This is a hack. This widget is only used for the New * button in the main window toolbar. The New button is @@ -117,8 +126,9 @@ menu_tool_button_size_request (GtkWidget *widget, * * We can't go hard-coding a width, but we -can- use a * heuristic based on the toolbar button height. */ - minimum_width = requisition->height * 2; - requisition->width = MAX (minimum_width, requisition->width); + menu_tool_button_get_preferred_height (widget, &min_height, &nat_height); + minimum_width = min_height * 2; + *minimal_width = *natural_width = MAX (minimum_width, *minimal_width); } static void @@ -141,7 +151,8 @@ e_menu_tool_button_class_init (EMenuToolButtonClass *class) GtkToolButtonClass *tool_button_class; widget_class = GTK_WIDGET_CLASS (class); - widget_class->size_request = menu_tool_button_size_request; + widget_class->get_preferred_height = menu_tool_button_get_preferred_height; + widget_class->get_preferred_width = menu_tool_button_get_preferred_width; tool_button_class = GTK_TOOL_BUTTON_CLASS (class); tool_button_class->clicked = menu_tool_button_clicked; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index d21137ef04..6a4d276e1b 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -226,13 +226,20 @@ current_search_col (ETable *et) } static void -et_size_request (GtkWidget *widget, GtkRequisition *request) +et_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural) { ETable *et = E_TABLE (widget); - if (GTK_WIDGET_CLASS (e_table_parent_class)->size_request) - GTK_WIDGET_CLASS (e_table_parent_class)->size_request (widget, request); - if (et->horizontal_resize) - request->width = MAX (request->width, et->header_width); + GTK_WIDGET_CLASS (e_table_parent_class)->get_preferred_width (widget, minimum, natural); + if (et->horizontal_resize) { + *minimum = MAX (*minimum, et->header_width); + *natural = MAX (*natural, et->header_width); + } +} + +static void +et_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) +{ + GTK_WIDGET_CLASS (e_table_parent_class)->get_preferred_height (widget, minimum, natural); } static void @@ -3239,7 +3246,8 @@ e_table_class_init (ETableClass *class) widget_class->grab_focus = et_grab_focus; widget_class->unrealize = et_unrealize; - widget_class->size_request = et_size_request; + widget_class->get_preferred_width = et_get_preferred_width; + widget_class->get_preferred_height = et_get_preferred_height; widget_class->focus = et_focus; |