totem r5132 - in trunk: . browser-plugin
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5132 - in trunk: . browser-plugin
- Date: Fri, 15 Feb 2008 23:52:58 +0000 (GMT)
Author: hadess
Date: Fri Feb 15 23:52:58 2008
New Revision: 5132
URL: http://svn.gnome.org/viewvc/totem?rev=5132&view=rev
Log:
2008-02-15 Bastien Nocera <hadess hadess net>
* browser-plugin/org_gnome_totem_PluginViewer.xml:
* browser-plugin/totem-plugin-viewer-constants.h:
* browser-plugin/totempluginviewer-marshal.list:
* browser-plugin/totem-plugin-viewer.c:
(totem_embedded_class_init), (totem_embedded_save_volume),
(totem_embedded_stop), (totem_embedded_set_volume),
(totem_embedded_set_fullscreen),
(totem_embedded_toggle_fullscreen), (cb_vol), (on_tick),
(totem_embedded_action_volume_relative),
(totem_embedded_construct):
Implement a property change signal when fullscreen state
or volume changes
* browser-plugin/totemPlugin.cpp:
* browser-plugin/totemPlugin.h: As above and implement
SetFullscreen()
* browser-plugin/totemComplexPlugin.cpp:
* browser-plugin/totemComplexPlugin.h:
* browser-plugin/totemGMPSettings.cpp:
* browser-plugin/totemGMPSettings.h:
* browser-plugin/totemNarrowSpacePlugin.cpp:
* browser-plugin/totemNarrowSpacePlugin.h:
Fix for changes above
* browser-plugin/totemConePlugin.cpp:
* browser-plugin/totemConePlugin.h:
Implement ToggleFullscreen/ToggleMute, state, mute,
volume and fullscreen properties
(Closes: #462544)
Modified:
trunk/ChangeLog
trunk/browser-plugin/org_gnome_totem_PluginViewer.xml
trunk/browser-plugin/totem-plugin-viewer-constants.h
trunk/browser-plugin/totem-plugin-viewer.c
trunk/browser-plugin/totemComplexPlugin.cpp
trunk/browser-plugin/totemComplexPlugin.h
trunk/browser-plugin/totemConePlugin.cpp
trunk/browser-plugin/totemConePlugin.h
trunk/browser-plugin/totemGMPSettings.cpp
trunk/browser-plugin/totemGMPSettings.h
trunk/browser-plugin/totemNarrowSpacePlugin.cpp
trunk/browser-plugin/totemNarrowSpacePlugin.h
trunk/browser-plugin/totemPlugin.cpp
trunk/browser-plugin/totemPlugin.h
trunk/browser-plugin/totempluginviewer-marshal.list
Modified: trunk/browser-plugin/org_gnome_totem_PluginViewer.xml
==============================================================================
--- trunk/browser-plugin/org_gnome_totem_PluginViewer.xml (original)
+++ trunk/browser-plugin/org_gnome_totem_PluginViewer.xml Fri Feb 15 23:52:58 2008
@@ -41,7 +41,7 @@
<arg type="s" name="HrefURI" direction="in" />
<arg type="s" name="Target" direction="in" />
</method>
- <method name="SetErrorLogo"/>
+ <method name="SetErrorLogo" />
<method name="LaunchPlayer">
<arg type="s" name="URI" direction="in" />
<arg type="u" name="Time" direction="in" />
@@ -53,6 +53,9 @@
<method name="AddItem">
<arg type="s" name="URI" direction="in" />
</method>
+ <method name="SetFullscreen">
+ <arg type="b" name="FullscreenEnabled" direction="in" />
+ </method>
<signal name="ButtonPress">
<arg type="u" name="Time" />
@@ -63,6 +66,10 @@
<arg type="u" name="Duration" />
<arg type="s" name="State" />
</signal>
+ <signal name="PropertyChange">
+ <arg type="s" name="PropertyType" />
+ <arg type="v" name="Value" />
+ </signal>
<signal name="StartStream" />
<signal name="StopStream" />
</interface>
Modified: trunk/browser-plugin/totem-plugin-viewer-constants.h
==============================================================================
--- trunk/browser-plugin/totem-plugin-viewer-constants.h (original)
+++ trunk/browser-plugin/totem-plugin-viewer-constants.h Fri Feb 15 23:52:58 2008
@@ -40,4 +40,7 @@
"INVALID"
};
+#define TOTEM_PROPERTY_VOLUME "volume"
+#define TOTEM_PROPERTY_ISFULLSCREEN "is-fullscreen"
+
#endif /* !__TOTEM_PLUGIN_VIEWER_CONSTANTS__ */
Modified: trunk/browser-plugin/totem-plugin-viewer.c
==============================================================================
--- trunk/browser-plugin/totem-plugin-viewer.c (original)
+++ trunk/browser-plugin/totem-plugin-viewer.c Fri Feb 15 23:52:58 2008
@@ -189,6 +189,7 @@
START_STREAM,
STOP_STREAM,
SIGNAL_TICK,
+ PROPERTY_CHANGE,
LAST_SIGNAL
};
@@ -257,6 +258,14 @@
NULL /* accu */, NULL /* accu data */,
totempluginviewer_marshal_VOID__UINT_UINT_STRING,
G_TYPE_NONE, 3, param_types);
+ signals[PROPERTY_CHANGE] =
+ g_signal_new ("property-change",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0 /* class offset */,
+ NULL /* accu */, NULL /* accu data */,
+ totempluginviewer_marshal_VOID__STRING_BOXED,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VALUE);
}
static void
@@ -279,10 +288,17 @@
totem_embedded_save_volume (TotemEmbedded *emb, double volume)
{
GConfClient *gc;
+ GValue value = { 0, };
gc = gconf_client_get_default ();
gconf_client_set_int (gc, GCONF_PREFIX"/volume", (int) (volume * 100.0), NULL);
g_object_unref (G_OBJECT (gc));
+
+ g_value_init (&value, G_TYPE_DOUBLE);
+ g_value_set_double (&value, volume);
+ g_signal_emit (emb, signals[PROPERTY_CHANGE], 0,
+ TOTEM_PROPERTY_VOLUME,
+ &value);
}
static void
@@ -543,6 +559,11 @@
totem_embedded_set_state (emb, TOTEM_STATE_STOPPED);
bacon_video_widget_stop (emb->bvw);
+ g_signal_emit (emb, signals[SIGNAL_TICK], 0,
+ (guint32) 0,
+ (guint32) 0,
+ totem_states[emb->state]);
+
return TRUE;
}
@@ -604,6 +625,7 @@
{
g_message ("totem_embedded_set_volume: %f", volume);
bacon_video_widget_set_volume (embedded->bvw, volume);
+ totem_embedded_save_volume (embedded, volume);
return TRUE;
}
@@ -997,6 +1019,62 @@
}
static gboolean
+totem_embedded_set_fullscreen (TotemEmbedded *emb,
+ gboolean fullscreen_enabled,
+ GError **error)
+{
+ GValue value = { 0, };
+ GtkAction *fs_action;
+
+ fs_action = GTK_ACTION (gtk_builder_get_object
+ (emb->menuxml, "fullscreen1"));
+
+ if (totem_fullscreen_is_fullscreen (emb->fs) == fullscreen_enabled)
+ return TRUE;
+
+ g_message ("totem_embedded_set_fullscreen: %d", fullscreen_enabled);
+
+ if (fullscreen_enabled == FALSE) {
+ GtkWidget * container;
+ container = GTK_WIDGET (gtk_builder_get_object (emb->xml,
+ "video_box"));
+
+ totem_fullscreen_set_fullscreen (emb->fs, FALSE);
+ gtk_widget_reparent (GTK_WIDGET (emb->bvw), container);
+ gtk_widget_hide_all (emb->fs_window);
+
+ gtk_action_set_sensitive (fs_action, TRUE);
+ } else {
+ GdkRectangle rect;
+ int monitor;
+
+ /* Move the fullscreen window to the screen where the
+ * video widget currently is */
+ monitor = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
+ GTK_WIDGET (emb->bvw)->window);
+ gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
+ monitor, &rect);
+ gtk_window_move (GTK_WINDOW (emb->fs_window), rect.x, rect.y);
+
+ gtk_widget_reparent (GTK_WIDGET (emb->bvw), emb->fs_window);
+ bacon_video_widget_set_fullscreen (emb->bvw, TRUE);
+ gtk_window_fullscreen (GTK_WINDOW (emb->fs_window));
+ totem_fullscreen_set_fullscreen (emb->fs, TRUE);
+ gtk_widget_show_all (emb->fs_window);
+
+ gtk_action_set_sensitive (fs_action, FALSE);
+ }
+
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, fullscreen_enabled);
+ g_signal_emit (emb, signals[PROPERTY_CHANGE], 0,
+ TOTEM_PROPERTY_ISFULLSCREEN,
+ &value);
+
+ return TRUE;
+}
+
+static gboolean
totem_embedded_open_uri (TotemEmbedded *emb,
const char *uri,
const char *base_uri,
@@ -1460,40 +1538,10 @@
static void
totem_embedded_toggle_fullscreen (TotemEmbedded *emb)
{
- GtkAction * fs_action = GTK_ACTION (gtk_builder_get_object
- (emb->menuxml, "fullscreen1"));
-
if (totem_fullscreen_is_fullscreen (emb->fs) != FALSE)
- {
- GtkWidget * container;
- container = GTK_WIDGET (gtk_builder_get_object (emb->xml,
- "video_box"));
-
- totem_fullscreen_set_fullscreen (emb->fs, FALSE);
- gtk_widget_reparent (GTK_WIDGET (emb->bvw), container);
- gtk_widget_hide_all (emb->fs_window);
-
- gtk_action_set_sensitive (fs_action, TRUE);
- } else {
- GdkRectangle rect;
- int monitor;
-
- /* Move the fullscreen window to the screen where the
- * video widget currently is */
- monitor = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
- GTK_WIDGET (emb->bvw)->window);
- gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
- monitor, &rect);
- gtk_window_move (GTK_WINDOW (emb->fs_window), rect.x, rect.y);
-
- gtk_widget_reparent (GTK_WIDGET (emb->bvw), emb->fs_window);
- bacon_video_widget_set_fullscreen (emb->bvw, TRUE);
- gtk_window_fullscreen (GTK_WINDOW (emb->fs_window));
- totem_fullscreen_set_fullscreen (emb->fs, TRUE);
- gtk_widget_show_all (emb->fs_window);
-
- gtk_action_set_sensitive (fs_action, FALSE);
- }
+ totem_embedded_set_fullscreen (emb, FALSE, NULL);
+ else
+ totem_embedded_set_fullscreen (emb, TRUE, NULL);
}
static void
@@ -1638,6 +1686,7 @@
cb_vol (GtkWidget *val, gdouble value, TotemEmbedded *emb)
{
bacon_video_widget_set_volume (emb->bvw, value);
+ totem_embedded_save_volume (emb, value);
}
static void
@@ -1669,7 +1718,9 @@
}
g_signal_emit (emb, signals[SIGNAL_TICK], 0,
- (guint32) current_time, (guint32) stream_length, totem_states[emb->state]);
+ (guint32) current_time,
+ (guint32) stream_length,
+ totem_states[emb->state]);
}
static void
@@ -1736,6 +1787,7 @@
vol = bacon_video_widget_get_volume (emb->bvw);
bacon_video_widget_set_volume (emb->bvw, vol + off_pct);
+ totem_embedded_save_volume (emb, vol + off_pct);
}
static gboolean
@@ -1948,6 +2000,7 @@
g_signal_connect (G_OBJECT (emb->volume), "value-changed",
G_CALLBACK (cb_vol), emb);
bacon_video_widget_set_volume (emb->bvw, volume);
+ totem_embedded_save_volume (emb, volume);
emb->statusbar = TOTEM_STATUSBAR (gtk_builder_get_object (emb->xml, "statusbar"));
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (emb->statusbar), FALSE);
Modified: trunk/browser-plugin/totemComplexPlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemComplexPlugin.cpp (original)
+++ trunk/browser-plugin/totemComplexPlugin.cpp Fri Feb 15 23:52:58 2008
@@ -68,7 +68,6 @@
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
: mPlugin(aPlugin),
- mVolume(50),
mPlayState(eState_Stopped)
{
D ("%s ctor [%p]", kClassDescription, (void*) this);
@@ -2019,7 +2018,7 @@
nsresult rv = mPlugin->SetVolume ((double) volume / 100);
/* Volume passed in is 0 through to 100 */
- mVolume = volume;
+ mPlugin->mVolume = volume;
return NS_OK;
}
@@ -2030,7 +2029,7 @@
{
TOTEM_SCRIPTABLE_LOG_ACCESS ();
- *_retval = mVolume;
+ *_retval = mPlugin->mVolume;
return NS_OK;
}
Modified: trunk/browser-plugin/totemComplexPlugin.h
==============================================================================
--- trunk/browser-plugin/totemComplexPlugin.h (original)
+++ trunk/browser-plugin/totemComplexPlugin.h Fri Feb 15 23:52:58 2008
@@ -53,7 +53,6 @@
totemPlugin *mPlugin;
PRInt32 mNumLoops;
- PRInt32 mVolume;
nsCString mAuthor;
nsCString mBackgroundColour;
Modified: trunk/browser-plugin/totemConePlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemConePlugin.cpp (original)
+++ trunk/browser-plugin/totemConePlugin.cpp Fri Feb 15 23:52:58 2008
@@ -57,7 +57,8 @@
};
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
- : mPlugin(aPlugin)
+ : mPlugin(aPlugin),
+ mMute(PR_FALSE)
{
D ("%s ctor [%p]", kClassDescription, (void*) this);
}
@@ -345,9 +346,27 @@
NS_IMETHODIMP
totemScriptablePlugin::GetState(PRInt32 *aState)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
- return NS_ERROR_NOT_IMPLEMENTED;
+ NS_ENSURE_STATE (IsValid());
+
+ /* IDLE/CLOSE=0,
+ * OPENING=1,
+ * BUFFERING=2,
+ * PLAYING=3,
+ * PAUSED=4,
+ * STOPPING=5,
+ * ERROR=6
+ */
+ if (mPlugin->mState == TOTEM_STATE_PLAYING) {
+ *aState = 3;
+ } else if (mPlugin->mState == TOTEM_STATE_PAUSED) {
+ *aState = 4;
+ } else {
+ *aState = 0;
+ }
+
+ return NS_OK;
}
NS_IMETHODIMP
@@ -383,38 +402,58 @@
NS_IMETHODIMP
totemScriptablePlugin::GetMute(PRBool *_retval)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
-// *_retval = mMute;
+ *_retval = mMute;
return NS_OK;
}
NS_IMETHODIMP
totemScriptablePlugin::SetMute(PRBool enabled)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ nsresult rv;
-// mMute = enabled != PR_FALSE;
- return NS_OK;
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
+
+ NS_ENSURE_STATE (IsValid ());
+
+ if (enabled == PR_FALSE) {
+ mMute = PR_FALSE;
+ rv = mPlugin->SetVolume (mSavedVolume);
+ } else {
+ mMute = PR_TRUE;
+ mSavedVolume = mPlugin->mVolume;
+ rv = mPlugin->SetVolume (0);
+ };
+
+ return rv;
}
/* attribute long volume */
NS_IMETHODIMP
totemScriptablePlugin::GetVolume(PRInt32 *_retval)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
+
+ NS_ENSURE_STATE (IsValid ());
-// *_retval = mVolume;
+ *_retval = mPlugin->mVolume * 200.0;
return NS_OK;
}
NS_IMETHODIMP
totemScriptablePlugin::SetVolume(PRInt32 aVolume)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
-// mVolume = aVolume;
- return NS_OK;
+ NS_ENSURE_STATE (IsValid ());
+
+ nsresult rv = mPlugin->SetVolume ((double) aVolume / 200.0);
+
+ /* Volume passed in is 0 through to 200 */
+ mPlugin->mVolume = (double) aVolume / 200.0;
+
+ return rv;
}
/* attribute long track */
@@ -456,10 +495,7 @@
{
TOTEM_SCRIPTABLE_LOG_ACCESS ();
- NS_ENSURE_STATE (IsValid ());
-
- return PR_TRUE;
-// return mPlugin->ClearPlaylist ();
+ return SetMute (!mMute);
}
/* totemIConeAudio */
@@ -488,18 +524,26 @@
NS_IMETHODIMP
totemScriptablePlugin::GetFullscreen(PRBool *_retval)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
+
+ NS_ENSURE_STATE (IsValid ());
+
+ *_retval = mPlugin->mIsFullscreen;
-// *_retval = mMute;
return NS_OK;
}
NS_IMETHODIMP
totemScriptablePlugin::SetFullscreen(PRBool enabled)
{
- TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED();
+ TOTEM_SCRIPTABLE_LOG_ACCESS ();
+
+ NS_ENSURE_STATE (IsValid ());
+
+ nsresult rv = mPlugin->SetFullscreen (enabled);
+
+ mPlugin->mIsFullscreen = enabled != PR_FALSE;
-// mMute = enabled != PR_FALSE;
return NS_OK;
}
@@ -563,8 +607,11 @@
NS_ENSURE_STATE (IsValid ());
- return PR_TRUE;
-// return mPlugin->ClearPlaylist ();
+ nsresult rv = mPlugin->SetFullscreen (!mPlugin->mIsFullscreen);
+
+ mPlugin->mIsFullscreen = !mPlugin->mIsFullscreen;
+
+ return NS_OK;
}
/* void toggleTeletext () */
Modified: trunk/browser-plugin/totemConePlugin.h
==============================================================================
--- trunk/browser-plugin/totemConePlugin.h (original)
+++ trunk/browser-plugin/totemConePlugin.h Fri Feb 15 23:52:58 2008
@@ -64,6 +64,9 @@
~totemScriptablePlugin ();
totemPlugin *mPlugin;
+
+ PRUint32 mMute : 1;
+ double mSavedVolume;
};
#endif /* __CONE_PLUGIN_H__ */
Modified: trunk/browser-plugin/totemGMPSettings.cpp
==============================================================================
--- trunk/browser-plugin/totemGMPSettings.cpp (original)
+++ trunk/browser-plugin/totemGMPSettings.cpp Fri Feb 15 23:52:58 2008
@@ -53,8 +53,7 @@
static const char kClassDescription[] = "totemGMPSettings";
totemGMPSettings::totemGMPSettings (totemScriptablePlugin *aPlugin)
- : mVolume(100),
- mPlugin(aPlugin)
+ : mPlugin(aPlugin)
{
D ("%s ctor [%p]", kClassDescription, (void*) this);
}
@@ -256,7 +255,9 @@
{
TOTEM_SCRIPTABLE_LOG_ACCESS ();
- *_retval = mVolume;
+ NS_ENSURE_STATE (IsValid ());
+
+ *_retval = mPlugin->mPlugin->mVolume;
return NS_OK;
}
NS_IMETHODIMP
@@ -269,7 +270,7 @@
nsresult rv = mPlugin->mPlugin->SetVolume ((double) volume / 100);
/* Volume passed in is 0 through to 100 */
- mVolume = volume;
+ mPlugin->mPlugin->mVolume = volume;
return NS_OK;
}
Modified: trunk/browser-plugin/totemGMPSettings.h
==============================================================================
--- trunk/browser-plugin/totemGMPSettings.h (original)
+++ trunk/browser-plugin/totemGMPSettings.h Fri Feb 15 23:52:58 2008
@@ -44,7 +44,6 @@
private:
~totemGMPSettings ();
- PRInt32 mVolume;
PRUint32 mMute : 1;
totemScriptablePlugin *mPlugin;
Modified: trunk/browser-plugin/totemNarrowSpacePlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemNarrowSpacePlugin.cpp (original)
+++ trunk/browser-plugin/totemNarrowSpacePlugin.cpp Fri Feb 15 23:52:58 2008
@@ -71,8 +71,7 @@
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
: mPluginState(eState_Waiting),
- mPlugin(aPlugin),
- mVolume(100)
+ mPlugin(aPlugin)
{
D ("%s ctor [%p]", kClassDescription, (void*) this);
}
@@ -969,22 +968,25 @@
{
TOTEM_SCRIPTABLE_LOG_ACCESS ();
- *_retval = mVolume;
+ NS_ENSURE_STATE (IsValid ());
+
+ *_retval = mPlugin->mVolume * 100.0;
return NS_OK;
}
/* void SetVolume (in unsigned long volume); */
NS_IMETHODIMP
-totemScriptablePlugin::SetVolume(PRUint32 volume)
+totemScriptablePlugin::SetVolume(PRUint32 aVolume)
{
TOTEM_SCRIPTABLE_LOG_ACCESS ();
NS_ENSURE_STATE (IsValid ());
- nsresult rv = mPlugin->SetVolume ((double) volume / 100);
+ nsresult rv = mPlugin->SetVolume ((double) aVolume / 100);
/* Volume passed in is 0 through to 100 */
- mVolume = volume;
+ mPlugin->mVolume = (double) aVolume / 100;
- return NS_OK;
+ return rv;
}
+
Modified: trunk/browser-plugin/totemNarrowSpacePlugin.h
==============================================================================
--- trunk/browser-plugin/totemNarrowSpacePlugin.h (original)
+++ trunk/browser-plugin/totemNarrowSpacePlugin.h Fri Feb 15 23:52:58 2008
@@ -68,8 +68,6 @@
nsCString mRectangle;
nsCString mMovieName;
- PRInt32 mVolume;
-
PRUint32 mAutoPlay : 1;
PRUint32 mControllerVisible : 1;
PRUint32 mIsLooping : 1;
Modified: trunk/browser-plugin/totemPlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemPlugin.cpp (original)
+++ trunk/browser-plugin/totemPlugin.cpp Fri Feb 15 23:52:58 2008
@@ -247,6 +247,25 @@
}
nsresult
+totemPlugin::SetFullscreen (gboolean enabled)
+{
+ D ("SetFullscreen '%d'", enabled);
+
+ /* FIXME: queue the action instead */
+ if (!mViewerReady)
+ return NS_OK;
+
+ NS_ASSERTION (mViewerProxy, "No viewer proxy");
+ dbus_g_proxy_call_no_reply (mViewerProxy,
+ "SetFullscreen",
+ G_TYPE_BOOLEAN, enabled,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ return NS_OK;
+}
+
+nsresult
totemPlugin::ClearPlaylist (void)
{
D ("ClearPlaylist");
@@ -511,6 +530,20 @@
reinterpret_cast<void*>(this),
NULL);
+ dbus_g_object_register_marshaller
+ (totempluginviewer_marshal_VOID__STRING_BOXED,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOXED, G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (mViewerProxy,
+ "PropertyChange",
+ G_TYPE_STRING,
+ G_TYPE_VALUE,
+ G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (mViewerProxy,
+ "PropertyChange",
+ G_CALLBACK (PropertyChangeCallback),
+ reinterpret_cast<void*>(this),
+ NULL);
+
if (mHidden) {
ViewerReady ();
} else {
@@ -556,6 +589,10 @@
"Tick",
G_CALLBACK (TickCallback),
reinterpret_cast<void*>(this));
+ dbus_g_proxy_disconnect_signal (mViewerProxy,
+ "PropertyChange",
+ G_CALLBACK (PropertyChangeCallback),
+ reinterpret_cast<void*>(this));
g_object_unref (mViewerProxy);
mViewerProxy = NULL;
@@ -982,6 +1019,25 @@
}
/* static */ void PR_CALLBACK
+totemPlugin::PropertyChangeCallback (DBusGProxy *proxy,
+ const char *aType,
+ GValue *value,
+ void *aData)
+{
+ totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData);
+
+ NS_ASSERTION (aType != NULL, "aType is NULL probably garbage");
+
+ DD ("PropertyChange signal received, aType %s", aType);
+
+ if (strcmp (aType, TOTEM_PROPERTY_VOLUME) == 0) {
+ plugin->mVolume = g_value_get_double (value);
+ } else if (strcmp (aType, TOTEM_PROPERTY_ISFULLSCREEN) == 0) {
+ plugin->mIsFullscreen = g_value_get_boolean (value);
+ }
+}
+
+/* static */ void PR_CALLBACK
totemPlugin::ViewerSetWindowCallback (DBusGProxy *aProxy,
DBusGProxyCall *aCall,
void *aData)
Modified: trunk/browser-plugin/totemPlugin.h
==============================================================================
--- trunk/browser-plugin/totemPlugin.h (original)
+++ trunk/browser-plugin/totemPlugin.h Fri Feb 15 23:52:58 2008
@@ -62,6 +62,7 @@
nsresult SetVolume (gdouble aVolume);
nsresult ClearPlaylist (void);
nsresult AddItem (const nsACString &aURI);
+ nsresult SetFullscreen (gboolean enabled);
nsresult SetSrc (const nsACString &aURL);
@@ -125,6 +126,10 @@
guint aDuration,
char *aState,
void *aData);
+ static void PR_CALLBACK PropertyChangeCallback (DBusGProxy *proxy,
+ const char *type,
+ GValue *value,
+ void *aData);
static void PR_CALLBACK ViewerSetWindowCallback (DBusGProxy *aProxy,
DBusGProxyCall *aCall,
@@ -213,6 +218,8 @@
PRUint32 mTime;
PRUint32 mDuration;
TotemStates mState;
+ double mVolume;
+ PRBool mIsFullscreen;
#ifdef TOTEM_GMP_PLUGIN
public:
Modified: trunk/browser-plugin/totempluginviewer-marshal.list
==============================================================================
--- trunk/browser-plugin/totempluginviewer-marshal.list (original)
+++ trunk/browser-plugin/totempluginviewer-marshal.list Fri Feb 15 23:52:58 2008
@@ -1,2 +1,3 @@
VOID:UINT,UINT
VOID:UINT,UINT,STRING
+VOID:STRING,BOXED
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]