Commit Graph

184 Commits

Author SHA1 Message Date
Carlos Soriano
cc449228f3 iconGrid: Rename childrenInRow to columnsForWidth
Since the parameter of the function is the width, reflect that in
the function name. Also, since we are counting columns, not only
children for each row, reflect that in the function name also.

https://bugzilla.gnome.org/show_bug.cgi?id=706081
2013-09-02 18:57:36 +02:00
Carlos Soriano
3984c47867 iconGrid: Add PaginatedIconGrid
The new PaginatedIconGrid class acts as a container for pages.
So the new class provides  the container behaviour and some
useful functions like positions of pages, number of pages, etc.
But, it doesn't add indicators of the pages and doesn't manage
the scroll of the pages, neither any management of the pages
like in which page currently it is, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=706081
2013-09-02 18:57:36 +02:00
Carlos Soriano
cfb80266c2 iconGrid: Move spacing calculation to its own function
Move spacing calculation to a function, which makes
it reusable and overwritable by subclasses

https://bugzilla.gnome.org/show_bug.cgi?id=706081
2013-09-02 18:57:36 +02:00
Carlos Soriano
cc5198205d iconGrid: Split out _calculateChildBox
Split out the calculation of the child box in allocation function
to be reusable by subclasses and let the code be more modular

https://bugzilla.gnome.org/show_bug.cgi?id=706081
2013-09-02 18:57:36 +02:00
Giovanni Campagna
c1518dc728 IconGrid: don't ask for the children list when the number is enough
Clutter keeps the number of children cached, while the list must be
built every time.
2013-08-06 16:08:36 +02:00
Florian Müllner
5f61b57d63 iconGrid: Add fillParent property
Setting this property will only display as many icons as fit the parent's
allocation, rather than overflowing.

https://bugzilla.gnome.org/show_bug.cgi?id=694256
2013-02-22 09:46:30 +01:00
Jasper St. Pierre
aad5d98b43 iconGrid: Take extra spacing into account for height requests
This fixes the clipped app picker in the overview.

https://bugzilla.gnome.org/show_bug.cgi?id=694234
2013-02-20 19:38:38 -05:00
Adel Gadllah
b922035d4f iconGrid: Dynamically adjust spacing based on columnLimit
Adjust the spacing based on the available width when a columnLimit
is set to evenly place the icons.

https://bugzilla.gnome.org/show_bug.cgi?id=694215
2013-02-20 00:39:18 +01:00
Jasper St. Pierre
429f9e1d15 iconGrid: Only recreate icons when needed
Recreating icons on every style change -- like hover, can have
disasterous effects. Not only is the quick creation/destruction of
the actors bad, but adding/removing actors at runtime queues many
relayouts, which makes the whole system slower as a lot of unnecessary
reallocations are figured out.

While an optimization was here before, it was broken because it
broke high-contrast themes. Connect explicitly to the texture cache
to know when the icon theme has changed, instead of removing a valuable
optimization.

https://bugzilla.gnome.org/show_bug.cgi?id=672941
2012-12-13 21:35:05 -05:00
Rui Matos
29cb10fed8 iconGrid: Handle preferred height requests for infinite widths
Request enough height to fit all children in a single line instead of
requesting 0.

https://bugzilla.gnome.org/show_bug.cgi?id=679168
2012-12-03 12:43:46 -05:00
Jasper St. Pierre
196f6c241a appDisplay: Don't show apps in NoDisplay categories in the All view
We explicitly include NoDisplay applications in the ShellAppSystem because
we want app tracking for them, but we explicitly filter NoDisplay applications
out when showing them to the user because we don't want to show them to the
user. We also based our "All" apps view on a flattened list of apps. While
we did check for NoDisplay on the app item itself, we didn't check against
its parents. Refactor the app display view to not use a separate flat list
of applications, but instead a concatenation of all the applications in all
the loaded categories.

https://bugzilla.gnome.org/show_bug.cgi?id=658176
2012-06-11 13:55:59 -04:00
Jasper St. Pierre
c9296191a8 js: Remove unnecessary versions of clutter_actor_get_children
clutter_actor_get_children requires making a temporary GSList from
a linked list structure, and then creating a JS Array from that GSList.
For simple cases like the number of children, use clutter_actor_get_n_children.

