static void
impl_activate (PeasActivatable *plugin)
{
	XplayerMoviePropertiesPlugin *pi;
	XplayerObject *xplayer;

	pi = XPLAYER_MOVIE_PROPERTIES_PLUGIN (plugin);
	xplayer = g_object_get_data (G_OBJECT (plugin), "object");

	pi->priv->props = bacon_video_widget_properties_new ();
	gtk_widget_show (pi->priv->props);
	xplayer_add_sidebar_page (xplayer,
				"properties",
				_("Properties"),
				pi->priv->props);
	gtk_widget_set_sensitive (pi->priv->props, FALSE);

	g_signal_connect (G_OBJECT (xplayer),
			  "file-opened",
			  G_CALLBACK (xplayer_movie_properties_plugin_file_opened),
			  plugin);
	g_signal_connect (G_OBJECT (xplayer),
			  "file-closed",
			  G_CALLBACK (xplayer_movie_properties_plugin_file_closed),
			  plugin);
	g_signal_connect (G_OBJECT (xplayer),
			  "metadata-updated",
			  G_CALLBACK (xplayer_movie_properties_plugin_metadata_updated),
			  plugin);
	pi->priv->handler_id_stream_length = g_signal_connect (G_OBJECT (xplayer),
							 "notify::stream-length",
							 G_CALLBACK (stream_length_notify_cb),
							 plugin);
}
Esempio n. 2
0
static void
impl_activate (PeasActivatable *plugin)
{
	TotemMoviePropertiesPlugin *pi;
	TotemObject *totem;
	GtkWindow *parent;
	GMenu *menu;
	GMenuItem *item;

	pi = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin);
	totem = g_object_get_data (G_OBJECT (plugin), "object");

	pi->priv->props = bacon_video_widget_properties_new ();
	gtk_widget_show (pi->priv->props);
	gtk_widget_set_sensitive (pi->priv->props, FALSE);

	parent = totem_object_get_main_window (totem);
	pi->priv->dialog = gtk_dialog_new_with_buttons (_("Properties"),
							parent,
							GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
							NULL,
							GTK_RESPONSE_CLOSE,
							NULL);
	g_object_unref (parent);
	g_signal_connect (pi->priv->dialog, "delete-event",
			  G_CALLBACK (gtk_widget_hide_on_delete), NULL);
	g_signal_connect (pi->priv->dialog, "response",
			  G_CALLBACK (gtk_widget_hide_on_delete), NULL);
	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (pi->priv->dialog))),
			   pi->priv->props);

	/* Properties action */
	pi->priv->props_action = g_simple_action_new ("properties", NULL);
	g_signal_connect (G_OBJECT (pi->priv->props_action), "activate",
			  G_CALLBACK (properties_action_cb), pi);
	g_action_map_add_action (G_ACTION_MAP (totem), G_ACTION (pi->priv->props_action));
	gtk_application_add_accelerator (GTK_APPLICATION (totem),
					 "<Primary>p",
					 "app.properties",
					 NULL);
	/* FIXME: Handle GDK_KEY_View */

	/* Install the menu */
	menu = totem_object_get_menu_section (totem, "properties-placeholder");
	item = g_menu_item_new (_("_Properties"), "app.properties");
	g_menu_item_set_attribute (item, "accel", "s", "<Primary>p");
	g_menu_append_item (G_MENU (menu), item);
	g_object_unref (item);

	g_signal_connect (G_OBJECT (totem),
			  "file-opened",
			  G_CALLBACK (totem_movie_properties_plugin_file_opened),
			  plugin);
	g_signal_connect (G_OBJECT (totem),
			  "file-closed",
			  G_CALLBACK (totem_movie_properties_plugin_file_closed),
			  plugin);
	g_signal_connect (G_OBJECT (totem),
			  "metadata-updated",
			  G_CALLBACK (totem_movie_properties_plugin_metadata_updated),
			  plugin);
	pi->priv->handler_id_stream_length = g_signal_connect (G_OBJECT (totem),
							       "notify::stream-length",
							       G_CALLBACK (stream_length_notify_cb),
							       plugin);
}