~golfish/netbook-remix-launcher/desktop

« back to all changes in this revision

Viewing changes to src/launcher-behave.c

  • Committer: Neil J. Patel
  • Date: 2008-04-16 11:31:15 UTC
  • Revision ID: njpatel@gmail.com-20080416113115-ztljg0qms79anijd
* Inital import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2007 Intel
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 *
 
19
 * Authored by Neil Jagdish Patel <njp@o-hand.com>
 
20
 *
 
21
 */
 
22
 
 
23
#include "launcher-behave.h"
 
24
 
 
25
G_DEFINE_TYPE (LauncherBehave, launcher_behave, CLUTTER_TYPE_BEHAVIOUR);
 
26
 
 
27
#define LAUNCHER_BEHAVE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
 
28
  LAUNCHER_TYPE_BEHAVE, \
 
29
  LauncherBehavePrivate))
 
30
 
 
31
struct _LauncherBehavePrivate
 
32
{
 
33
  LauncherBehaveAlphaFunc     func;
 
34
  gpointer              data;
 
35
};
 
36
 
 
37
static void
 
38
launcher_behave_alpha_notify (ClutterBehaviour *behave, guint32 alpha_value)
 
39
{
 
40
  LauncherBehave *launcher_behave = LAUNCHER_BEHAVE(behave);
 
41
  LauncherBehavePrivate *priv;
 
42
        
 
43
  priv = LAUNCHER_BEHAVE_GET_PRIVATE (launcher_behave);
 
44
        
 
45
  if (priv->func != NULL) 
 
46
    priv->func (behave, alpha_value, priv->data);
 
47
}
 
48
 
 
49
static void
 
50
launcher_behave_class_init (LauncherBehaveClass *klass)
 
51
{
 
52
  GObjectClass        *gobject_class = G_OBJECT_CLASS (klass);
 
53
  ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
 
54
 
 
55
  behave_class->alpha_notify = launcher_behave_alpha_notify;
 
56
        
 
57
  g_type_class_add_private (gobject_class, sizeof (LauncherBehavePrivate));
 
58
}
 
59
 
 
60
static void
 
61
launcher_behave_init (LauncherBehave *self)
 
62
{
 
63
  LauncherBehavePrivate *priv;
 
64
        
 
65
  priv = LAUNCHER_BEHAVE_GET_PRIVATE (self);
 
66
        
 
67
  priv->func = NULL;
 
68
  priv->data = NULL;
 
69
}
 
70
 
 
71
ClutterBehaviour*
 
72
launcher_behave_new (ClutterAlpha                      *alpha,
 
73
                     LauncherBehaveAlphaFunc    func,
 
74
                     gpointer                         data)
 
75
{
 
76
  LauncherBehave *behave;
 
77
  LauncherBehavePrivate *priv;
 
78
        
 
79
  behave = g_object_new (LAUNCHER_TYPE_BEHAVE, 
 
80
                         "alpha", alpha,
 
81
                         NULL);
 
82
 
 
83
  priv = LAUNCHER_BEHAVE_GET_PRIVATE (behave);  
 
84
        
 
85
  priv->func = func;
 
86
  priv->data = data;
 
87
                
 
88
  return CLUTTER_BEHAVIOUR(behave);
 
89
}