https://bugzilla.gnome.org/show_bug.cgi?id=677426
2012-06-11 13:10:25 -04:00
Christian Weber
c1f51a7bf3 searchDisplay: Use the rowLimit we pass to the IconGrid
When displaying children, we need to make sure that we use the rowLimit
property that we pass to iconGrid, rather than assuming that it's
always MAX_SEARCH_RESULTS_ROWS in case some subclass (in an extension maybe)
wants to do something different.

https://bugzilla.gnome.org/show_bug.cgi?id=675527
2012-06-03 01:32:29 -04:00
Florian Müllner
b833aff3c8 baseIcon: Always recreate icon texture on style changes
Commit 26580f8f reintroduced an optimization on style changes to avoid
creating icons unconditionally. As this breaks icon theme changes (for
instance when toggling "High Contrast" in the universal access menu),
remove it again.

https://bugzilla.gnome.org/show_bug.cgi?id=672941
2012-04-13 11:12:24 +02:00
Jasper St. Pierre
15f881f967 st: Remove custom text direction stuff
Clutter has its own built-in system for managing text directions, like GTK+.
Convert over to use this.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
2012-02-28 08:14:06 -05:00
Florian Müllner
1c0c42e8e7 iconGrid: Split vertical/horizontal item size
IconGrid items used to be square, so a single size value made
perfect sense. However, as contact search uses rectangular items,
using a single size is wrong - the allocated height ends up twice
the size of the visible height, which is particularly visible if
another provider displays results below contact results.

https://bugzilla.gnome.org/show_bug.cgi?id=670148
2012-02-15 22:14:11 +01:00
Jasper St. Pierre
27b34992c6 iconGrid: Don't enter an infinite loop
If both spacing and -shell-grid-item-size are 0, as they would be with nothing
setting them, we enter an infinite loop where we try to compute the layout.
Avoid the situation entirely by defaulting -shell-grid-item-size to a sane
value instead of 0.

https://bugzilla.gnome.org/show_bug.cgi?id=662747
2012-02-07 17:40:22 -05:00
Giovanni Campagna
26580f8f2c IconGrid: don't force the size of the icon
Forcing the icon size will distort it unnecessarily, and will
in any case not work if showing an animation (which is a ClutterGroup).
Instead, set the size on the bin, and make it align its child
if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=666606
2011-12-20 19:25:52 +01:00
Giovanni Campagna
17c46c2452 Port everything to class framework
The last patch in the sequence. Every place that was previously
setting prototype has been ported to Lang.Class, to make code more
concise and allow for better toString().

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Giovanni Campagna
d6b6f814d3 Port all classes with inheritance to class framework
All classes that have at least one other derived class (and thus
benefit from the framework) have been now ported. These includes
NMDevice, SearchProvider, AltTab.SwitcherList, and some other
stuff around.

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Dan Winship
75b824d032 *.js: Make emacs modelines consistent
js2-mode is no longer developed and we recommend js-mode these days,
so switch the modelines to specify that, and make them consistent
across all files.

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:12 -04:00
Alejandro Piñeiro
6934e4db26 Setting StWidget::label-actor on some ui elements
Specifically:
  * Icons on Alt+Tab menu
  * Icons on Ctrl+Alt+Tab menu
  * Icons on the list of applications
2011-04-27 02:09:11 +02:00
Maxim Ermilov
12bd374477 searchDisplay: don't create useless SearchResult's
average constructing time for 1 SearchResult is 3 ms.
It give > 400 result on query like 'a' (on my machine).
https://bugzilla.gnome.org/show_bug.cgi?id=645313
2011-03-22 02:50:32 +03:00
Maxim Ermilov
9ef4cc0ab9 iconGrid: remove unused variable in _computeLayout
https://bugzilla.gnome.org/show_bug.cgi?id=645313
2011-03-22 02:50:25 +03:00
Florian Müllner
e01971eac7 base-icon: Always recreate icon texture on style changes
Currently the icon texture is only updated on style changes when
the icon size is set from CSS and differs from the previously used
icon size.
As the style change may have been triggered by an icon theme change,
textures that are created for themed icons should always be recreated;
given that this is the case for most uses (with the exception of
file thumbnails), recreate the icon texture unconditionally to avoid
complexity.

