~ubuntu-branches/ubuntu/raring/workrave/raring

« back to all changes in this revision

Viewing changes to frontend/win32/applet/src/ClsFact.cpp

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Jordi Mallach
  • Date: 2012-05-28 11:29:40 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20120528112940-bbbsjkk30fom9s8x
Tags: 1.9.909+abc941eb70-1
[ Francois Marier ]
* New upstream snapshot
  - Drop leak-fix patch (applied upstream)
  - Document how the tarball is built in README.source
* Build GNOME applets and use gsettings
* Massive update of Build-Depends as per configure.ac

* Update README.source with snapshot instructions
* Switch to machine-readable copyright file
* Update alioth git repo links
* Bump debhelper version to 9
* Bump Standards-Version to 3.9.3

[ Jordi Mallach ]
* Avoid references to GNU/Linux in manpage.
* Drop build dependency on libgnet-dev, it's obsolete and unneeded.
* Add myself to Uploaders.
* Rewrite d/rules into dh style.
  - Move all install tweaks to .install files.
  - Install manpages using dh_installman.
* As a side effect, the package installs arch-dependant data in the
  arch triplet directory; add the required Pre-Depends for m-a-support.
* Bring back GNOME Panel applet (for GNOME 3 fallback mode) and ship the
  new GNOME Shell extension (closes: #642514, #666100).
* Add private_dirs.patch: move libworkrave-private and GObject
  Introspection files to a private dir, so they are really out of the
  way, but disable it for now as it breaks the Shell extension.
* Move typelib out of the triplet dir as gobject-introspection is not
  M-A ready yet.
* Enable dh_autoreconf for the above patches.
* Add lintian overrides.
* Add necessary Breaks/Replaces as the xpm icon has moved to workrave-data.
* Prefix all debhelper files with package name.
* Suggest gnome-shell and gnome-panel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ClsFact.h --- CClassFactory implementation
2
 
//
3
 
// Copyright (C) 2004, 2007 Raymond Penners <raymond@dotsphinx.com>
4
 
// All rights reserved.
5
 
//
6
 
// This program is free software: you can redistribute it and/or modify
7
 
// it under the terms of the GNU General Public License as published by
8
 
// the Free Software Foundation, either version 3 of the License, or
9
 
// (at your option) any later version.
10
 
//
11
 
// This program is distributed in the hope that it will be useful,
12
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
// GNU General Public License for more details.
15
 
//
16
 
// You should have received a copy of the GNU General Public License
17
 
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
//
19
 
// $Id$
20
 
 
21
 
#include "ClsFact.h"
22
 
#include "Guid.h"
23
 
#include "Debug.h"
24
 
 
25
 
CClassFactory::CClassFactory(CLSID clsid)
26
 
{
27
 
  TRACE_ENTER("CClassFactory::CClassFactory");
28
 
  m_clsidObject = clsid;
29
 
  m_ObjRefCount = 1;
30
 
  g_DllRefCount++;
31
 
  TRACE_EXIT();
32
 
}
33
 
 
34
 
 
35
 
CClassFactory::~CClassFactory()
36
 
{
37
 
  TRACE_ENTER("CClassFactory::CClassFactory");
38
 
  g_DllRefCount--;
39
 
  TRACE_MSG(g_DllRefCount);
40
 
  TRACE_EXIT();
41
 
}
42
 
 
43
 
 
44
 
STDMETHODIMP CClassFactory::QueryInterface(REFIID riid, LPVOID *ppReturn)
45
 
{
46
 
  *ppReturn = NULL;
47
 
 
48
 
  if (IsEqualIID(riid, IID_IUnknown))
49
 
    {
50
 
      *ppReturn = this;
51
 
    }
52
 
 
53
 
  else if (IsEqualIID(riid, IID_IClassFactory))
54
 
    {
55
 
      *ppReturn = (IClassFactory*)this;
56
 
    }
57
 
 
58
 
  if (*ppReturn)
59
 
    {
60
 
      (*(LPUNKNOWN*)ppReturn)->AddRef();
61
 
      return S_OK;
62
 
    }
63
 
 
64
 
  return E_NOINTERFACE;
65
 
}
66
 
 
67
 
 
68
 
STDMETHODIMP_(DWORD) CClassFactory::AddRef()
69
 
{
70
 
  return ++m_ObjRefCount;
71
 
}
72
 
 
73
 
 
74
 
STDMETHODIMP_(DWORD) CClassFactory::Release()
75
 
{
76
 
  if (--m_ObjRefCount == 0)
77
 
    {
78
 
      delete this;
79
 
      return 0;
80
 
    }
81
 
 
82
 
  return m_ObjRefCount;
83
 
}
84
 
 
85
 
 
86
 
STDMETHODIMP CClassFactory::CreateInstance(LPUNKNOWN pUnknown,
87
 
                                           REFIID riid,
88
 
                                           LPVOID *ppObject)
89
 
{
90
 
  HRESULT  hResult = E_FAIL;
91
 
  LPVOID   pTemp = NULL;
92
 
 
93
 
  *ppObject = NULL;
94
 
 
95
 
  if (pUnknown != NULL)
96
 
    return CLASS_E_NOAGGREGATION;
97
 
 
98
 
  //create the proper object
99
 
  if (IsEqualCLSID(m_clsidObject, CLSID_WorkraveDeskBand))
100
 
    {
101
 
#ifdef TRACING
102
 
      Debug::init();
103
 
#endif
104
 
 
105
 
      CDeskBand *pDeskBand = new CDeskBand();
106
 
      if (NULL == pDeskBand)
107
 
        return E_OUTOFMEMORY;
108
 
 
109
 
      pTemp = pDeskBand;
110
 
    }
111
 
 
112
 
  if (pTemp)
113
 
    {
114
 
      //get the QueryInterface return for our return value
115
 
      hResult = ((LPUNKNOWN)pTemp)->QueryInterface(riid, ppObject);
116
 
 
117
 
      //call Release to decement the ref count
118
 
      ((LPUNKNOWN)pTemp)->Release();
119
 
    }
120
 
 
121
 
  return hResult;
122
 
}
123
 
 
124
 
 
125
 
STDMETHODIMP CClassFactory::LockServer(BOOL)
126
 
{
127
 
  return E_NOTIMPL;
128
 
}