libegg r860 - in trunk: . libegg/toolpalette
- From: hasselmm svn gnome org
- To: svn-commits-list gnome org
- Subject: libegg r860 - in trunk: . libegg/toolpalette
- Date: Thu, 27 Mar 2008 12:36:07 +0000 (GMT)
Author: hasselmm
Date: Thu Mar 27 12:36:06 2008
New Revision: 860
URL: http://svn.gnome.org/viewvc/libegg?rev=860&view=rev
Log:
Small build fixes for EggToolPalette.
* libegg/toolpalette/eggtoolitemgroup.c:
Allow compilation with -Werror and gtk trunk.
* libegg/toolpalette/eggtoolpalette.c,
libegg/toolpalette/eggtoolpalette.h:
Change signature of egg_tool_palette_get_drag_target_item()
and egg_tool_palette_get_drag_target_group() to return "const
GtkTargetEntry*", instead of GtkTargetEntry. Also add the
G_GNUC_CONST attribute to those functions.
Modified:
trunk/ChangeLog
trunk/libegg/toolpalette/eggtoolitemgroup.c
trunk/libegg/toolpalette/eggtoolpalette.c
trunk/libegg/toolpalette/eggtoolpalette.h
Modified: trunk/libegg/toolpalette/eggtoolitemgroup.c
==============================================================================
--- trunk/libegg/toolpalette/eggtoolitemgroup.c (original)
+++ trunk/libegg/toolpalette/eggtoolitemgroup.c Thu Mar 27 12:36:06 2008
@@ -302,6 +302,17 @@
return GTK_ORIENTATION_VERTICAL;
}
+static GtkToolbarStyle
+egg_tool_item_group_get_style (EggToolItemGroup *group)
+{
+ GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (group));
+
+ if (EGG_IS_TOOL_PALETTE (parent))
+ return egg_tool_palette_get_style (EGG_TOOL_PALETTE (parent));
+
+ return GTK_TOOLBAR_ICONS;
+}
+
#endif /* GTK_TOOL_SHELL */
static void
@@ -369,14 +380,16 @@
guint i;
GtkOrientation orientation;
- GtkToolbarStyle style = GTK_TOOLBAR_ICONS;
+ GtkToolbarStyle style;
GTK_WIDGET_CLASS (egg_tool_item_group_parent_class)->size_allocate (widget, allocation);
#ifdef GTK_TOOL_SHELL
- style = egg_tool_item_group_get_style (group);
+ orientation = egg_tool_item_group_get_orientation (GTK_TOOL_SHELL (group));
+ style = egg_tool_item_group_get_style (GTK_TOOL_SHELL (group));
#else /* GTK_TOOL_SHELL */
- orientation = egg_tool_item_group_get_orientation (group);
+ orientation = egg_tool_item_group_get_orientation (group);
+ style = egg_tool_item_group_get_style (group);
#endif
egg_tool_item_group_get_item_size (group, &item_size);
@@ -967,7 +980,11 @@
g_return_val_if_fail (EGG_IS_TOOL_ITEM_GROUP (group), NULL);
allocation = >K_WIDGET (group)->allocation;
+#ifdef GTK_TOOL_SHELL
+ orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
+#else
orientation = egg_tool_item_group_get_orientation (group);
+#endif
g_return_val_if_fail (x >= 0 && x < allocation->width, NULL);
g_return_val_if_fail (y >= 0 && y < allocation->height, NULL);
Modified: trunk/libegg/toolpalette/eggtoolpalette.c
==============================================================================
--- trunk/libegg/toolpalette/eggtoolpalette.c (original)
+++ trunk/libegg/toolpalette/eggtoolpalette.c Thu Mar 27 12:36:06 2008
@@ -70,22 +70,12 @@
static GdkAtom dnd_target_atom_item = GDK_NONE;
static GdkAtom dnd_target_atom_group = GDK_NONE;
-static GtkTargetEntry dnd_targets[] =
+static const GtkTargetEntry dnd_targets[] =
{
{ "application/x-egg-tool-palette-item", GTK_TARGET_SAME_APP, 0 },
{ "application/x-egg-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
};
-GtkTargetEntry egg_tool_palette_get_drag_target_item ()
-{
- return dnd_targets[0];
-}
-
-GtkTargetEntry egg_tool_palette_get_drag_target_group ()
-{
- return dnd_targets[1];
-}
-
G_DEFINE_TYPE (EggToolPalette,
egg_tool_palette,
GTK_TYPE_CONTAINER);
@@ -94,8 +84,8 @@
egg_tool_palette_init (EggToolPalette *palette)
{
palette->priv = G_TYPE_INSTANCE_GET_PRIVATE (palette,
- EGG_TYPE_TOOL_PALETTE,
- EggToolPalettePrivate);
+ EGG_TYPE_TOOL_PALETTE,
+ EggToolPalettePrivate);
palette->priv->groups_size = 4;
palette->priv->groups_length = 0;
@@ -791,7 +781,7 @@
}
GtkWidget*
-egg_tool_palette_get_drag_item (EggToolPalette *palette,
+egg_tool_palette_get_drag_item (EggToolPalette *palette,
const GtkSelectionData *selection)
{
EggToolPaletteDragData *data;
@@ -962,3 +952,16 @@
palette);
}
}
+
+G_CONST_RETURN GtkTargetEntry*
+egg_tool_palette_get_drag_target_item (void)
+{
+ return &dnd_targets[0];
+}
+
+G_CONST_RETURN GtkTargetEntry*
+egg_tool_palette_get_drag_target_group (void)
+{
+ return &dnd_targets[1];
+}
+
Modified: trunk/libegg/toolpalette/eggtoolpalette.h
==============================================================================
--- trunk/libegg/toolpalette/eggtoolpalette.h (original)
+++ trunk/libegg/toolpalette/eggtoolpalette.h Thu Mar 27 12:36:06 2008
@@ -61,44 +61,45 @@
GtkAdjustment *vadjustment);
};
-GType egg_tool_palette_get_type (void) G_GNUC_CONST;
-GtkWidget* egg_tool_palette_new (void);
+GType egg_tool_palette_get_type (void) G_GNUC_CONST;
+GtkWidget* egg_tool_palette_new (void);
-void egg_tool_palette_set_group_position (EggToolPalette *palette,
- GtkWidget *group,
- gint position);
-gint egg_tool_palette_get_group_position (EggToolPalette *palette,
- GtkWidget *group);
-
-void egg_tool_palette_set_icon_size (EggToolPalette *palette,
- GtkIconSize icon_size);
-void egg_tool_palette_set_orientation (EggToolPalette *palette,
- GtkOrientation orientation);
-void egg_tool_palette_set_style (EggToolPalette *palette,
- GtkToolbarStyle style);
-
-GtkIconSize egg_tool_palette_get_icon_size (EggToolPalette *palette);
-GtkOrientation egg_tool_palette_get_orientation (EggToolPalette *palette);
-GtkToolbarStyle egg_tool_palette_get_style (EggToolPalette *palette);
-
-GtkToolItem* egg_tool_palette_get_drop_item (EggToolPalette *palette,
- gint x,
- gint y);
-GtkWidget* egg_tool_palette_get_drop_group (EggToolPalette *palette,
- gint x,
- gint y);
-GtkWidget* egg_tool_palette_get_drag_item (EggToolPalette *palette,
- const GtkSelectionData *selection);
-
-void egg_tool_palette_set_drag_source (EggToolPalette *palette);
-void egg_tool_palette_add_drag_dest (EggToolPalette *palette,
- GtkWidget *widget,
- GtkDestDefaults flags,
- EggToolPaletteDragTargets targets,
- GdkDragAction actions);
+void egg_tool_palette_set_group_position (EggToolPalette *palette,
+ GtkWidget *group,
+ gint position);
+gint egg_tool_palette_get_group_position (EggToolPalette *palette,
+ GtkWidget *group);
+
+void egg_tool_palette_set_icon_size (EggToolPalette *palette,
+ GtkIconSize icon_size);
+void egg_tool_palette_set_orientation (EggToolPalette *palette,
+ GtkOrientation orientation);
+void egg_tool_palette_set_style (EggToolPalette *palette,
+ GtkToolbarStyle style);
+
+GtkIconSize egg_tool_palette_get_icon_size (EggToolPalette *palette);
+GtkOrientation egg_tool_palette_get_orientation (EggToolPalette *palette);
+GtkToolbarStyle egg_tool_palette_get_style (EggToolPalette *palette);
+
+GtkToolItem* egg_tool_palette_get_drop_item (EggToolPalette *palette,
+ gint x,
+ gint y);
+GtkWidget* egg_tool_palette_get_drop_group (EggToolPalette *palette,
+ gint x,
+ gint y);
+GtkWidget* egg_tool_palette_get_drag_item (EggToolPalette *palette,
+ const GtkSelectionData *selection);
+
+void egg_tool_palette_set_drag_source (EggToolPalette *palette);
+void egg_tool_palette_add_drag_dest (EggToolPalette *palette,
+ GtkWidget *widget,
+ GtkDestDefaults flags,
+ EggToolPaletteDragTargets targets,
+ GdkDragAction actions);
+
+G_CONST_RETURN GtkTargetEntry* egg_tool_palette_get_drag_target_item (void) G_GNUC_CONST;
+G_CONST_RETURN GtkTargetEntry* egg_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
-GtkTargetEntry egg_tool_palette_get_drag_target_item ();
-GtkTargetEntry egg_tool_palette_get_drag_target_group ();
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]