https://bugzilla.gnome.org/show_bug.cgi?id=643738
2011-03-03 23:14:32 +01:00
Florian Müllner
a78e75775d base-icon: Enforce the requested icon size
Mainly due to StTextureCache's way of handling fallback icons, an
implementation of BaseIcon.createIcon() may return an icon smaller
than the requested size. Given that BaseIcon is not used for isolated
elements, but rather for groups of related items (App view, Dash,
Search Results, ...), having some elements end up with the wrong
size is more annoying than having some elements end up ugly due to
scaling, so explicitly enforce the requested icon size.

https://bugzilla.gnome.org/show_bug.cgi?id=642043
2011-02-26 00:06:44 +01:00
Owen W. Taylor
01b646169c Fix fuzziness for application icons
- Center the icon texture in the area allocated for it, and always give
  the nominal size - avoid off-by-one scaling if the parent allocated
  a little less or more size than we wanted.
- Use Math.floor() when centering horizontally to avoid allocation
  at a half pixel.

https://bugzilla.gnome.org/show_bug.cgi?id=642124
2011-02-11 16:21:11 -05:00
Florian Müllner
8cf9b5e5d2 base-icon: Add an option to not show the label
Currently there is a serious problem with ellipsization in various
parts of the overview. While wrapping the label or giving it more
space may be appropriate approaches for the application view, neither
works very well for the dash - possibly the best option there is to
not show the label at all.
So add a constructor parameter to BaseIcon to allow hiding the
label.

https://bugzilla.gnome.org/show_bug.cgi?id=636156
2011-02-09 21:36:54 +01:00
Maxim Ermilov
dafaab66b1 iconGrid: Exclude hidden children from the layout
As all children were considered for the grid's layout, hidden items showed up as
empty space. Instead, exclude hidden children from the layout, so that the grid is
only made up of visible items.

https://bugzilla.gnome.org/show_bug.cgi?id=631537
2010-12-18 22:23:38 +03:00
Dan Winship
8886b7433c StThemeNode: simplify use of get_color/get_double/get_length
Although within St itself there are situations where the semantics of
these functions (return TRUE or FALSE and return the actual value in
an out parameter) is useful, it's mostly just annoying at the
application level, where you generally know that the CSS property is
going to specified, and there is no especially sane fallback if it's
not.

So rename the current methods to lookup_color, lookup_double, and
lookup_length, and add new get_color, get_double, and get_length
methods that don't take an "inherit" parameter, and return their
values directly. (Well, except for get_color, due to the lack of (out
caller-allocates) in gjs.)

And update the code to use either the old or new methods as appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=632590
2010-10-21 15:02:33 -04:00
Florian Müllner
627f1cb59a iconGrid: Add alignment parameter
Currently the grid's content is centered, which is not appropriate
for all use cases. Add an optional parameter to control the alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=632147
2010-10-14 17:41:54 +02:00
Florian Müllner
9708b68540 [baseIcon] Tie the icon's width to its height
Both current design and new mockups use square icons. Currently this
is implemented by setting a fixed width and height in the CSS, which
does not work for the growing/shrinking items in the new sidebar.
By moving the assumption of square items into the code, the size will
adjust according to icon size, spacing, padding and font size if not
explicitly overwritten in the CSS.

https://bugzilla.gnome.org/show_bug.cgi?id=625887
2010-09-23 19:08:43 +02:00
Florian Müllner
01f4dc68b8 [baseIcon] Allow setting the icon size from code
The current design features a sidebar where the icon size shrinks
automatically to fit more items. Add a setSizeManually parameter
to BaseIcon, which disables sizes read from CSS and allows to use
BaseIcon.setIconSize() to support this.

https://bugzilla.gnome.org/show_bug.cgi?id=625887
2010-09-23 19:08:43 +02:00
Florian Müllner
8c1bf346a9 [appDisplay] Factor out WellGrid/AppIcon
All mockups now use a representation for documents/places similar to
the one used for applications. Rename AppIcon to BaseIcon and move its
code together with WellGrid out of appDisplay to stress their general
usefulness.

https://bugzilla.gnome.org/show_bug.cgi?id=625887
2010-09-23 19:08:43 +02:00