]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktoolpalette.c
Change FSF Address
[~andy/gtk] / gtk / gtktoolpalette.c
index e35bf813f89e47a575bedcd5f58d5a0a48105737..be6297ab19907473f7a3b0c19134ccd69338d759 100644 (file)
@@ -12,8 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  *
  * Authors:
  *      Mathias Hasselmann
@@ -29,6 +28,7 @@
 #include "gtktypebuiltins.h"
 #include "gtkprivate.h"
 #include "gtkscrollable.h"
+#include "gtkorientableprivate.h"
 #include "gtkintl.h"
 
 #define DEFAULT_ICON_SIZE       GTK_ICON_SIZE_SMALL_TOOLBAR
@@ -263,6 +263,7 @@ gtk_tool_palette_set_property (GObject      *object,
         if ((guint) g_value_get_enum (value) != palette->priv->orientation)
           {
             palette->priv->orientation = g_value_get_enum (value);
+            _gtk_orientable_set_style_classes (GTK_ORIENTABLE (palette));
             gtk_tool_palette_reconfigured (palette);
           }
         break;
@@ -524,6 +525,8 @@ gtk_tool_palette_size_allocate (GtkWidget     *widget,
       GtkToolItemGroupInfo *group = g_ptr_array_index (palette->priv->groups, i);
       gint size;
 
+      group_sizes[i] = 0;
+
       if (!group->widget)
         continue;
 
@@ -694,38 +697,6 @@ gtk_tool_palette_size_allocate (GtkWidget     *widget,
     }
 }
 
-static gboolean
-gtk_tool_palette_draw (GtkWidget      *widget,
-                       cairo_t        *cr)
-{
-  GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
-  GdkDisplay *display;
-  GdkWindow *window;
-  guint i;
-
-  window = gtk_widget_get_window (widget);
-
-  display = gdk_window_get_display (window);
-
-  if (!gdk_display_supports_composite (display))
-    return FALSE;
-
-  cairo_push_group (cr);
-
-  for (i = 0; i < palette->priv->groups->len; ++i)
-  {
-    GtkToolItemGroupInfo *info = g_ptr_array_index (palette->priv->groups, i);
-    if (info->widget)
-      _gtk_tool_item_group_paint (info->widget, cr);
-  }
-
-  cairo_pop_group_to_source (cr);
-
-  cairo_paint (cr);
-
-  return FALSE;
-}
-
 static void
 gtk_tool_palette_realize (GtkWidget *widget)
 {
@@ -829,15 +800,21 @@ gtk_tool_palette_forall (GtkContainer *container,
                          gpointer      callback_data)
 {
   GtkToolPalette *palette = GTK_TOOL_PALETTE (container);
-  guint i;
-
+  guint i, len;
 
   for (i = 0; i < palette->priv->groups->len; ++i)
     {
       GtkToolItemGroupInfo *info = g_ptr_array_index (palette->priv->groups, i);
+
+      len = palette->priv->groups->len;
+
       if (info->widget)
         callback (GTK_WIDGET (info->widget),
                   callback_data);
+
+      /* At destroy time, 'callback' results in removing a widget,
+       * here we just reset the current index to account for the removed widget. */
+      i -= (len - palette->priv->groups->len);
     }
 }
 
@@ -991,7 +968,6 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
   wclass->get_preferred_width = gtk_tool_palette_get_preferred_width;
   wclass->get_preferred_height= gtk_tool_palette_get_preferred_height;
   wclass->size_allocate       = gtk_tool_palette_size_allocate;
-  wclass->draw                = gtk_tool_palette_draw;
   wclass->realize             = gtk_tool_palette_realize;
 
   cclass->add                 = gtk_tool_palette_add;
@@ -1906,7 +1882,7 @@ _gtk_tool_palette_child_set_drag_source (GtkWidget *child,
  *
  * Since: 2.20
  */
-G_CONST_RETURN GtkTargetEntry*
+const GtkTargetEntry*
 gtk_tool_palette_get_drag_target_item (void)
 {
   return &dnd_targets[0];
@@ -1921,7 +1897,7 @@ gtk_tool_palette_get_drag_target_item (void)
  *
  * Since: 2.20
  */
-G_CONST_RETURN GtkTargetEntry*
+const GtkTargetEntry*
 gtk_tool_palette_get_drag_target_group (void)
 {
   return &dnd_targets[1];
@@ -1980,7 +1956,7 @@ gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
                     G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
                     palette);
   priv->hadjustment = g_object_ref_sink (adjustment);
-  /* FIXME: Adjustment should probably have it's values updated now */
+  /* FIXME: Adjustment should probably have its values updated now */
   g_object_notify (G_OBJECT (palette), "hadjustment");
 }
 
@@ -2029,7 +2005,7 @@ gtk_tool_palette_set_vadjustment (GtkToolPalette *palette,
                     G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
                     palette);
   priv->vadjustment = g_object_ref_sink (adjustment);
-  /* FIXME: Adjustment should probably have it's values updated now */
+  /* FIXME: Adjustment should probably have its values updated now */
   g_object_notify (G_OBJECT (palette), "vadjustment");
 }