#include "gtkmarshalers.h"
#include "gtksettings.h"
#include "gtktogglebutton.h"
+#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
enum {
path_bar->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
- gdk_window_set_user_data (path_bar->event_window, widget);
+ gtk_widget_register_window (widget, path_bar->event_window);
}
static void
path_bar = GTK_PATH_BAR (widget);
- gdk_window_set_user_data (path_bar->event_window, NULL);
+ gtk_widget_unregister_window (widget, path_bar->event_window);
gdk_window_destroy (path_bar->event_window);
path_bar->event_window = NULL;
GList *l;
if (path_bar->up_slider_button)
- gtk_widget_reset_style (path_bar->up_slider_button);
+ _gtk_widget_invalidate_style_context (path_bar->up_slider_button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
if (path_bar->down_slider_button)
- gtk_widget_reset_style (path_bar->down_slider_button);
+ _gtk_widget_invalidate_style_context (path_bar->down_slider_button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
for (l = path_bar->button_list; l; l = l->next)
{
ButtonData *data = l->data;
- gtk_widget_reset_style (data->button);
+ _gtk_widget_invalidate_style_context (data->button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
}
}
gboolean need_sliders = FALSE;
gint up_slider_offset = 0;
GtkRequisition child_requisition;
+ gboolean needs_reorder = FALSE;
gtk_widget_set_allocation (widget, allocation);
else if (gtk_widget_get_has_tooltip (child))
gtk_widget_set_tooltip_text (child, NULL);
+ needs_reorder |= gtk_widget_get_child_visible (child) == FALSE;
gtk_widget_set_child_visible (child, TRUE);
gtk_widget_size_allocate (child, &child_allocation);
/* Now we go hide all the widgets that don't fit */
while (list)
{
- gtk_widget_set_child_visible (BUTTON_DATA (list->data)->button, FALSE);
+ child = BUTTON_DATA (list->data)->button;
+ needs_reorder |= gtk_widget_get_child_visible (child) == TRUE;
+ gtk_widget_set_child_visible (child, FALSE);
list = list->prev;
}
for (list = first_button->next; list; list = list->next)
{
- gtk_widget_set_child_visible (BUTTON_DATA (list->data)->button, FALSE);
+ child = BUTTON_DATA (list->data)->button;
+ needs_reorder |= gtk_widget_get_child_visible (child) == TRUE;
+ gtk_widget_set_child_visible (child, FALSE);
}
if (need_sliders || path_bar->fake_root)
child_allocation.x = up_slider_offset + allocation->x;
gtk_widget_size_allocate (path_bar->up_slider_button, &child_allocation);
+ needs_reorder |= gtk_widget_get_child_visible (path_bar->up_slider_button) == FALSE;
gtk_widget_set_child_visible (path_bar->up_slider_button, TRUE);
gtk_widget_show_all (path_bar->up_slider_button);
}
else
- gtk_widget_set_child_visible (path_bar->up_slider_button, FALSE);
+ {
+ needs_reorder |= gtk_widget_get_child_visible (path_bar->up_slider_button) == TRUE;
+ gtk_widget_set_child_visible (path_bar->up_slider_button, FALSE);
+ }
if (need_sliders)
{
gtk_widget_size_allocate (path_bar->down_slider_button, &child_allocation);
+ needs_reorder |= gtk_widget_get_child_visible (path_bar->down_slider_button) == FALSE;
gtk_widget_set_child_visible (path_bar->down_slider_button, TRUE);
gtk_widget_show_all (path_bar->down_slider_button);
gtk_path_bar_update_slider_buttons (path_bar);
}
else
- gtk_widget_set_child_visible (path_bar->down_slider_button, FALSE);
+ {
+ needs_reorder |= gtk_widget_get_child_visible (path_bar->down_slider_button) == TRUE;
+ gtk_widget_set_child_visible (path_bar->down_slider_button, FALSE);
+ }
- child_ordering_changed (path_bar);
+ if (needs_reorder)
+ child_ordering_changed (path_bar);
}
static void
GtkPathBar *path_bar = GTK_PATH_BAR (container);
GtkWidgetPath *path;
- path = gtk_widget_path_copy (gtk_widget_get_path (GTK_WIDGET (path_bar)));
+ path = _gtk_widget_create_path (GTK_WIDGET (path_bar));
if (gtk_widget_get_visible (child) &&
gtk_widget_get_child_visible (child))