~ci-train-bot/unity/unity-ubuntu-xenial-landing-028

« back to all changes in this revision

Viewing changes to lockscreen/CofView.cpp

  • Committer: CI Train Bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2016-04-01 23:11:21 UTC
  • mfrom: (4093.2.30 themed-texture-cache)
  • Revision ID: ci-train-bot@canonical.com-20160401231121-or6ge8fgw25y4m41
TextureCache: add support for loading themed textures

When a themed texture is requested, we add it to a list so that we can invalidate
it on theme changes.

Use themed textures in any case we load local files, falling back to the default path if
theme doesn't provide any customized asset. Fixes: #903179, #1208790
Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
* Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
18
18
*/
19
19
 
 
20
#include "config.h"
 
21
 
20
22
#include "CofView.h"
21
23
#include "unity-shared/RawPixel.h"
22
 
 
23
 
#include "config.h"
 
24
#include "unity-shared/ThemeSettings.h"
24
25
 
25
26
namespace unity
26
27
{
28
29
{
29
30
namespace
30
31
{
31
 
const std::string COF_FILE = "cof.png";
 
32
const std::string COF_FILE = "lockscreen_cof";
32
33
}
33
34
 
34
35
CofView::CofView()
35
 
  // FIXME (andy) if we get an svg cof we can make it fullscreen independent.
36
 
  : IconTexture(PKGDATADIR"/"+COF_FILE, -1)
 
36
  // FIXME (andy) if we get an svg cof we can make it resolution independent.
 
37
  : IconTexture(theme::Settings::Get()->ThemedFilePath(COF_FILE, {PKGDATADIR}), std::numeric_limits<unsigned>::max())
37
38
  , scale(1.0)
38
39
{
39
40
  scale.changed.connect([this] (double scale) {
40
41
    int w, h;
41
 
    gdk_pixbuf_get_file_info((PKGDATADIR"/" + COF_FILE).c_str(), &w, &h);
 
42
    gdk_pixbuf_get_file_info(theme::Settings::Get()->ThemedFilePath(COF_FILE, {PKGDATADIR}).c_str(), &w, &h);
42
43
    SetSize(RawPixel(std::max(w, h)).CP(scale));
43
44
    ReLoadIcon();
44
45
  });
47
48
nux::Area* CofView::FindAreaUnderMouse(nux::Point const& mouse_position,
48
49
                                       nux::NuxEventType event_type)
49
50
{
50
 
    return nullptr;
 
51
  return nullptr;
51
52
}
52
53
 
53
54
}