summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2006-05-16 13:51:30 +0000
committerMichael Natterer <mitch@src.gnome.org>2006-05-16 13:51:30 +0000
commit61fe062e42449fdc09f1e4d4beea70e339367b31 (patch)
tree858827873d3167575e3b6179c452b01f504a5044
parent014e448e09fab941c9cf35de4296caab93d1b825 (diff)
downloadgtk+-61fe062e42449fdc09f1e4d4beea70e339367b31.tar.gz
added "max-child-expand" style property which limits the space taken by
2006-05-16 Michael Natterer <mitch@imendio.com> * gtk/gtktoolbar.c: added "max-child-expand" style property which limits the space taken by expanding tool items. Fixes bug #340722.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-2-105
-rw-r--r--gtk/gtktoolbar.c31
3 files changed, 38 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 33be26c106..71512ccace 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-16 Michael Natterer <mitch@imendio.com>
+
+ * gtk/gtktoolbar.c: added "max-child-expand" style property which
+ limits the space taken by expanding tool items. Fixes bug #340722.
+
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 33be26c106..71512ccace 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,8 @@
+2006-05-16 Michael Natterer <mitch@imendio.com>
+
+ * gtk/gtktoolbar.c: added "max-child-expand" style property which
+ limits the space taken by expanding tool items. Fixes bug #340722.
+
2006-05-16 Kristian Rietveld <kris@imendio.com>
* gtk/gtkpathbar.c (gtk_path_bar_dispose): cancel all pending handles
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 5fea5c8c8b..7f384d9828 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -57,7 +57,7 @@
typedef struct _ToolbarContent ToolbarContent;
-#define DEFAULT_IPADDING 0
+#define DEFAULT_IPADDING 0
#define DEFAULT_SPACE_SIZE 12
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
@@ -233,6 +233,7 @@ static gboolean gtk_toolbar_check_old_api (GtkToolbar *toolbar
static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
static gint get_internal_padding (GtkToolbar *toolbar);
+static gint get_max_child_expand (GtkToolbar *toolbar);
static GtkShadowType get_shadow_type (GtkToolbar *toolbar);
static gint get_space_size (GtkToolbar *toolbar);
static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
@@ -591,7 +592,16 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
G_MAXINT,
DEFAULT_IPADDING,
GTK_PARAM_READABLE));
-
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("max-child-expand",
+ P_("Maximum toolbar item spacing"),
+ P_("Maximum space between the toolbar items."),
+ 0,
+ G_MAXINT,
+ G_MAXINT,
+ GTK_PARAM_READABLE));
+
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("space-style",
P_("Space style"),
@@ -1596,10 +1606,14 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
if (toolbar_content_get_expand (content) && new_states[i] == NORMAL)
{
+ gint mexpand = get_max_child_expand (toolbar);
gint extra = size / n_expand_items;
if (size % n_expand_items != 0)
extra++;
-
+
+ if (extra > mexpand)
+ extra = mexpand;
+
allocations[i].width += extra;
size -= extra;
n_expand_items--;
@@ -4751,6 +4765,17 @@ get_internal_padding (GtkToolbar *toolbar)
return ipadding;
}
+static gint
+get_max_child_expand (GtkToolbar *toolbar)
+{
+ gint mexpand = G_MAXINT;
+
+ gtk_widget_style_get (GTK_WIDGET (toolbar),
+ "max-child-expand", &mexpand,
+ NULL);
+ return mexpand;
+}
+
static GtkShadowType
get_shadow_type (GtkToolbar *toolbar)
{