diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-01-22 18:37:22 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-01-22 18:37:22 +0000 |
commit | 47c6d18d1dbed518dda28866b355cb17c2a8ccb5 (patch) | |
tree | c258faa831aec649a45ded8b7d4d0fc688c68404 | |
parent | 6f712f46dcc94866c460f08fb4d2be912bfbb0bb (diff) | |
download | nautilus-47c6d18d1dbed518dda28866b355cb17c2a8ccb5.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>NAUTILUS_PR3_ANCHOR
Fix 5613 - Icon captions in sidebar get cropped when toggling
"smooth graphics.
* libnautilus-extensions/nautilus-label.c:
(label_force_cached_requisition_flush),
(nautilus_label_set_is_smooth):
Flush the GtkLabel's requisition cache when the is_smooth
attribute is changed.
* src/nautilus-property-browser.c:
(nautilus_property_browser_initialize),
(nautilus_property_browser_destroy),
(nautilus_property_browser_theme_changed):
Remove attempt at fixing parts of 5613. The fix above should fix
it everywhere.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-label.c | 38 | ||||
-rw-r--r-- | libnautilus-private/nautilus-label.c | 38 | ||||
-rw-r--r-- | src/nautilus-property-browser.c | 28 |
4 files changed, 96 insertions, 28 deletions
@@ -1,3 +1,23 @@ +2001-01-22 Ramiro Estrugo <ramiro@eazel.com> + + reviewed by: John Sullivan <sullivan@eazel.com> + + Fix 5613 - Icon captions in sidebar get cropped when toggling + "smooth graphics. + + * libnautilus-extensions/nautilus-label.c: + (label_force_cached_requisition_flush), + (nautilus_label_set_is_smooth): + Flush the GtkLabel's requisition cache when the is_smooth + attribute is changed. + + * src/nautilus-property-browser.c: + (nautilus_property_browser_initialize), + (nautilus_property_browser_destroy), + (nautilus_property_browser_theme_changed): + Remove attempt at fixing parts of 5613. The fix above should fix + it everywhere. + 2001-01-20 John Sullivan <sullivan@eazel.com> reviewed by: Pavel Cisler <pavel@eazel.com> (except diff --git a/libnautilus-extensions/nautilus-label.c b/libnautilus-extensions/nautilus-label.c index 6bc0eb7d3..24cc443c8 100644 --- a/libnautilus-extensions/nautilus-label.c +++ b/libnautilus-extensions/nautilus-label.c @@ -1177,6 +1177,36 @@ nautilus_label_get_smooth_font_size (const NautilusLabel *label) return label->detail->smooth_font_size; } +/* This function is an ugly hack. The issue is that we want + * GtkLabel to flush its cached requisition dimensions. GtkLabel + * caches these for efficiency. Unfortunately, there is no public + * way to do this for GtkLabel. So, instead we trick the GtkLabel + * into thinking that its justification has changed. As a result + * of this phony change, GtkLabel will flush the requisition cache + * Of course, we don't really change the justification. We hack + * the old one to a different value and tell GtkLabel to use the + * old real justification. + */ +static void +label_force_cached_requisition_flush (NautilusLabel *label) +{ + GtkJustification real_justification; + GtkJustification phony_justification; + + g_return_if_fail (NAUTILUS_IS_LABEL (label)); + + real_justification = GTK_LABEL (label)->jtype; + + phony_justification = real_justification + 1; + + if (phony_justification >= GTK_JUSTIFY_FILL) { + real_justification = GTK_JUSTIFY_LEFT; + } + + GTK_LABEL (label)->jtype = phony_justification; + gtk_label_set_justify (GTK_LABEL (label), real_justification); +} + void nautilus_label_set_is_smooth (NautilusLabel *label, gboolean is_smooth) @@ -1191,6 +1221,14 @@ nautilus_label_set_is_smooth (NautilusLabel *label, label_line_geometries_recompute (label); + /* Force GtkLabel to flush its cached requisition dimensions. + * GtkLabel caches its requisition for efficiency. We need this + * dimensions to be flushed when our is_smooth attribute changes. + * The reason is that the geometry of the widget is dependent on + * whether it is_smooth or not. + */ + label_force_cached_requisition_flush (label); + gtk_widget_queue_resize (GTK_WIDGET (label)); } diff --git a/libnautilus-private/nautilus-label.c b/libnautilus-private/nautilus-label.c index 6bc0eb7d3..24cc443c8 100644 --- a/libnautilus-private/nautilus-label.c +++ b/libnautilus-private/nautilus-label.c @@ -1177,6 +1177,36 @@ nautilus_label_get_smooth_font_size (const NautilusLabel *label) return label->detail->smooth_font_size; } +/* This function is an ugly hack. The issue is that we want + * GtkLabel to flush its cached requisition dimensions. GtkLabel + * caches these for efficiency. Unfortunately, there is no public + * way to do this for GtkLabel. So, instead we trick the GtkLabel + * into thinking that its justification has changed. As a result + * of this phony change, GtkLabel will flush the requisition cache + * Of course, we don't really change the justification. We hack + * the old one to a different value and tell GtkLabel to use the + * old real justification. + */ +static void +label_force_cached_requisition_flush (NautilusLabel *label) +{ + GtkJustification real_justification; + GtkJustification phony_justification; + + g_return_if_fail (NAUTILUS_IS_LABEL (label)); + + real_justification = GTK_LABEL (label)->jtype; + + phony_justification = real_justification + 1; + + if (phony_justification >= GTK_JUSTIFY_FILL) { + real_justification = GTK_JUSTIFY_LEFT; + } + + GTK_LABEL (label)->jtype = phony_justification; + gtk_label_set_justify (GTK_LABEL (label), real_justification); +} + void nautilus_label_set_is_smooth (NautilusLabel *label, gboolean is_smooth) @@ -1191,6 +1221,14 @@ nautilus_label_set_is_smooth (NautilusLabel *label, label_line_geometries_recompute (label); + /* Force GtkLabel to flush its cached requisition dimensions. + * GtkLabel caches its requisition for efficiency. We need this + * dimensions to be flushed when our is_smooth attribute changes. + * The reason is that the geometry of the widget is dependent on + * whether it is_smooth or not. + */ + label_force_cached_requisition_flush (label); + gtk_widget_queue_resize (GTK_WIDGET (label)); } diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c index 3b5044949..fb892a165 100644 --- a/src/nautilus-property-browser.c +++ b/src/nautilus-property-browser.c @@ -174,7 +174,6 @@ static void nautilus_property_browser_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void nautilus_property_browser_theme_changed (gpointer user_data); -static void nautilus_property_browser_smooth_graphics_changed (gpointer user_data); static void emit_emblems_changed_signal (void); /* misc utilities */ @@ -404,11 +403,6 @@ nautilus_property_browser_initialize (GtkObject *object) nautilus_property_browser_theme_changed, property_browser); - /* add a callback for when smooth graphics changes */ - nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE, - nautilus_property_browser_smooth_graphics_changed, - property_browser); - gtk_signal_connect (GTK_OBJECT (property_browser), "delete_event", GTK_SIGNAL_FUNC (nautilus_property_browser_delete_event_callback), NULL); @@ -450,10 +444,6 @@ nautilus_property_browser_destroy (GtkObject *object) nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_property_browser_theme_changed, property_browser); - nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE, - nautilus_property_browser_smooth_graphics_changed, - property_browser); - if (object == GTK_OBJECT (main_browser)) main_browser = NULL; @@ -1898,24 +1888,6 @@ nautilus_property_browser_theme_changed (gpointer user_data) nautilus_property_browser_update_contents (property_browser); } -/* handle anti-aliased mode changes by updating everything */ -static void -nautilus_property_browser_smooth_graphics_changed (gpointer user_data) -{ - char *category; - NautilusPropertyBrowser *property_browser; - - property_browser = NAUTILUS_PROPERTY_BROWSER(user_data); - category = property_browser->details->category; - property_browser->details->category = NULL; - nautilus_property_browser_set_category (property_browser, category); - - /* relayout the title box as well to better position the title text */ - gtk_widget_queue_resize (property_browser->details->title_box); - - g_free (category); -} - /* make_category generates widgets corresponding all of the objects in the passed in directory */ static void make_category(NautilusPropertyBrowser *property_browser, const char* path, const char* mode, xmlNodePtr node, const char *description) |