Back to index

unity  6.0.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
unity::launcher::DeviceLauncherSection Class Reference

#include <DeviceLauncherSection.h>

Inheritance diagram for unity::launcher::DeviceLauncherSection:
Inheritance graph
[legend]
Collaboration diagram for unity::launcher::DeviceLauncherSection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DeviceLauncherSection ()

Public Attributes

sigc::signal< void,
AbstractLauncherIcon::Ptr
IconAdded

Private Member Functions

void PopulateEntries ()
void OnVolumeAdded (GVolumeMonitor *monitor, GVolume *volume)
void OnVolumeRemoved (GVolumeMonitor *monitor, GVolume *volume)

Private Attributes

std::map< GVolume
*, DeviceLauncherIcon * > 
map_
glib::Object< GVolumeMonitor > monitor_
glib::Idle device_populate_idle_
glib::SignalManager sig_manager_

Detailed Description

Definition at line 41 of file DeviceLauncherSection.h.


Constructor & Destructor Documentation

Definition at line 26 of file DeviceLauncherSection.cpp.

  : monitor_(g_volume_monitor_get())
{
  typedef glib::Signal<void, GVolumeMonitor*, GVolume*> VolumeSignal;
  sig_manager_.Add(new VolumeSignal(monitor_, "volume-added", sigc::mem_fun(this, &DeviceLauncherSection::OnVolumeAdded)));
  sig_manager_.Add(new VolumeSignal(monitor_, "volume-removed", sigc::mem_fun(this, &DeviceLauncherSection::OnVolumeRemoved)));

  device_populate_idle_.Run([&] () {
    PopulateEntries();
    return false;
  });
}

Here is the call graph for this function:


Member Function Documentation

void unity::launcher::DeviceLauncherSection::OnVolumeAdded ( GVolumeMonitor *  monitor,
GVolume *  volume 
) [private]

Definition at line 64 of file DeviceLauncherSection.cpp.

{
  // This just wraps the volume in a glib::Object, global ref_count is only
  // temporary changed.
  glib::Object<GVolume> gvolume(volume, glib::AddRef());
  DeviceLauncherIcon* icon = new DeviceLauncherIcon(gvolume);

  map_[gvolume] = icon;
  IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
}

Here is the caller graph for this function:

void unity::launcher::DeviceLauncherSection::OnVolumeRemoved ( GVolumeMonitor *  monitor,
GVolume *  volume 
) [private]

Definition at line 75 of file DeviceLauncherSection.cpp.

{
  auto volume_it = map_.find(volume);

  // It should not happen! Let me do the check anyway.
  if (volume_it != map_.end())
  {
    volume_it->second->OnRemoved();
    map_.erase(volume_it);
  }
}

Here is the caller graph for this function:

Definition at line 39 of file DeviceLauncherSection.cpp.

{
  GList* volumes = g_volume_monitor_get_volumes(monitor_);

  for (GList* v = volumes; v; v = v->next)
  {
    if (!G_IS_VOLUME(v->data))
      continue;

    // This will unref the volume, since the list entries needs that.
    // We'll keep a reference in the icon.
    glib::Object<GVolume> volume(G_VOLUME(v->data));
    DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);

    map_[volume] = icon;
    IconAdded.emit(AbstractLauncherIcon::Ptr(icon));
  }

  g_list_free(volumes);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 57 of file DeviceLauncherSection.h.

Definition at line 46 of file DeviceLauncherSection.h.

Definition at line 55 of file DeviceLauncherSection.h.

Definition at line 56 of file DeviceLauncherSection.h.

Definition at line 58 of file DeviceLauncherSection.h.


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