~woodrow-shen/totem/mybranch

« back to all changes in this revision

Viewing changes to browser-plugin/totemConePlaylist.cpp

Tags: 2.24.3-3
* totem-mozilla.docs: ship README.browser-plugin which explains how to 
  disable the plugin for some MIME types.
* rules: remove the hack that only let totem-xine support VCDs and 
  DVDs, now that GStreamer supports them. Closes: #370789.
* 01_fake_keypresses.patch: new patch. Completely disable the broken 
  XTEST code that generates fake keypresses. Closes: #500330.
* 90_autotools.patch: regenerated.
* Build-depend on nautilus 2.22 to be sure to build the extension for 
  the correct version.
* totem-xine depends on libxine1-x.
* Standards version is 3.8.1.
* Upload to unstable.
* 04_tracker_build.patch: new patch, stolen upstream. Fix build with 
  latest tracker version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Totem Cone plugin
 
2
 *
 
3
 * Copyright © 2004 Bastien Nocera <hadess@hadess.net>
 
4
 * Copyright © 2002 David A. Schleef <ds@schleef.org>
 
5
 * Copyright © 2006, 2008 Christian Persch
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Library General Public
 
9
 * License as published by the Free Software Foundation; either
 
10
 * version 2 of the License, or (at your option) any later version.
 
11
 *
 
12
 * This library is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Library General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Library General Public
 
18
 * License along with this library; if not, write to the
 
19
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
20
 * Boston, MA 02110-1301  USA.
 
21
 */
 
22
 
 
23
#include <config.h>
 
24
 
 
25
#include <string.h>
 
26
 
 
27
#include <glib.h>
 
28
 
 
29
#include "totemPlugin.h"
 
30
#include "totemConePlaylist.h"
 
31
 
 
32
static const char *propertyNames[] = {
 
33
  "isPlaying",
 
34
  "items"
 
35
};
 
36
 
 
37
static const char *methodNames[] = {
 
38
  "add",
 
39
  "next",
 
40
  "play",
 
41
  "playItem",
 
42
  "prev",
 
43
  "removeItem",
 
44
  "stop",
 
45
  "togglePause"
 
46
};
 
47
 
 
48
TOTEM_IMPLEMENT_NPCLASS (totemConePlaylist,
 
49
                         propertyNames, G_N_ELEMENTS (propertyNames),
 
50
                         methodNames, G_N_ELEMENTS (methodNames),
 
51
                         NULL);
 
52
 
 
53
totemConePlaylist::totemConePlaylist (NPP aNPP)
 
54
  : totemNPObject (aNPP)
 
55
{
 
56
  TOTEM_LOG_CTOR ();
 
57
}
 
58
 
 
59
totemConePlaylist::~totemConePlaylist ()
 
60
{
 
61
  TOTEM_LOG_DTOR ();
 
62
}
 
63
 
 
64
bool
 
65
totemConePlaylist::InvokeByIndex (int aIndex,
 
66
                                  const NPVariant *argv,
 
67
                                  uint32_t argc,
 
68
                                  NPVariant *_result)
 
69
{
 
70
  TOTEM_LOG_INVOKE (aIndex, totemConePlaylist);
 
71
 
 
72
  switch (Methods (aIndex)) {
 
73
    case eAdd: {
 
74
      /* long add (in AUTF8String MRL, [in AUTF8String name, in AUTF8String options]); */
 
75
      if (!CheckArgc (argc, 1, 3))
 
76
        return false;
 
77
 
 
78
      const char *mrl;
 
79
      if (!GetStringFromArguments (argv, argc, 0, mrl))
 
80
        return false;
 
81
 
 
82
      Plugin()->AddItem (mrl);
 
83
      return Int32Variant (_result, 0);
 
84
    }
 
85
 
 
86
    case ePlay:
 
87
      Plugin()->Command (TOTEM_COMMAND_PLAY);
 
88
      return VoidVariant (_result);
 
89
 
 
90
    case eStop:
 
91
      Plugin()->Command (TOTEM_COMMAND_STOP);
 
92
      return VoidVariant (_result);
 
93
 
 
94
    case eNext:
 
95
    case ePlayItem:
 
96
    case ePrev:
 
97
    case eRemoveItem:
 
98
    case eTogglePause:
 
99
      TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemConePlaylist);
 
100
      return VoidVariant (_result);
 
101
  }
 
102
 
 
103
  return false;
 
104
}
 
105
 
 
106
bool
 
107
totemConePlaylist::GetPropertyByIndex (int aIndex,
 
108
                                       NPVariant *_result)
 
109
{
 
110
  TOTEM_LOG_GETTER (aIndex, totemConePlaylist);
 
111
 
 
112
  switch (Properties (aIndex)) {
 
113
    case eItems:
 
114
      return ObjectVariant (_result, Plugin()->GetNPObject (totemPlugin::eConePlaylistItems));
 
115
 
 
116
    case eIsPlaying:
 
117
      return BoolVariant (_result, Plugin()->State() == TOTEM_STATE_PLAYING);
 
118
  }
 
119
 
 
120
  return false;
 
121
}
 
122
 
 
123
bool
 
124
totemConePlaylist::SetPropertyByIndex (int aIndex,
 
125
                                       const NPVariant *aValue)
 
126
{
 
127
  TOTEM_LOG_SETTER (aIndex, totemConePlaylist);
 
128
 
 
129
  return ThrowPropertyNotWritable ();
 
130
}