appDisplay: Reimplement well layout to be width-independent

Use ShellGenericContainer to implement a fully dynamic layout
for the application well.  It's still fixed to 4 columns by default,
but no longer requires a fixed width to be passed in on start.

With another chunk of work, it could likely try to adjust to
the case where we can only fit fewer than 4 items in the well.

Remove the border highlighting on mouseover, since that caused
reallocations, and the grid layout isn't trivial.

Delete the unused shell_global_get_word_with function.
This commit is contained in:
Colin Walters
2009-08-06 15:39:09 -04:00
parent 687a87d3d0
commit ebd6f4bc8f
4 changed files with 241 additions and 170 deletions

View File

@ -911,43 +911,3 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
return clutter_clone_new (global->root_pixmap);
}
/**
* shell_global_get_max_word_width:
* @global:
* @ref: Actor to use for font information
* @text: Text to analyze
* @font: Given font size to use
*
* Compute the largest pixel size among the individual words in text, when
* rendered in the given font.
*/
guint
shell_global_get_max_word_width (ShellGlobal *global, ClutterActor *ref, const char *text, const char *font)
{
PangoLayout *layout;
PangoFontDescription *fontdesc;
char **components;
char **iter;
gint max;
layout = clutter_actor_create_pango_layout (ref, NULL);
fontdesc = pango_font_description_from_string (font);
pango_layout_set_font_description (layout, fontdesc);
pango_font_description_free (fontdesc);
max = 0;
components = g_strsplit (text, " ", 0);
for (iter = components; *iter; iter++)
{
char *component = *iter;
gint width, height;
pango_layout_set_text (layout, component, -1);
pango_layout_get_pixel_size (layout, &width, &height);
if (width > max)
max = width;
}
g_object_unref (layout);
g_strfreev (components);
return (guint)max;
}

View File

@ -73,8 +73,6 @@ void shell_global_format_time_relative_pretty (ShellGlobal *global, guint delta,
ClutterActor *shell_global_create_root_pixmap_actor (ShellGlobal *global);
guint shell_global_get_max_word_width (ShellGlobal *global, ClutterActor *ref, const char *text, const char *font);
G_END_DECLS
#endif /* __SHELL_GLOBAL_H__ */