Commit d3b83098 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Patch from Jacob Berkman to fix problem when the height/width of a layout

Tue Jan 29 17:16:17 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
        when the height/width of a layout was set before the
        adjustments were added. (#66294)

        * gtk/gtktreeview.c: Warning cleanups.
parent c12b1607
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
Tue Jan 29 17:16:17 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c: Patch from Jacob Berkman to fix problem
when the height/width of a layout was set before the
adjustments were added. (#66294)
* gtk/gtktreeview.c: Warning cleanups.
Tue Jan 29 16:35:04 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_motion): Small
......
......@@ -67,6 +67,9 @@ static void gtk_layout_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static GObject *gtk_layout_constructor (GType type,
guint n_properties,
GObjectConstructParam *properties);
static void gtk_layout_init (GtkLayout *layout);
static void gtk_layout_finalize (GObject *object);
static void gtk_layout_realize (GtkWidget *widget);
......@@ -104,6 +107,8 @@ static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
static void gtk_layout_style_set (GtkWidget *widget,
GtkStyle *old_style);
static void gtk_layout_set_adjustment_upper (GtkAdjustment *adj,
gdouble upper);
static GtkWidgetClass *parent_class = NULL;
......@@ -127,9 +132,10 @@ gtk_layout_new (GtkAdjustment *hadjustment,
{
GtkLayout *layout;
layout = gtk_type_new (GTK_TYPE_LAYOUT);
gtk_layout_set_adjustments (layout, hadjustment, vadjustment);
layout = g_object_new (GTK_TYPE_LAYOUT,
"hadjustment", hadjustment,
"vadjustment", vadjustment,
NULL);
return GTK_WIDGET (layout);
}
......@@ -175,6 +181,12 @@ gtk_layout_get_vadjustment (GtkLayout *layout)
return layout->vadjustment;
}
static GtkAdjustment *
new_default_adjustment (void)
{
return GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
}
static void
gtk_layout_set_adjustments (GtkLayout *layout,
GtkAdjustment *hadj,
......@@ -186,12 +198,12 @@ gtk_layout_set_adjustments (GtkLayout *layout,
if (hadj)
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
else
hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
else if (layout->hadjustment)
hadj = new_default_adjustment ();
if (vadj)
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
else
vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
else if (layout->vadjustment)
vadj = new_default_adjustment ();
if (layout->hadjustment && (layout->hadjustment != hadj))
{
......@@ -210,6 +222,7 @@ gtk_layout_set_adjustments (GtkLayout *layout,
layout->hadjustment = hadj;
gtk_object_ref (GTK_OBJECT (layout->hadjustment));
gtk_object_sink (GTK_OBJECT (layout->hadjustment));
gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width);
gtk_signal_connect (GTK_OBJECT (layout->hadjustment), "value_changed",
(GtkSignalFunc) gtk_layout_adjustment_changed,
......@@ -222,6 +235,7 @@ gtk_layout_set_adjustments (GtkLayout *layout,
layout->vadjustment = vadj;
gtk_object_ref (GTK_OBJECT (layout->vadjustment));
gtk_object_sink (GTK_OBJECT (layout->vadjustment));
gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height);
gtk_signal_connect (GTK_OBJECT (layout->vadjustment), "value_changed",
(GtkSignalFunc) gtk_layout_adjustment_changed,
......@@ -229,7 +243,9 @@ gtk_layout_set_adjustments (GtkLayout *layout,
need_adjust = TRUE;
}
if (need_adjust)
/* vadj or hadj can be NULL while constructing; don't emit a signal
then */
if (need_adjust && vadj && hadj)
gtk_layout_adjustment_changed (NULL, layout);
}
......@@ -458,8 +474,10 @@ gtk_layout_set_size (GtkLayout *layout,
}
g_object_thaw_notify (G_OBJECT (layout));
gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width);
gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height);
if (layout->hadjustment)
gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width);
if (layout->vadjustment)
gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height);
if (GTK_WIDGET_REALIZED (layout))
{
......@@ -568,6 +586,7 @@ gtk_layout_class_init (GtkLayoutClass *class)
gobject_class->set_property = gtk_layout_set_property;
gobject_class->get_property = gtk_layout_get_property;
gobject_class->finalize = gtk_layout_finalize;
gobject_class->constructor = gtk_layout_constructor;
container_class->set_child_property = gtk_layout_set_child_property;
container_class->get_child_property = gtk_layout_get_child_property;
......@@ -780,6 +799,30 @@ gtk_layout_init (GtkLayout *layout)
layout->freeze_count = 0;
}
static GObject *
gtk_layout_constructor (GType type,
guint n_properties,
GObjectConstructParam *properties)
{
GtkLayout *layout;
GObject *object;
GtkAdjustment *hadj, *vadj;
object = G_OBJECT_CLASS (parent_class)->constructor (type,
n_properties,
properties);
layout = GTK_LAYOUT (object);
hadj = layout->hadjustment ? layout->hadjustment : new_default_adjustment ();
vadj = layout->vadjustment ? layout->vadjustment : new_default_adjustment ();
if (!layout->hadjustment || !layout->vadjustment)
gtk_layout_set_adjustments (layout, hadj, vadj);
return object;
}
/* Widget methods
*/
......
......@@ -264,7 +264,6 @@ static gboolean validate_rows_handler (GtkTreeView *tree_view);
static gboolean presize_handler_callback (gpointer data);
static void install_presize_handler (GtkTreeView *tree_view);
static void gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view);
static void gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view);
/* Internal functions */
......@@ -3077,7 +3076,6 @@ static gboolean
gtk_tree_view_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkWidget *search_dialog;
GtkTreeView *tree_view;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
......@@ -3225,8 +3223,6 @@ validate_visible_area (GtkTreeView *tree_view)
gint y, height, offset;
gboolean validated_area = FALSE;
gboolean size_changed = FALSE;
gint height_above;
gint height_below;
if (tree_view->priv->tree == NULL)
return;
......@@ -3494,21 +3490,6 @@ gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view)
gtk_tree_path_free (path);
}
static void
gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view)
{
GtkTreePath *path;
GtkRBTree *tree;
GtkRBNode *node;
path = gtk_tree_row_reference_get_path (tree_view->priv->top_row);
if (_gtk_tree_view_find_node (tree_view, path, &tree, &node) &&
tree != NULL)
{
}
}
void
_gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view)
{
......@@ -9255,7 +9236,7 @@ static void
gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog,
GtkTreeView *tree_view)
{
GtkEntry *entry = (GtkWidget *)(gtk_container_get_children (GTK_CONTAINER (search_dialog)))->data;
GtkEntry *entry = (GtkEntry *)(gtk_container_get_children (GTK_CONTAINER (search_dialog)))->data;
gint *selected_iter;
if (entry)
......@@ -9264,7 +9245,7 @@ gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog,
focus_event.type = GDK_FOCUS_CHANGE;
focus_event.in = FALSE;
gtk_widget_event (entry, (GdkEvent *) &focus_event);
gtk_widget_event (GTK_WIDGET (entry), (GdkEvent *) &focus_event);
}
/* remove data from tree_view */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment