Back to index

unity  6.0.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions
unity::dash::Filter Class Reference

#include <Filter.h>

Inheritance diagram for unity::dash::Filter:
Inheritance graph
[legend]
Collaboration diagram for unity::dash::Filter:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr< FilterPtr
typedef std::map< std::string,
unity::glib::Variant
Hints

Public Member Functions

 Filter (DeeModel *model, DeeModelIter *iter)
virtual ~Filter ()
virtual void Clear ()=0
bool IsValid () const

Static Public Member Functions

static Filter::Ptr FilterFromIter (DeeModel *model, DeeModelIter *iter)

Public Attributes

nux::ROProperty< std::string > id
nux::ROProperty< std::string > name
nux::ROProperty< std::string > icon_hint
nux::ROProperty< std::string > renderer_name
nux::ROProperty< bool > visible
nux::ROProperty< bool > collapsed
nux::ROProperty< bool > filtering
sigc::signal< void > removed

Protected Member Functions

virtual void Update (Hints &hints)=0
void Refresh ()
void IgnoreChanges (bool ignore)

Protected Attributes

DeeModel * model_
DeeModelIter * iter_
glib::SignalManager signal_manager_
bool ignore_changes_

Private Member Functions

void SetupGetters ()
void OnRowChanged (DeeModel *model, DeeModelIter *iter)
void OnRowRemoved (DeeModel *model, DeeModelIter *iter)
void HintsToMap (Hints &hints)
std::string get_id () const
std::string get_name () const
std::string get_icon_hint () const
std::string get_renderer_name () const
bool get_visible () const
bool get_collapsed () const
bool get_filtering () const

Static Private Member Functions

static void OnModelDestroyed (Filter *self, DeeModel *old_location)

Detailed Description

Definition at line 66 of file Filter.h.


Member Typedef Documentation

typedef std::map<std::string, unity::glib::Variant> unity::dash::Filter::Hints

Definition at line 70 of file Filter.h.

typedef std::shared_ptr<Filter> unity::dash::Filter::Ptr

Constructor & Destructor Documentation

unity::dash::Filter::Filter ( DeeModel *  model,
DeeModelIter *  iter 
)

Definition at line 41 of file Filter.cpp.

  : model_(model)
  , iter_(iter)
  , ignore_changes_(false)
{
  typedef Signal<void, DeeModel*, DeeModelIter*> RowSignalType;

  // If the model is destroyed (say if the lens restarts) then we should handle
  // that gracefully
  g_object_weak_ref(reinterpret_cast<GObject*>(model_),
                    (GWeakNotify)Filter::OnModelDestroyed, this);

  // Add some filters to handle updates and removed
  signal_manager_.Add(new RowSignalType(model_,
                                        "row-changed",
                                        sigc::mem_fun(this, &Filter::OnRowChanged)));
  signal_manager_.Add(new RowSignalType(model_,
                                        "row-removed",
                                        sigc::mem_fun(this, &Filter::OnRowRemoved)));

  SetupGetters();
}

Here is the call graph for this function:

Definition at line 64 of file Filter.cpp.

{
  if (model_)
    g_object_weak_unref(reinterpret_cast<GObject*>(model_),
                        (GWeakNotify)Filter::OnModelDestroyed, this);
}

Here is the call graph for this function:


Member Function Documentation

virtual void unity::dash::Filter::Clear ( ) [pure virtual]
Filter::Ptr unity::dash::Filter::FilterFromIter ( DeeModel *  model,
DeeModelIter *  iter 
) [static]

Definition at line 82 of file Filter.cpp.

{
  std::string renderer = dee_model_get_string(model, iter, 3);

  if (renderer == "filter-ratings")
    return std::make_shared<RatingsFilter>(model, iter);
  else if (renderer == "filter-radiooption")
    return std::make_shared<RadioOptionFilter>(model, iter);
  else if (renderer == "filter-checkoption")
    return std::make_shared<CheckOptionFilter>(model, iter);
  else if (renderer == "filter-checkoption-compact")
    return std::make_shared<CheckOptionFilter>(model, iter);
  else if (renderer == "filter-multirange")
    return std::make_shared<MultiRangeFilter>(model, iter);
  else
    return std::make_shared<RatingsFilter>(model, iter);
}

Here is the caller graph for this function:

bool unity::dash::Filter::get_collapsed ( ) const [private]

Definition at line 196 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_bool(model_, iter_, FilterColumn::COLLAPSED);
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Filter::get_filtering ( ) const [private]

Definition at line 203 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_bool(model_, iter_, FilterColumn::FILTERING);
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::dash::Filter::get_icon_hint ( ) const [private]

Definition at line 175 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_string(model_, iter_, FilterColumn::ICON_HINT);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::dash::Filter::get_id ( ) const [private]

Definition at line 161 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_string(model_, iter_, FilterColumn::ID);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::dash::Filter::get_name ( ) const [private]

Definition at line 168 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_string(model_, iter_, FilterColumn::NAME);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::string unity::dash::Filter::get_renderer_name ( ) const [private]

Definition at line 182 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_string(model_, iter_, FilterColumn::RENDERER_NAME);
  return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool unity::dash::Filter::get_visible ( ) const [private]

Definition at line 189 of file Filter.cpp.

{
  if (IsValid())
    return dee_model_get_bool(model_, iter_, FilterColumn::VISIBLE);
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::Filter::HintsToMap ( Hints hints) [private]

Definition at line 145 of file Filter.cpp.

{
  GVariant* row_value = dee_model_get_value(model_, iter_, FilterColumn::RENDERER_STATE);

  GVariantIter iter;
  g_variant_iter_init(&iter, row_value);

  char* key = NULL;
  GVariant* value = NULL;
  while (g_variant_iter_loop(&iter, "{sv}", &key, &value))
  {
    map[key] = value;
  }
  g_variant_unref(row_value);
}

Here is the caller graph for this function:

void unity::dash::Filter::IgnoreChanges ( bool  ignore) [protected]

Definition at line 111 of file Filter.cpp.

{
  ignore_changes_ = ignore;
}

Here is the caller graph for this function:

Definition at line 100 of file Filter.cpp.

{
  return model_ && iter_;
}

Here is the caller graph for this function:

void unity::dash::Filter::OnModelDestroyed ( Filter self,
DeeModel *  old_location 
) [static, private]

Definition at line 116 of file Filter.cpp.

{
  self->OnRowRemoved(self->model_, self->iter_);
}

Here is the caller graph for this function:

void unity::dash::Filter::OnRowChanged ( DeeModel *  model,
DeeModelIter *  iter 
) [private]

Definition at line 121 of file Filter.cpp.

{
  if (iter_ != iter || ignore_changes_)
    return;

  // Ask our sub-classes to update their state
  Hints hints;
  HintsToMap(hints);
  Update(hints);

  visible.EmitChanged(get_visible());
  filtering.EmitChanged(get_filtering());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::dash::Filter::OnRowRemoved ( DeeModel *  model,
DeeModelIter *  iter 
) [private]

Definition at line 135 of file Filter.cpp.

{
  if (iter_ != iter)
    return;

  model_ = 0;
  iter_ = 0;
  removed.emit();
}

Here is the caller graph for this function:

void unity::dash::Filter::Refresh ( ) [protected]

Definition at line 105 of file Filter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 71 of file Filter.cpp.

{
  id.SetGetterFunction(sigc::mem_fun(this, &Filter::get_id));
  name.SetGetterFunction(sigc::mem_fun(this, &Filter::get_name));
  icon_hint.SetGetterFunction(sigc::mem_fun(this, &Filter::get_icon_hint));
  renderer_name.SetGetterFunction(sigc::mem_fun(this, &Filter::get_renderer_name));
  visible.SetGetterFunction(sigc::mem_fun(this, &Filter::get_visible));
  collapsed.SetGetterFunction(sigc::mem_fun(this, &Filter::get_collapsed));
  filtering.SetGetterFunction(sigc::mem_fun(this, &Filter::get_filtering));
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void unity::dash::Filter::Update ( Hints hints) [protected, pure virtual]

Member Data Documentation

nux::ROProperty<bool> unity::dash::Filter::collapsed

Definition at line 85 of file Filter.h.

nux::ROProperty<bool> unity::dash::Filter::filtering

Definition at line 86 of file Filter.h.

nux::ROProperty<std::string> unity::dash::Filter::icon_hint

Definition at line 82 of file Filter.h.

nux::ROProperty<std::string> unity::dash::Filter::id

Definition at line 80 of file Filter.h.

Reimplemented in unity::dash::MultiRangeFilter, and unity::dash::RadioOptionFilter.

Definition at line 114 of file Filter.h.

DeeModelIter* unity::dash::Filter::iter_ [protected]

Definition at line 112 of file Filter.h.

DeeModel* unity::dash::Filter::model_ [protected]

Definition at line 111 of file Filter.h.

nux::ROProperty<std::string> unity::dash::Filter::name

Definition at line 81 of file Filter.h.

sigc::signal<void> unity::dash::Filter::removed

Definition at line 88 of file Filter.h.

nux::ROProperty<std::string> unity::dash::Filter::renderer_name

Definition at line 83 of file Filter.h.

Definition at line 113 of file Filter.h.

nux::ROProperty<bool> unity::dash::Filter::visible

Definition at line 84 of file Filter.h.


The documentation for this class was generated from the following files: