[nautilus] Do not modify ellipsize property within a size request function
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Do not modify ellipsize property within a size request function
- Date: Mon, 17 Feb 2014 20:57:03 +0000 (UTC)
commit fae9dde9a806af73bd71087be4841d0990626a6e
Author: Daniel Wyatt <Daniel Wyatt gmail com>
Date: Thu Feb 13 10:30:25 2014 -0500
Do not modify ellipsize property within a size request function
Instead, we can use the natural size request which is equivalent to the non-ellipsized size.
See: https://developer.gnome.org/gtk3/stable/GtkLabel.html#label-text-layout
https://bugzilla.gnome.org/show_bug.cgi?id=697198
src/nautilus-pathbar.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 7d51d56..fc34051 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -303,21 +303,18 @@ static void
set_label_size_request (ButtonData *button_data)
{
gint width, height;
- GtkRequisition min_req, bold_req;
+ GtkRequisition nat_req, bold_req;
if (button_data->label == NULL) {
return;
}
- gtk_label_set_ellipsize (GTK_LABEL (button_data->label), PANGO_ELLIPSIZE_NONE);
- gtk_widget_get_preferred_size (button_data->label, &min_req, NULL);
- gtk_label_set_ellipsize (GTK_LABEL (button_data->label), PANGO_ELLIPSIZE_MIDDLE);
-
+ gtk_widget_get_preferred_size (button_data->label, NULL, &nat_req);
gtk_widget_get_preferred_size (button_data->bold_label, &bold_req, NULL);
- width = MAX (min_req.width, bold_req.width);
+ width = MAX (nat_req.width, bold_req.width);
width = MIN (width, NAUTILUS_PATH_BAR_BUTTON_MAX_WIDTH);
- height = MAX (min_req.height, bold_req.height);
+ height = MAX (nat_req.height, bold_req.height);
gtk_widget_set_size_request (button_data->label, width, height);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]