Re: status bars and strangeness



On Sat, 2005-07-09 at 14:18 +0400, Nickolay V. Shmyrev wrote:

> The control node can have behavior attribute. In theory it can support
> some packing option selection, but currently it handles only pack-start
> substring.

I would like to suggest the addition of an 'expand' and a 'fill'
attribute.

> Look at the following code in bonobo-ui-sync-statusbar.c:
> ---------------------------------------------------------------------------
>         } else if (bonobo_ui_node_has_name (node, "control")) {
>                 char *behavior;
>                 char **behavior_array;
> 
>                 widget = bonobo_ui_engine_build_control (sync->engine,
> node);
>                 if (widget) {
			gboolean expand;
			gboolean fill;
>                         behavior_array = NULL;
>                         if ((behavior = bonobo_ui_engine_get_attr (node,
> cmd_node, "behavior"))) {
>                                 behavior_array = g_strsplit (behavior,
> ",", -1);
>                                 bonobo_ui_node_free_string (behavior);
>                         }
> 
			expand = string_array_contains (behavior_array,
					"expand");
			fill = string_array_contains (behavior_array,
					"fill");
>                         if (behavior_array != NULL &&
>                             string_array_contains (behavior_array,
> "pack-start"))
>                                 gtk_box_pack_start (GTK_BOX (parent),
> widget,
>                                                     expand, fill, 0);
>                         else
>                                 gtk_box_pack_end (GTK_BOX (parent),
> widget,
>                                                   expand, fill, 0);
> 
>                         g_strfreev (behavior_array);
>                 }
>         }

This is 100% untested, as I just wrote it inside this email. I would
have sent a patch, but I don't have CVS access at the moment.

Alternatively, I suppose you could also have something like
'pack-defaults', which uses gtk_box_pack_{start,end}_defaults(), but
that would be significantly less flexible and generic.

Thoughts? This would be very useful to get into 2.12, as I can't see any
other way to achieve what I want.

--d




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]