[gtk+] gtk: fix tool palette scroll adjustment setting
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk: fix tool palette scroll adjustment setting
- Date: Fri, 22 Oct 2010 15:03:48 +0000 (UTC)
commit 8e7aed94898e09ce29ffcccc7fe7632ae9d6e02b
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 22 17:01:58 2010 +0200
gtk: fix tool palette scroll adjustment setting
Create a new adjustment if there was *no* adjustment passed in, not
the other way around. Also remove unused function
gtk_tool_palette_set_adjustment().
gtk/gtktoolpalette.c | 48 ++----------------------------------------------
1 files changed, 2 insertions(+), 46 deletions(-)
---
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 0359fcf..fa60619 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -751,50 +751,6 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
}
static void
-gtk_tool_palette_set_adjustment (GtkToolPalette *palette,
- GtkOrientation orientation,
- GtkAdjustment *adjustment)
-{
- GtkAdjustment **adj_ptr;
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (adjustment && palette->priv->hadjustment == adjustment)
- return;
-
- adj_ptr = &palette->priv->hadjustment;
- }
- else
- {
- if (adjustment && palette->priv->vadjustment == adjustment)
- return;
-
- adj_ptr = &palette->priv->vadjustment;
- }
-
- /* Disconnect handler */
- if (*adj_ptr)
- {
- g_signal_handlers_disconnect_by_func (*adj_ptr,
- gtk_tool_palette_adjustment_value_changed,
- palette);
- g_object_unref (*adj_ptr);
- }
-
- /* Ensure adjustment */
- if (!adjustment)
- adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0));
-
- /* Connect signal handler */
- g_signal_connect (adjustment, "value-changed",
- G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
- palette);
- *adj_ptr = g_object_ref_sink (adjustment);
- /* FIXME: Adjustment should probably have it's values updated now */
-}
-
-static void
gtk_tool_palette_add (GtkContainer *container,
GtkWidget *child)
{
@@ -1977,7 +1933,7 @@ gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
g_object_unref (priv->hadjustment);
}
- if (adjustment != NULL)
+ if (adjustment == NULL)
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
0.0, 0.0, 0.0);
@@ -2026,7 +1982,7 @@ gtk_tool_palette_set_vadjustment (GtkToolPalette *palette,
g_object_unref (priv->vadjustment);
}
- if (adjustment != NULL)
+ if (adjustment == NULL)
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
0.0, 0.0, 0.0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]