libegg r880 - in trunk: . libegg/toolpalette
- From: jap svn gnome org
- To: svn-commits-list gnome org
- Subject: libegg r880 - in trunk: . libegg/toolpalette
- Date: Sun, 1 Jun 2008 09:45:44 +0000 (UTC)
Author: jap
Date: Sun Jun 1 09:45:43 2008
New Revision: 880
URL: http://svn.gnome.org/viewvc/libegg?rev=880&view=rev
Log:
2008-06-01 Jan Arne Petersen <jpetersen openismus com>
Use some extended ToolShell features as proposed in the TODO, requires
patch for gtk+ from #535090 (to activate the use of this features,
define HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090) (#535095).
* libegg/toolpalette/eggtoolitemgroup.c
(egg_tool_item_group_get_icon_size,
egg_tool_item_group_get_ellipsize_mode,
egg_tool_item_group_get_text_alignment,
egg_tool_item_group_get_text_orientation,
egg_tool_item_group_get_text_size_group,
egg_tool_item_group_tool_shell_init,
egg_tool_item_group_set_ellipsize):
* libegg/toolpalette/eggtoolpalette.c (expanding_child,
text_size_group, egg_tool_palette_init, egg_tool_palette_dispose,
_egg_tool_palette_set_expanding_child,
_egg_tool_palette_get_size_group):
* libegg/toolpalette/eggtoolpaletteprivate.h
(__EGG_TOOL_PALETTE_PRIVATE_H__,
HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090):
* libegg/toolpalette/testtoolpalette.c (load_stock_items):
Modified:
trunk/ChangeLog
trunk/libegg/toolpalette/eggtoolitemgroup.c
trunk/libegg/toolpalette/eggtoolpalette.c
trunk/libegg/toolpalette/eggtoolpaletteprivate.h
trunk/libegg/toolpalette/testtoolpalette.c
Modified: trunk/libegg/toolpalette/eggtoolitemgroup.c
==============================================================================
--- trunk/libegg/toolpalette/eggtoolitemgroup.c (original)
+++ trunk/libegg/toolpalette/eggtoolitemgroup.c Sun Jun 1 09:45:43 2008
@@ -153,12 +153,66 @@
return GTK_ICON_SIZE_SMALL_TOOLBAR;
}
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+
+static PangoEllipsizeMode
+egg_tool_item_group_get_ellipsize_mode (GtkToolShell *shell)
+{
+ return EGG_TOOL_ITEM_GROUP (shell)->priv->ellipsize;
+}
+
+static gfloat
+egg_tool_item_group_get_text_alignment (GtkToolShell *shell)
+{
+ if (GTK_TOOLBAR_TEXT == egg_tool_item_group_get_style (shell) ||
+ GTK_TOOLBAR_BOTH_HORIZ == egg_tool_item_group_get_style (shell))
+ return 0.0;
+
+ return 0.5;
+}
+
+static GtkOrientation
+egg_tool_item_group_get_text_orientation (GtkToolShell *shell)
+{
+ GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
+
+ if (EGG_IS_TOOL_PALETTE (parent))
+ {
+ GtkOrientation orientation = egg_tool_palette_get_orientation (EGG_TOOL_PALETTE (parent));
+ if (GTK_ORIENTATION_HORIZONTAL == orientation &&
+ (GTK_TOOLBAR_TEXT == egg_tool_item_group_get_style (shell)/* ||
+ GTK_TOOLBAR_BOTH_HORIZ == egg_tool_item_group_get_style (shell)*/))
+ return GTK_ORIENTATION_VERTICAL;
+ }
+
+ return GTK_ORIENTATION_HORIZONTAL;
+}
+
+static GtkSizeGroup *
+egg_tool_item_group_get_text_size_group (GtkToolShell *shell)
+{
+ GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
+
+ if (EGG_IS_TOOL_PALETTE (parent))
+ return _egg_tool_palette_get_size_group (EGG_TOOL_PALETTE (parent));
+
+ return NULL;
+}
+
+#endif
+
static void
egg_tool_item_group_tool_shell_init (GtkToolShellIface *iface)
{
iface->get_icon_size = egg_tool_item_group_get_icon_size;
iface->get_orientation = egg_tool_item_group_get_orientation;
iface->get_style = egg_tool_item_group_get_style;
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+ iface->get_text_alignment = egg_tool_item_group_get_text_alignment;
+ iface->get_text_orientation = egg_tool_item_group_get_text_orientation;
+ iface->get_text_size_group = egg_tool_item_group_get_text_size_group;
+ iface->get_ellipsize_mode = egg_tool_item_group_get_ellipsize_mode;
+#endif
}
#endif /* GTK_TYPE_TOOL_SHELL */
@@ -1291,6 +1345,9 @@
group->priv->ellipsize = ellipsize;
egg_tool_item_group_header_adjust_style (group);
g_object_notify (G_OBJECT (group), "ellipsize");
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+ _egg_tool_item_group_palette_reconfigured (group);
+#endif
}
}
@@ -1633,4 +1690,3 @@
egg_tool_item_group_header_adjust_style (group);
}
-
Modified: trunk/libegg/toolpalette/eggtoolpalette.c
==============================================================================
--- trunk/libegg/toolpalette/eggtoolpalette.c (original)
+++ trunk/libegg/toolpalette/eggtoolpalette.c Sun Jun 1 09:45:43 2008
@@ -79,6 +79,10 @@
GtkWidget *expanding_child;
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+ GtkSizeGroup *text_size_group;
+#endif
+
guint sparse_groups : 1;
guint drag_source : 1;
};
@@ -116,6 +120,10 @@
palette->priv->icon_size = DEFAULT_ICON_SIZE;
palette->priv->orientation = DEFAULT_ORIENTATION;
palette->priv->style = DEFAULT_TOOLBAR_STYLE;
+
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+ palette->priv->text_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+#endif
}
static void
@@ -229,6 +237,14 @@
}
}
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+ if (palette->priv->text_size_group)
+ {
+ g_object_unref (palette->priv->text_size_group);
+ palette->priv->text_size_group = NULL;
+ }
+#endif
+
G_OBJECT_CLASS (egg_tool_palette_parent_class)->dispose (object);
}
@@ -1328,3 +1344,13 @@
palette->priv->expanding_child = widget;
}
+
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+GtkSizeGroup *
+_egg_tool_palette_get_size_group (EggToolPalette *palette)
+{
+ g_return_val_if_fail (EGG_IS_TOOL_PALETTE (palette), NULL);
+
+ return palette->priv->text_size_group;
+}
+#endif
Modified: trunk/libegg/toolpalette/eggtoolpaletteprivate.h
==============================================================================
--- trunk/libegg/toolpalette/eggtoolpaletteprivate.h (original)
+++ trunk/libegg/toolpalette/eggtoolpaletteprivate.h Sun Jun 1 09:45:43 2008
@@ -24,6 +24,7 @@
#include "eggtoolpalette.h"
#include "eggtoolitemgroup.h"
+#include <gtk/gtk.h>
void _egg_tool_palette_get_item_size (EggToolPalette *palette,
GtkRequisition *item_size);
@@ -46,4 +47,11 @@
gboolean vertical,
gboolean animation);
+#undef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+/* #define HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090 */
+
+#ifdef HAVE_EXTENDED_TOOL_SHELL_SUPPORT_BUG_535090
+GtkSizeGroup *_egg_tool_palette_get_size_group (EggToolPalette *palette);
+#endif
+
#endif /* __EGG_TOOL_PALETTE_PRIVATE_H__ */
Modified: trunk/libegg/toolpalette/testtoolpalette.c
==============================================================================
--- trunk/libegg/toolpalette/testtoolpalette.c (original)
+++ trunk/libegg/toolpalette/testtoolpalette.c Sun Jun 1 09:45:43 2008
@@ -420,6 +420,7 @@
item = gtk_tool_button_new_from_stock (id);
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
egg_tool_item_group_insert (EGG_TOOL_ITEM_GROUP (group), item, -1);
if (!gtk_stock_lookup (id, &stock_item) || !stock_item.label)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]