~ubuntu-branches/ubuntu/vivid/guayadeque/vivid

« back to all changes in this revision

Viewing changes to src/.svn/text-base/GIO_Volume.h.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-25 11:59:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110225115910-13phl46pz0rgqg0a
Tags: 0.2.9-1
* Imported Upstream version 0.2.9
* Drop 02-google_cover_search_engine_crash.patch patch, applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -------------------------------------------------------------------------------- //
 
2
//      Copyright (C) 2008-2010 J.Rios
 
3
//      anonbeat@gmail.com
 
4
//
 
5
//    This Program is free software; you can redistribute it and/or modify
 
6
//    it under the terms of the GNU General Public License as published by
 
7
//    the Free Software Foundation; either version 2, or (at your option)
 
8
//    any later version.
 
9
//
 
10
//    This Program is distributed in the hope that it will be useful,
 
11
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
//    GNU General Public License for more details.
 
14
//
 
15
//    You should have received a copy of the GNU General Public License
 
16
//    along with this program; see the file LICENSE.  If not, write to
 
17
//    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
//    http://www.gnu.org/copyleft/gpl.html
 
19
//
 
20
// -------------------------------------------------------------------------------- //
 
21
#ifndef GIO_VOLUME_H
 
22
#define GIO_VOLUME_H
 
23
 
 
24
#include <gio/gio.h>
 
25
 
 
26
#include "Utils.h"
 
27
 
 
28
#include <wx/arrstr.h>
 
29
#include <wx/string.h>
 
30
#include <wx/dynarray.h>
 
31
 
 
32
class guGIO_Mount;
 
33
 
 
34
// -------------------------------------------------------------------------------- //
 
35
class guGIO_Volume
 
36
{
 
37
  private :
 
38
    GVolume * m_Volume;
 
39
 
 
40
  protected :
 
41
 
 
42
  public :
 
43
    guGIO_Volume( GVolume * volume ) { m_Volume = volume; }
 
44
    ~guGIO_Volume( void ) { if( m_Volume ) g_object_unref( m_Volume ); }
 
45
 
 
46
    wxString        GetName( void );
 
47
    wxString        GetUUID( void );
 
48
    wxString        GetIcon( void );
 
49
    //GDrive          GetDrive( void );
 
50
    guGIO_Mount     GetMount( void );
 
51
    bool            CanMount( void );
 
52
    bool            ShouldAutoMount( void );
 
53
    //void            Mount( int flags,
 
54
    bool            CanEject( void );
 
55
 
 
56
};
 
57
 
 
58
// -------------------------------------------------------------------------------- //
 
59
class guGIO_Mount
 
60
{
 
61
  private :
 
62
    GMount * m_Mount;
 
63
 
 
64
  protected :
 
65
    int             m_PanelActive;
 
66
    bool            m_IsReadOnly;
 
67
    wxString        m_Name;
 
68
    wxString        m_MountPath;
 
69
    wxString        m_IconString;
 
70
 
 
71
  public :
 
72
    guGIO_Mount( GMount * mount );
 
73
    guGIO_Mount( GMount * mount, wxString &mountpath );
 
74
    ~guGIO_Mount();
 
75
 
 
76
    bool            IsMount( GMount * mount ) { return m_Mount == mount; }
 
77
 
 
78
    bool            IsReadOnly( void ) { return m_IsReadOnly; }
 
79
 
 
80
    int             PanelActive( void ) { guLogMessage( wxT( "PanelActive: %i" ), m_PanelActive ); return m_PanelActive; }
 
81
    void            SetPanelActive( int active ) { m_PanelActive = active; }
 
82
 
 
83
    wxString        GetName( void ) { return m_Name; }
 
84
    wxString        GetMountPath( void ) { return m_MountPath; }
 
85
    wxString        IconString( void ) { return m_IconString; }
 
86
 
 
87
    GVolume         GetVolume( void );
 
88
 
 
89
    bool            CanUnmount( void );
 
90
    void            Unmount( void );
 
91
};
 
92
WX_DEFINE_ARRAY_PTR( guGIO_Mount *, guGIO_MountArray );
 
93
 
 
94
// -------------------------------------------------------------------------------- //
 
95
class guGIO_VolumeMonitor
 
96
{
 
97
  private :
 
98
    int                 m_VolumeAddedId;
 
99
    int                 m_VolumeRemovedId;
 
100
    int                 m_MountAddedId;
 
101
    int                 m_MountPreUnmountId;
 
102
    int                 m_MountRemovedId;
 
103
 
 
104
  protected :
 
105
    GVolumeMonitor *    m_VolumeMonitor;
 
106
    guGIO_MountArray *  m_MountedVolumes;
 
107
 
 
108
    int                 FindMount( GMount * mount );
 
109
 
 
110
    void                GetCurrentMounts( void );
 
111
 
 
112
  public :
 
113
    guGIO_VolumeMonitor();
 
114
    ~guGIO_VolumeMonitor();
 
115
 
 
116
    void                OnMountAdded( GMount * mount );
 
117
    void                OnMountRemoved( GMount * mount );
 
118
    void                OnVolumeAdded( GVolume * volume );
 
119
    void                OnVolumeRemoved( GVolume * volume );
 
120
 
 
121
    wxArrayString       GetMountNames( void );
 
122
    int                 GetMountCount( void ) { return m_MountedVolumes->Count(); }
 
123
    guGIO_Mount *       GetMount( const int index ) { return m_MountedVolumes->Item( index ); }
 
124
    guGIO_Mount *       GetMount( const wxString &mountname );
 
125
    int                 PanelActive( const int index ) { return m_MountedVolumes->Item( index )->PanelActive(); }
 
126
};
 
127
 
 
128
#endif
 
129
// -------------------------------------------------------------------------------- //